<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0"
	 xmlns:dc="http://purl.org/dc/elements/1.1/"
	 xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	 xmlns:admin="http://webns.net/mvcb/"
	 xmlns:atom="http://www.w3.org/2005/Atom"
	 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	 xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">

	<channel>
		<title>Institute of Omniscience in Institute of Omniscience </title>
		<itunes:subtitle>Yukio Fukuzawa's personal blogs</itunes:subtitle>
		<itunes:author>Yukio Fukuzawa</itunes:author>
		<itunes:owner>
		<itunes:name>Yukio Fukuzawa</itunes:name>
		<itunes:email>y dot fukuzawa at massey </itunes:email>
		</itunes:owner>
		<itunes:category text="Education">
		<itunes:category text="Higher Education"/>
		</itunes:category>
		<itunes:keywords>phd, latex, yukio fukuzawa, massey, new zealand</itunes:keywords>
		<itunes:explicit>no</itunes:explicit>
		<itunes:image href="https://www.io.ac.nz//img/avatar2.jpg" />
		<generator uri="https://gohugo.io">Hugo</generator>
		<link>https://www.io.ac.nz/index.xml</link>
		<language>en-us</language>
		
		
		<updated>Thu, 09 Feb 2017 22:12:10 UTC</updated>

		
		<item>
			<title>Sns</title>
			<link>https://www.io.ac.nz/sns/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/sns/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Institute of Omniscience</title>
			<link>https://www.io.ac.nz/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Cruz vs Sanders</title>
			<link>https://www.io.ac.nz/sns/cruz-vs-sanders/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/sns/cruz-vs-sanders/</guid>
			<description>&lt;p&gt;On CNN&amp;rsquo;s &lt;a href=&#34;http://edition.cnn.com/2017/02/07/politics/obamacare-cruz-sanders-highlights/&#34;&gt;Cruz-Sander health-care debate&lt;/a&gt; Long talk, no real debate. Cruz talks about the &amp;ldquo;average family&amp;rdquo; and Sanders the &amp;ldquo;cancer patients&amp;rdquo;, two different things. Cancer happens to a small portion of the population, and an &amp;ldquo;average family&amp;rdquo; is unlikely to have to deal with it.&lt;/p&gt;
</description>
		</item>
		
		<item>
			<title>Thesis</title>
			<link>https://www.io.ac.nz/tags/thesis/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/thesis/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Template</title>
			<link>https://www.io.ac.nz/categories/template/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/categories/template/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Template</title>
			<link>https://www.io.ac.nz/tags/template/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/template/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Resources</title>
			<link>https://www.io.ac.nz/resources/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/resources/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Phd Tips</title>
			<link>https://www.io.ac.nz/categories/phd-tips/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/categories/phd-tips/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Latex</title>
			<link>https://www.io.ac.nz/categories/latex/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/categories/latex/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Latex</title>
			<link>https://www.io.ac.nz/tags/latex/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/latex/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Academia</title>
			<link>https://www.io.ac.nz/categories/academia/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/categories/academia/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Academia</title>
			<link>https://www.io.ac.nz/tags/academia/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/academia/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Doctoral/Master Dissertation Template - Massey University</title>
			<link>https://www.io.ac.nz/resources/thesis-template/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/resources/thesis-template/</guid>
			<description>&lt;p&gt;This is the template for doctoral/master thesis. It&amp;rsquo;s my thesis still in writing with
all the content removed. I also populate it with LaTex tips and tricks that you might find useful. The template
is not an official one but it complies with all requirements regarding layout, font typeface and appearance.
It compiles with PdfLaTeX and biber. XeTeX and LuaTeX are also tested and confirmed working.
&lt;/p&gt;

&lt;p&gt;&lt;div class=&#34;pdf-embedded&#34; src=&#34;https://www.io.ac.nz/files/thesis-template.pdf&#34; hwratio=1&gt;&lt;/div&gt;
&lt;br/&gt;
Source code in Tex: &lt;a href=&#34;https://www.io.ac.nz/files/thesis-template.zip&#34;&gt;thesis-template.zip&lt;/a&gt;&lt;/p&gt;</description>
		</item>
		
		<item>
			<title>Poster</title>
			<link>https://www.io.ac.nz/tags/poster/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/poster/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Scientific Poster Template - Massey University</title>
			<link>https://www.io.ac.nz/resources/poster-template/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/resources/poster-template/</guid>
			<description>&lt;p&gt;This is my poster at the &lt;a href=&#34;http://ivcnz.massey.ac.nz/&#34;&gt;Image and Vision Computing New Zealand (IVCNZ) 2016&lt;/a&gt; held at Massey&amp;rsquo;s Manawatu campus. It&amp;rsquo;s the visualisation of the &lt;a href=&#34;https://www.io.ac.nz/publications/ivcnz2016/&#34;&gt;paper&lt;/a&gt; I submitted to that conference. I&amp;rsquo;m too lazy to remove the actual content so you have to do that yourself.&lt;/p&gt;

&lt;p&gt;To change the background image, find line&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;\includegraphics[width=\paperwidth,height=\paperheight]{bird3.jpg}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and change &lt;code&gt;bird3.jpg&lt;/code&gt; to anything you want.&lt;/p&gt;

&lt;p&gt;The poster is A0 size, but temporarily resized to A4 when editing, so that the size stays manageable and you don&amp;rsquo;t have to zoom in everytime it&amp;rsquo;s recompiled. This is thank to package &lt;code&gt;pgfpage&lt;/code&gt; and its command &lt;code&gt;\pgfpagesuselayout{resize to}[a4paper]&lt;/code&gt;. When you send the poster for printing, remember to uncomment that line and compile again. I&amp;rsquo;m sure the printery knows how to resize A4 to A0, but it&amp;rsquo;s better to provide the right size right away, so the bitmap background doesn&amp;rsquo;t become pixelated.&lt;br /&gt;
&lt;/p&gt;

&lt;div class=&#34;pdf-embedded&#34; src=&#34;https://www.io.ac.nz/files/poster-template.pdf&#34; hwratio=1&gt;&lt;/div&gt;

&lt;p&gt;Source code in Tex: &lt;a href=&#34;https://www.io.ac.nz/files/poster-template.zip&#34;&gt;poster-template.zip&lt;/a&gt;&lt;/p&gt;</description>
		</item>
		
		<item>
			<title>New Zealand</title>
			<link>https://www.io.ac.nz/tags/new-zealand/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/new-zealand/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Graphics</title>
			<link>https://www.io.ac.nz/categories/graphics/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/categories/graphics/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Graphics</title>
			<link>https://www.io.ac.nz/tags/graphics/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/graphics/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Academic Report Template - Massey University</title>
			<link>https://www.io.ac.nz/resources/report-template/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/resources/report-template/</guid>
			<description>&lt;p&gt;This is the template for academic report at university level. It&amp;rsquo;s basically my PhD Confirmation Report with
all the content removed. I also populate it with LaTex tips and tricks that you might find useful. The template
is not an official one but it complies with all requirements regarding layout, font typeface and appearance.
It compiles with PdfLaTeX and biber. XeTeX and LuaTeX are also tested and confirmed working.
&lt;/p&gt;

&lt;div class=&#34;pdf-embedded&#34; src=&#34;https://www.io.ac.nz/files/report-template.pdf&#34; hwratio=1&gt;&lt;/div&gt;

&lt;p&gt;Source code in Tex: &lt;a href=&#34;https://www.io.ac.nz/files/report-template.zip&#34;&gt;report-template.zip&lt;/a&gt;&lt;/p&gt;</description>
		</item>
		
		<item>
			<title>Conference</title>
			<link>https://www.io.ac.nz/tags/conference/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/conference/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Conference Presentation Template - Massey University</title>
			<link>https://www.io.ac.nz/resources/inms-pgconf-2016/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/resources/inms-pgconf-2016/</guid>
			<description>&lt;p&gt;This is the presentation I gave at the INMS PostGraduate Conference 2016. You are welcome to use it as template for your own presentation
A nice thing I did in this document is to embed presenter&amp;rsquo;s note in it.
Several software like MS Powerpoint are able to detect these notes and show them as cues on the screen facing the presenters.
Not only that, after compiling all the notes will be extracted to a &lt;code&gt;.pdfpc&lt;/code&gt; file for an easy print-out.
Because I couldn&amp;rsquo;t guarantee that the computer on which I presented my talk would show the notes for me, I needed this fail-safe measure.
&lt;/p&gt;

&lt;p&gt;&lt;div class=&#34;pdf-embedded&#34; src=&#34;https://www.io.ac.nz/files/inms-pgconf-2016.pdf&#34; hwratio=0.77&gt;&lt;/div&gt;
&lt;br/&gt;
The theme is based on &lt;a href=&#34;https://fedoraproject.org/wiki/Templates_for_Presentations&#34;&gt;Goddard&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source code in Tex: &lt;a href=&#34;https://www.io.ac.nz/files/inms-pgconf-2016-texsrc.zip&#34;&gt;inms-pgconf-2016-texsrc.zip&lt;/a&gt;&lt;/p&gt;</description>
		</item>
		
		<item>
			<title>Overleaf</title>
			<link>https://www.io.ac.nz/categories/overleaf/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/categories/overleaf/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Mendeley</title>
			<link>https://www.io.ac.nz/categories/mendeley/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/categories/mendeley/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Git</title>
			<link>https://www.io.ac.nz/categories/git/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/categories/git/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Blogs</title>
			<link>https://www.io.ac.nz/blog/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/blog/</guid>
			<description></description>
		</item>
		
		<item>
			<title>LaTeX with Overleaf</title>
			<link>https://www.io.ac.nz/blog/tex-with-overleaf/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/blog/tex-with-overleaf/</guid>
			<description>&lt;p&gt;&lt;span class=&#34;latex&#34;&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt; has been around for 30+ years (first release was in 1985) and is still the champion of typesetting, especially scientific typesetting. The language itself is fixed but the framework has undergone many expansion by third-party packages. So when people talk about &lt;span class=&#34;latex&#34;&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt; they usually mean the whole framework with all the packages without which you can&amp;rsquo;t even compile the most basic papers. This is a burden especially for academic novice like myself one year ago. Lucky me I&amp;rsquo;m a computer geek so learning how to install, upgrade and use &lt;span class=&#34;latex&#34;&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt; was a matter of a few hours Googling. But even within academics, sharing a &lt;span class=&#34;latex&#34;&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt; document remains a pain in the arse.&lt;/p&gt;

&lt;p&gt;&lt;a href=&#34;https://www.overleaf.com&#34;&gt;Overleaf&lt;/a&gt; is an online compiler that solves all those problems. When combined with Mendeley and Git they form a &amp;ldquo;dream team&amp;rdquo; that can significcantly improve your productivity. This article will show you how to set them up and and work with them in the most effective way.
&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Full disclosure&lt;/strong&gt;: I am an official Overleaf advisor of Massey University (you can find me &lt;a href=&#34;https://www.overleaf.com/advisors#!members&#34;&gt;here&lt;/a&gt;). This is a voluntary role and I don&amp;rsquo;t get any financial incentive to advertise for Overleaf. I also tried other similar services (such as &lt;a href=&#34;https://www.sharelatex.com&#34;&gt;ShareLaTeX&lt;/a&gt; and &lt;a href=&#34;https://papeeria.com&#34;&gt;Papeeria&lt;/a&gt;) but eventually settle at Overleaf. You should try all other options as well, but I have no in-depth experience to talk about them.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&#34;an-online-tool-for-offline-work&#34;&gt;An online tool for offline work&lt;/h2&gt;

&lt;p&gt;Overleaf is more than just an online &lt;span class=&#34;latex&#34;&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt; compiler (a computer geek can create one with Gitlab&amp;rsquo;s pipeline as described &lt;a href=&#34;https://gitlab.com/gitlab-org/gitlab-ce/issues/4250&#34;&gt;here&lt;/a&gt;), it is foremost a repository for &lt;span class=&#34;latex&#34;&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt; documents with links you can quickly share. Secondly, it allows real-time collaboration between multiple users, similar to what Google Drive or Office 365 provide. This feature once allow me and my supervisor to finish a paper moment before the submission closed. Third, its incorporation of Git allows you to version control your writing. And finally, Overleaf can access a reference managing service such as Mendeley, Zotero and CiteULike via API calls, so you don&amp;rsquo;t have to manage your bib file manually.&lt;/p&gt;

&lt;p&gt;These features are very useful when collaborating with another writers. However, most of the time I write stuff alone and working online is an unnecessary complication. First, Overleaf compiles your writing every few seconds, it&amp;rsquo;s pretty troublesome when you are in the middle of writing an unfinished piece of code and it gets compiled, which certainly will result in an error. This can be overcome by selecting manual compilation instead of automatic. Second, the web-based editor of Overleaf is far from perfect. It lacks a lot of features that a proper Tex editor provides, such as auto completing user-defined code, complicated math equations and table edition. Third, the integration of Overleaf with Mendeley is not automatic: first you have to sync the Mendeley application with its online repository, then you have to refresh Overleaf to update the bib file. That&amp;rsquo;s too many steps compare to what you can do following my article &lt;a href=&#34;https://www.io.ac.nz/blog/mendeley-to-tex/&#34;&gt;here&lt;/a&gt;, which doesn&amp;rsquo;t require you to do anything. And finally, everytime overleaf compiles your document it&amp;rsquo;ll make a commit to the Git repository. This is fine if you don&amp;rsquo;t care about Git, but if you do, it&amp;rsquo;ll clutter your repository with lots of &amp;ldquo;Updated on Overleaf&amp;rdquo; commits. In contrast, I want to have total control of the commits, such as having meaningful commit message and make commit only when reaching a milestone.&lt;/p&gt;

&lt;p&gt;In this article I&amp;rsquo;ll only write about using Overleaf together with &lt;em&gt;offline&lt;/em&gt; tools. Its online interface remains essential for sharing and collaborating when needed, but most of the time when writing alone, you should do so offline, and occasionally commit your change to Overleaf.&lt;/p&gt;

&lt;h2 id=&#34;tools-that-you-need&#34;&gt;Tools that you need&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;You will need an account on Overleaf, obviously. Check with your university if they have agreement with Overleaf to provide free Pro accounts for students and faculty members. In case they don&amp;rsquo;t, you can always sign up for a free account with 100 MB storage and then earn your way for larger space (See &lt;a href=&#34;https://www.overleaf.com/space&#34;&gt;here&lt;/a&gt; for details).&lt;/li&gt;
&lt;li&gt;You need Mendeley (forget Zotero, and CiteULike, they aren&amp;rsquo;t even close) and set it up according &lt;a href=&#34;https://www.io.ac.nz/blog/mendeley-to-tex/&#34;&gt;this article&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Install a TeX compiler (Follow the instructions &lt;a href=&#34;https://www.latex-project.org/get/&#34;&gt;here&lt;/a&gt;) as well as a TeX editor (I highly recommend &lt;a href=&#34;http://texstudio.sourceforge.net/&#34;&gt;TeXStudio&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Install &lt;a href=&#34;https://git-scm.com&#34;&gt;Git&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;On Windows, use Git Bash for command line interface - Don&amp;rsquo;t torture yourself with Windows&amp;rsquo; built-in console (CMD). Git Bash is available after installing Git and you can open a Git Bash window by right-clicking on an empty place on the desktop and choose Git Bash.&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Alternatively, install&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&#34;the-pipeline&#34;&gt;The pipeline&lt;/h2&gt;

&lt;h3 id=&#34;initiate-a-new-document&#34;&gt;Initiate a new document&lt;/h3&gt;

&lt;p&gt;It is imperative that you initiate a &lt;span class=&#34;latex&#34;&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt; document from Overleaf first, so that the repository gets set up correctly at the beginning. Otherwise, you&amp;rsquo;ll regret it. Navigate to Overleaf.com and click on &lt;strong&gt;&amp;ldquo;New Project&amp;rdquo;&lt;/strong&gt;, as following:&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://www.io.ac.nz/img-1000/banners/report-template-1.png&#34; width=&#34;100%&#34;&gt;&lt;/p&gt;

&lt;h3 id=&#34;clone-the-project-to-your-computer&#34;&gt;Clone the project to your computer&lt;/h3&gt;

&lt;p&gt;Then, open the new document, click on &lt;strong&gt;&amp;ldquo;Share&amp;rdquo;&lt;/strong&gt;, you&amp;rsquo;ll see the link to it&amp;rsquo;s Git repository.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://www.io.ac.nz/img-1000/banners/report-template-2.png&#34; width=&#34;100%&#34;&gt;&lt;/p&gt;

&lt;p&gt;Now, open a console window and clone the repository to your computer with the following command:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;git clone https://git.overleaf.com/7969959psbvhptbrmmw my-new-document
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Of course you&amp;rsquo;ll have to replace &lt;code&gt;https://git.overleaf.com/7969959psbvhptbrmmw&lt;/code&gt; with the actual link and &lt;code&gt;my-new-document&lt;/code&gt; with any name you want. Essentially the new document will be cloned into folder &lt;code&gt;my-new-document&lt;/code&gt;. When you open it, you&amp;rsquo;ll see the following content:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-treeview&#34;&gt;my-new-document/
|-- .git/
`-- main.tex
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;some-housekeeping-to-keep-it-clean&#34;&gt;Some housekeeping to keep it clean&lt;/h3&gt;

&lt;p&gt;Now, if you set up Mendeley correctly, then there will be a &lt;code&gt;library.bib&lt;/code&gt; file in that folder as well. You might not see the &lt;code&gt;.git&lt;/code&gt; folder because it is hidden. But don&amp;rsquo;t worry about that. What you need to do immediately is to create a file named &lt;code&gt;.gitignore&lt;/code&gt; which tells Git not to care about certain files, because the compilation of &lt;span class=&#34;latex&#34;&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt; creates a lot of temporary files.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;*.acn
*.acr
*.alg
*.aux
*.bbl
*.bcf
*.blg
*.dvi
*.fdb_latexmk
*.fls
*.glg
*.glo
*.gls
*.idx
*.ilg
*.ind
*.ist
*.lof
*.log
*.lot
*.maf
*.mtc
*.mtc0
*.nav
*.nlo
*.out
*.pdfsync
*.ps
*.run.xml
*.snm
*.synctex.gz
*.toc
*.vrb
*.xdy
*.tdo
.DS_Store
*-blx.bib
tmp/
*.upa
*.upb
cleanup.sh
*.dpth
*.auxlock
*.markdown.*
_markdown_main/
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That&amp;rsquo;s a huge list isn&amp;rsquo;t it? Now, once you do this, Git will ignore them, but they&amp;rsquo;re still there. You can also ignore them but I find it annoying to have all those temporary files sitting there contaminating my folder&amp;rsquo;s structure. Temporary files can also mess up with the compilation process, so I suggest you create a script that cleans them up for you automatically. Here&amp;rsquo;s the content of my &lt;code&gt;cleanup.sh&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;#! /bin/bash
find . -name &amp;quot;*.aux&amp;quot; | xargs rm -rf
find . -name &amp;quot;*.bbl&amp;quot; | xargs rm -rf
find . -name &amp;quot;*.bcf&amp;quot; | xargs rm -rf
find . -name &amp;quot;*.blg&amp;quot; | xargs rm -rf
find . -name &amp;quot;*.log&amp;quot; | xargs rm -rf
find . -name &amp;quot;*.run.xml&amp;quot; | xargs rm -rf
find . -name &amp;quot;*.synctex.gz&amp;quot; | xargs rm -rf
find . -name &amp;quot;*.fdb_latexmk&amp;quot; | xargs rm -rf
find . -name &amp;quot;*.toc&amp;quot; | xargs rm -rf
find . -name &amp;quot;*.out&amp;quot; | xargs rm -rf
find . -name &amp;quot;*.fls&amp;quot; | xargs rm -rf
find . -name &amp;quot;*.dpth&amp;quot; | xargs rm -rf
find . -name &amp;quot;*.auxlock&amp;quot; | xargs rm -rf
find . -name &amp;quot;*.lof&amp;quot; | xargs rm -rf
find . -name &amp;quot;*.dvi&amp;quot; | xargs rm -rf
find . -name &amp;quot;*.markdown.*&amp;quot; | xargs rm -rf
rm -rf main.synctex.gz\(busy\)
rm -rf _markdown_main
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;the-optimal-project-structure&#34;&gt;The optimal project structure&lt;/h3&gt;

&lt;p&gt;Now, you&amp;rsquo;re all set to get your document compiled and committed. If it&amp;rsquo;s a big document, such as a thesis, you might want to set it up in a more organising way than having everything inside &lt;code&gt;main.tex&lt;/code&gt;. My typical project structure will be as following:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-treeview&#34;&gt;my-new-document/
|-- .git/
|-- chapters/
|   |-- chapter-1.tex
|   `-- chapter-2.tex
|-- figures/
|   |-- figure1.pdf
|   |-- figure1.pdf_tex
|   |-- figure2.pdf
|   `-- figure2.pdf_tex
|-- .gitignore
|-- main.tex
|-- setup.tex
`-- library.bib
&lt;/code&gt;&lt;/pre&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;setup.tex&lt;/code&gt; is where you put the preamble, which include all the packages, configurations, and custom commands/definitions.&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;code&gt;main.tex&lt;/code&gt; is where you setup the overall structure. The first two lines are compilation directives that instruct the editor to compile with &lt;code&gt;pdflatex&lt;/code&gt; and &lt;code&gt;biber&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-tex&#34;&gt;% !TEX program = pdflatex
% !BIB program = biber
\input{setup}
\title{My Thesis}
\author{John Doe}
\begin{document}
 \include{chapters/chapter-1}
 \include{chapters/chapter-2}
 \printbibliography
\end{document}
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;code&gt;chapter-xxx.tex&lt;/code&gt; is the actual content of the chapter. All the chapters should begin with this directive:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-tex&#34;&gt;   % !TEX root = ../main.tex
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;so that you can compile from any place, otherwise you&amp;rsquo;ll need to go back to &lt;code&gt;main.tex&lt;/code&gt; to recompile the project.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;code&gt;figures/&lt;/code&gt; is where you put all your graphics, logos, figures&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;An actual project that follows this structure is given in &lt;a href=&#34;https://www.io.ac.nz/resources/report-template/&#34;&gt;this article&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&#34;so-how-does-that-fit-together&#34;&gt;So, how does that fit together?&lt;/h2&gt;

&lt;p&gt;On a typical day you will edit your document in your favourite TeX editor. You add more chapters to &lt;code&gt;chapters&lt;/code&gt; and graphics to &lt;code&gt;figures&lt;/code&gt;, compile and enjoy the flashy result. In the end of the day, you can commit all the change to Overleaf with a few simple commands:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;./cleanup.sh # To remove all temporary files
git add -A # Add all the changes to the local git
git commit -m &amp;quot;Finish chapter 1 and a bit of chapter 2&amp;quot; # Store the change locally
git push # Deliver the change to Overleaf
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The &lt;code&gt;git push&lt;/code&gt; command might fail if someone whom you share your project with modify the document during the day (simply clicking on the document on Overleaf.com somehow will also create an empty commit - this is very annoying and I hope they fix it soon), in which case you need to &lt;code&gt;git pull&lt;/code&gt; to get the changes on the remote server, then &lt;code&gt;git push&lt;/code&gt; again. After setting all this up, you will be using Overleaf as an online repository instead of say, Github. But it preserves the ability to share and collaborate with other people if necessary. This is now I wrote my papers: mostly by myself offline, commit it online so that my supervisor can view and fix my writing. When necessary (such as before a submission deadline), we both sit down with our own computer and write the document simultaneously.&lt;/p&gt;

&lt;h2 id=&#34;compare-overleaf-and-other-services&#34;&gt;Compare Overleaf and other services&lt;/h2&gt;

&lt;p&gt;Both &lt;a href=&#34;https://www.sharelatex.com&#34;&gt;ShareLaTeX&lt;/a&gt; and &lt;a href=&#34;https://papeeria.com&#34;&gt;Papeeria&lt;/a&gt; provide pretty much the same services as Overleaf, but the knock-out feature that draws me to Overleaf is that it provides Git integration for free accounts. With ShareLaTeX you have to pay for it and with Papeeria you can link to a public repository, which I really don&amp;rsquo;t like. For all fairness, Overleaf&amp;rsquo;s Git repos for free accounts are also public, but they&amp;rsquo;re not indexed and there is no way one can find it from a search engine.&lt;/p&gt;</description>
		</item>
		
		<item>
			<title>Vector logos of New Zealand&#39;s universities</title>
			<link>https://www.io.ac.nz/blog/nz-uni-logos-vector/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/blog/nz-uni-logos-vector/</guid>
			<description>&lt;p&gt;Most universities won&amp;rsquo;t make their logos available in scalable, vectorised version, for unspecified reasons (some universities do, so obviously security/forgery is not the concern). Uni such as Victoria or Cantebury supply their logo in rasterised form with different sizes, colours and the contexts where they should be used. Massey Uni for one, does not. Students and staff have to take a screenshot of the uni&amp;rsquo;s website and do manual cut paste. Regardless, rasterised logos make a document look much less professional &amp;amp; appealing because of pixelation and inconsistency with the overall design. Luckily, I was able to get my hands on the vector logos of all NZ universities. I share them here along with the technique that allows you to do the same to almost any large institution you want.
&lt;/p&gt;

&lt;h2 id=&#34;wait-what-the-hell-is-vector-scalable-graphics&#34;&gt;Wait, what the hell is vector/scalable graphics?&lt;/h2&gt;

&lt;p&gt;The pictures you take with your camera (even DSLR with &lt;a href=&#34;https://en.wikipedia.org/wiki/Photographic_film&#34;&gt;photographic film&lt;/a&gt;) are all &lt;em&gt;rasterised&lt;/em&gt;, which means they will look blurrier and blurrier when you zoom in, or even out. This is because when you zoom in, you practically ask for more information. Two pixels originally next to each other now 1,2 or 3 pixels apart and the computer needs to &lt;em&gt;interpolate&lt;/em&gt; or &amp;ldquo;make a guess&amp;rdquo; to fill in the gap. New pixels are added to the bigger sized picture by deducing their colour values from the neigbouring pixels, usually the new pixels will have values equivalent to an average or median value of the neighbourhood.&lt;/p&gt;

&lt;p&gt;Vector graphics on the other hand, are not defined by pixel values at all, but instead as functions of lines, shapes and colours in space. For example: &lt;code&gt;line from point A(0.1, 0.2) to point B(0.8,0.9) colour red&lt;/code&gt; means: when rendering, define point A at position x=10% the width and y=20% of the height, point B at position x=80% the width and y=90% the height, draw a line from A to B with colour red. This way, the rendering process is the same no matter what the actual size of the graphic is, so it will always look sharp.&lt;/p&gt;

&lt;p&gt;If you&amp;rsquo;re writing an important document (thesis, report, essay&amp;hellip;) and wants to make it look as shinny as possible, then you will make sure that the university&amp;rsquo;s logo displayed sharp and fine to the details. And this cannot be done without scalable graphics, which can be in quite a number of formats, such as SVG, PDF, AI (Adobe Illustrator), EPS (which can be read/saved by many software), WPF (Microsoft&amp;rsquo;s proprietary), etc,&amp;hellip; If you see these extension, then the file is most certainly vector. PNG, GIF, JPEG, BMP, &amp;hellip; are not. Don&amp;rsquo;t use them for your thesis.&lt;/p&gt;

&lt;p&gt;Below is a screenshot of my thesis&amp;rsquo;s front page (yes I actually research how to annihilate mankind using AI &lt;i class=&#34;fa fa-smile-o&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt; ). What happens here is that I changed the logo to unfill the shapes and remove colours, keeping only the strokes (borders) in plain black. It looks perfect when printed. The reason why I removed the fill is because as I explain later, I use the logo without any text to support it so it has to be quite big. The filled shapes emphasises the logo too much that the whole front page is out of balance. Keeping only the strokes makes it look much lighter without loosing its significance.&lt;/p&gt;

&lt;p&gt;&lt;object type=&#34;image/svg+xml&#34; data=&#34;/img/vector/mu-logo-in-thesis.svg&#34;&gt;
    &lt;img src=&#34;https://www.io.ac.nz/img-1000/banners/mu-logo-in-thesis.png&#34; width=&#34;100%&#34; style=&#34;max-width: 1000px;&#34;/&gt;
  &lt;/object&gt;&lt;/p&gt;

&lt;h2 id=&#34;where-were-the-treasures-hidden&#34;&gt;Where were the treasures hidden?&lt;/h2&gt;

&lt;p&gt;Just Google &amp;ldquo;University X svg logo&amp;rdquo; or go to their Wikipedia page, you might get the vector logo ready made for your convenience. But trust me it is hardly the case for most unis. The place where it is hidden is no other than the university&amp;rsquo;s website itself, right under your nose. Most universities produce tons and tons of brochures, maps and booklets and most are in PDF format. Of course the institution will make sure that their documents look appealing by using vector logos, so we just need to reverse engine the PDF files to get them. I&amp;rsquo;ll show you how it&amp;rsquo;s done in details below. The whole procedure takes about 1-5 minutes if you have the right tool.&lt;/p&gt;

&lt;h2 id=&#34;what-tool&#34;&gt;What tool?&lt;/h2&gt;

&lt;p&gt;You need a vector graphic software. I prefer &lt;em&gt;Adobe Illustrator&lt;/em&gt; since it has the most user friendly interface of all software out there, and most importantly, I can afford it. However, you should have no problem with Corel Draw and the likes. Even the freeware Inkscape can do it at the same level of ease. The process is basically the same for all of them:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to the university&amp;rsquo;s website and search for &amp;ldquo;pdf&amp;rdquo;, it should give you a ton of documents. A sure place to get one is at the &amp;ldquo;Campus map&amp;rdquo; section. Make sure the logo is vector, not bitmap, by zooming in as much as you can and see if it still appear sharp.&lt;/li&gt;
&lt;li&gt;Use Illustrator, Corel or Inkscape to open the page that has the logo.&lt;/li&gt;
&lt;li&gt;Sometimes the logo is right there to grab. The screenshot below was taken after I opened a booklet found on the website of the University of Cantebury in Inkscape. You can see that the logo is right there when I click on it. Sometimes it might be a bit tricky if the logo is on top of a complicated background, or if it has many layers. Some graphic skills are required to take the logo out neatly. In my experience, rather than trying to &lt;em&gt;get it out&lt;/em&gt;, the easier way is to remove other objects in the document until only the logo is left.
&lt;img src=&#34;https://www.io.ac.nz/img-1000/banners/uc-logo.png&#34; width=&#34;100%&#34; style=&#34;max-width: 500px;&#34;&gt;&lt;/li&gt;
&lt;li&gt;Now you can copy and paste the logo to another document and resize it to fit the boundary. You should save one original version of the logo, and then if you want to mess with it (change colours, remove fill, add strokes, &amp;hellip;), make a copy and go nuts!&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&#34;logos-of-nz-universities&#34;&gt;Logos of NZ Universities&lt;/h2&gt;

&lt;p&gt;If you&amp;rsquo;re from NZ, you&amp;rsquo;re in luck. I already extracted all the logos of 8 universities, plus Unitec (they&amp;rsquo;re pretty big &amp;amp; their logo looks cool). To demonstrate the &lt;em&gt;scalability&lt;/em&gt; of vector graphics, I&amp;rsquo;m using &lt;a href=&#34;https://github.com/ariutta/svg-pan-zoom&#34;&gt;&lt;code&gt;svg-pan-zoom&lt;/code&gt;&lt;/a&gt; to display a small controller in the corner of each image here. You can zoom in and out too see that the pictures look sharp at any scale.&lt;/p&gt;

&lt;p&gt;If the text in those logos appear deformed, don&amp;rsquo;t worry. Many browsers don&amp;rsquo;t support SVG very well at the moment. They will look good on paper.&lt;/p&gt;

&lt;h3 id=&#34;massey-university&#34;&gt;Massey University&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;My uni&amp;rsquo;s logo is the classic coat of arm design, but the wavy supporters and bright colours make it look kind of gay. Also, why is the ribbon empty when it is the perfect place for the university&amp;rsquo;s motto (&lt;em&gt;Floreat scientia&lt;/em&gt;)?.&lt;br /&gt;
A few alternative designs exist. The one displayed here is actually the worse in terms of balance between symbol and words. Don&amp;rsquo;t put this one on top of your thesis. Use the logo without text instead.&lt;br /&gt;
Download it &lt;a href=&#34;https://www.io.ac.nz/img/vector/mu-full.svg&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;object class=&#34;svg-pan-zoom&#34; type=&#34;image/svg+xml&#34; data=&#34;/img/vector/mu-full.svg&#34; style=&#34;width: 100%; height:200px;&#34;&gt;Your browser does not support SVG&lt;/object&gt;&lt;/p&gt;

&lt;h3 id=&#34;victoria-university-of-wellington&#34;&gt;Victoria University of Wellington&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;I would say this is the best logo out of the bunch. It has the traditional shield, but also two supporters each represents one of two components of the NZ culture (European and Maori). The whole design maintains a perfect balance between being elegant but not simplistic. Although it is the signature university of the Wellington region, the design really is representative for the whole country. With Wellington just happens to be the capital, I can&amp;rsquo;t think of any better design than this.&lt;br /&gt;
Download it &lt;a href=&#34;https://www.io.ac.nz/img/vector/vic-full.svg&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;object class=&#34;svg-pan-zoom&#34; type=&#34;image/svg+xml&#34; data=&#34;/img/vector/vic-full.svg&#34; style=&#34;width: 100%; height:150px;&#34;&gt;Your browser does not support SVG&lt;/object&gt;&lt;/p&gt;

&lt;h3 id=&#34;university-of-auckland&#34;&gt;University of Auckland&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Overall pretty neat &amp;amp; professional looking.&lt;br /&gt;
Download it &lt;a href=&#34;https://www.io.ac.nz/img/vector/au-full.svg&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;object class=&#34;svg-pan-zoom&#34; type=&#34;image/svg+xml&#34; data=&#34;/img/vector/au-full.svg&#34; style=&#34;width: 100%; height:200px;&#34;&gt;Your browser does not support SVG&lt;/object&gt;&lt;/p&gt;

&lt;h3 id=&#34;university-of-cantebury&#34;&gt;University of Cantebury&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;The design isn&amp;rsquo;t bad but I can&amp;rsquo;t tell what the heck those symbols on the shield mean.&lt;br /&gt;
Download it &lt;a href=&#34;https://www.io.ac.nz/img/vector/uc-full.svg&#34;&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;object class=&#34;svg-pan-zoom&#34; type=&#34;image/svg+xml&#34; data=&#34;/img/vector/uc-full.svg&#34; style=&#34;width: 100%; height:200px;&#34;&gt;Your browser does not support SVG&lt;/object&gt;&lt;/p&gt;

&lt;h3 id=&#34;auckland-university-of-technology&#34;&gt;Auckland University of Technology&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;I tried not to be mean, but this is &lt;em&gt;the&lt;/em&gt; most boring, monotonous, dull, lazy-ass looking university logo ever. And hey, it&amp;rsquo;s not even grammatically correct. There&amp;rsquo;s already a &lt;em&gt;university&lt;/em&gt; in &lt;em&gt;AUT&lt;/em&gt;, so &lt;em&gt;AUT University&lt;/em&gt; is redundant and doesn&amp;rsquo;t make sense.&lt;br /&gt;
Download it &lt;a href=&#34;https://www.io.ac.nz/img/vector/aut-full.svg&#34;&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;object class=&#34;svg-pan-zoom&#34; type=&#34;image/svg+xml&#34; data=&#34;/img/vector/aut-full.svg&#34; style=&#34;width: 100%; height:200px;&#34;&gt;Your browser does not support SVG&lt;/object&gt;&lt;/p&gt;

&lt;h3 id=&#34;university-of-otago&#34;&gt;University of Otago&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;The flag of Scotland and the Crux, pretty identifiable for the Otago region. The text looks like a classical scientific paper header.&lt;br /&gt;
Download it &lt;a href=&#34;https://www.io.ac.nz/img/vector/uo-full.svg&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;object class=&#34;svg-pan-zoom&#34; type=&#34;image/svg+xml&#34; data=&#34;/img/vector/uo-full.svg&#34; style=&#34;width: 100%; height:200px;&#34;&gt;Your browser does not support SVG&lt;/object&gt;&lt;/p&gt;

&lt;h3 id=&#34;university-of-waikato&#34;&gt;University of Waikato&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;The only motto that uses Maori instead of Latin, French or English. Again, pretty identifiable for the King&amp;rsquo;s country.&lt;br /&gt;
Download it &lt;a href=&#34;https://www.io.ac.nz/img/vector/uw-full.svg&#34;&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;object class=&#34;svg-pan-zoom&#34; type=&#34;image/svg+xml&#34; data=&#34;/img/vector/uw-full.svg&#34; style=&#34;width: 100%; height:200px;&#34;&gt;Your browser does not support SVG&lt;/object&gt;&lt;/p&gt;

&lt;h3 id=&#34;lincoln-university&#34;&gt;Lincoln University&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Nice design overall - But one can&amp;rsquo;t really tell what&amp;rsquo;s the story behind those symbols.&lt;br /&gt;
Download it &lt;a href=&#34;https://www.io.ac.nz/img/vector/lu-full.svg&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;object class=&#34;svg-pan-zoom&#34; type=&#34;image/svg+xml&#34; data=&#34;/img/vector/lu-full.svg&#34; style=&#34;width: 100%; height:200px;&#34;&gt;Your browser does not support SVG&lt;/object&gt;&lt;/p&gt;

&lt;h3 id=&#34;unitec&#34;&gt;Unitec&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;This logo obviously wasn&amp;rsquo;t designed long time ago. Looks modern, young and dynamic - but too simplistic, which is typical for young, shallow minded millenia. It comes in two different forms, the one displayed here has text on the right hand side of the logo. There&amp;rsquo;s another one with text below the logo, which could be downloaded &lt;a href=&#34;https://www.io.ac.nz/img/vector/unitec-vert.svg&#34;&gt;here&lt;/a&gt;.&lt;br /&gt;
Download the one below &lt;a href=&#34;https://www.io.ac.nz/img/vector/unitec-horz.svg&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;object class=&#34;svg-pan-zoom&#34; type=&#34;image/svg+xml&#34; data=&#34;/img/vector/unitec-horz.svg&#34; style=&#34;width: 100%; height:200px;&#34;&gt;Your browser does not support SVG&lt;/object&gt;&lt;/p&gt;</description>
		</item>
		
		<item>
			<title>FF Martial Art?</title>
			<link>https://www.io.ac.nz/sns/ffx-martial/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/sns/ffx-martial/</guid>
			<description>&lt;p&gt;What would it be if the epic world of &lt;strong&gt;Final Fantasy&lt;/strong&gt; and the martial world of &lt;strong&gt;金庸&lt;/strong&gt; merged into one?&lt;/p&gt;
</description>
		</item>
		
		<item>
			<title>Python</title>
			<link>https://www.io.ac.nz/tags/python/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/python/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Mendeley</title>
			<link>https://www.io.ac.nz/tags/mendeley/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/mendeley/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Integration</title>
			<link>https://www.io.ac.nz/tags/integration/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/integration/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Automatic Update</title>
			<link>https://www.io.ac.nz/tags/automatic-update/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/automatic-update/</guid>
			<description></description>
		</item>
		
		<item>
			<title>From Mendeley to LaTeX: a seamless integration</title>
			<link>https://www.io.ac.nz/blog/mendeley-to-tex/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/blog/mendeley-to-tex/</guid>
			<description>&lt;p&gt;Mendeley is the only reference manager, as I know, capable of updating a &lt;code&gt;bib&lt;/code&gt; file on the fly. That is: as soon as you import a new reference or make a change to an existing reference, it will export the updated version of the library to the &lt;code&gt;library.bib&lt;/code&gt; file in a predefined folder. This is especially nice if you&amp;rsquo;re writing a paper and constantly searching for new literature. If you&amp;rsquo;re only bothering with writing one paper, then this might be enough. When you write the second paper, simply instruct Mendeley to write to a different file. However, if you&amp;rsquo;re writing two or more scientific documents using the same set of references, then you will need something smarter. What&amp;rsquo;s more problematic is that Mendeley dumps everything inside the references, including location of the PDF and any notes you make. This might cause &lt;span class=&#34;latex&#34;&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt; to fail to compile.
&lt;/p&gt;

&lt;h2 id=&#34;the-seamless-framework-explained&#34;&gt;The seamless framework explained&lt;/h2&gt;

&lt;p&gt;Let&amp;rsquo;s say Mendeley is set to update &lt;code&gt;/path/to/tex-projects/library.bib&lt;/code&gt;, where &lt;code&gt;/path/to/tex&lt;/code&gt; is the location of the parent folder of all your &lt;span class=&#34;latex&#34;&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt; documents, and &lt;code&gt;library.bib&lt;/code&gt; is the default name for the &lt;code&gt;bib&lt;/code&gt; file (you can&amp;rsquo;t change it). Let&amp;rsquo;s also say you are working on 3 projects &lt;code&gt;paper&lt;/code&gt;, &lt;code&gt;report&lt;/code&gt; and &lt;code&gt;book&lt;/code&gt; which uses the same reference set. Of course you can just use the absolute path to &lt;code&gt;library.bib&lt;/code&gt; in all these projects - but this makes your project non-portable. So you will need to use separate &lt;code&gt;bib&lt;/code&gt; files (with the same content) in all projects. What we need is a tool that monitors changes to &lt;code&gt;library.bib&lt;/code&gt;, which on change detected, will do the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Read &lt;code&gt;library.bib&lt;/code&gt; and clean up all the unnecessary fields.&lt;/li&gt;
&lt;li&gt;Copy &lt;code&gt;library.bib&lt;/code&gt; to &lt;code&gt;/path/to/tex-projects/paper/&lt;/code&gt;, &lt;code&gt;/path/to/tex-projects/report/&lt;/code&gt; and &lt;code&gt;/path/to/tex-projects/book/&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So, let&amp;rsquo;s do it.&lt;/p&gt;

&lt;h2 id=&#34;configure-mendeley&#34;&gt;Configure Mendeley.&lt;/h2&gt;

&lt;p&gt;This step is simple: go to Mendeley&amp;rsquo;s Preferences (keyboard shortcut &lt;kbd&gt;⌘&lt;/kbd&gt;+&lt;kbd&gt;,&lt;/kbd&gt;), go to tab BibTeX and select the following options:&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://www.io.ac.nz/img-1000/banners/mendeley-to-tex-2.png&#34; width=&#34;100%&#34; style=&#34;max-width: 500px;&#34;&gt;&lt;/p&gt;

&lt;h2 id=&#34;clean-up-library-bib&#34;&gt;Clean up library.bib&lt;/h2&gt;

&lt;p&gt;I have written a small Python code that does this automatically. You can download it &lt;a href=&#34;https://www.io.ac.nz/files/cleanbib.py&#34;&gt;&lt;i class=&#34;fa fa-download&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt; here&lt;/a&gt;. Let&amp;rsquo;s say you save it to &lt;code&gt;/path/to/tex-projects/&lt;/code&gt;. I currently hardcode it to remove &lt;code&gt;annote&lt;/code&gt;, &lt;code&gt;annotate&lt;/code&gt;, &lt;code&gt;abstract&lt;/code&gt;, &lt;code&gt;mendeley-groups&lt;/code&gt;, &lt;code&gt;keywords&lt;/code&gt;, &lt;code&gt;file&lt;/code&gt;. These fields are quite problematic because they might be long and contain special character. I also make it comment out &lt;code&gt;issn&lt;/code&gt;, &lt;code&gt;isbn&lt;/code&gt;, &lt;code&gt;doi&lt;/code&gt;, just in case I want to have a quick look. All the other fields are kept intact. The utility takes two arguments, as following:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;python&#34;&gt;
cleanbib.py --file /path/to/tex-projects/library.bib --out /path/to/tex-projects/cleaned.bib
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This tells python to read the original references in &lt;code&gt;library.bib&lt;/code&gt;, clean it up and save the result in &lt;code&gt;cleaned.bib&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&#34;copy-to-multiple-places&#34;&gt;Copy to multiple places&lt;/h2&gt;

&lt;p&gt;To make it simple, I wrote a small script to do this, after calling &lt;code&gt;cleanbib&lt;/code&gt;, it also omits a notification on screen (only works for Mac). The script is pretty simple:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;bash&#34;&gt;
#!/bin/bash

# Omit a message
osascript -e &#39;display notification &#34;library.bib cleaned up&#34; with title &#34;Mendeley change detected&#34;&#39;

# Call the python script
python /path/to/tex-projects/cleanbib.py -f /path/to/tex-projects/library.bib -o /path/to/tex-projects/cleaned.bib

# Copy the result to all projects:
cp /path/to/tex-projects/cleaned.bib /path/to/tex-projects/paper/cleaned.bib
cp /path/to/tex-projects/cleaned.bib /path/to/tex-projects/report/cleaned.bib
cp /path/to/tex-projects/cleaned.bib /path/to/tex-projects/book/cleaned.bib
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Let&amp;rsquo;s say you save this bash script in &lt;code&gt;/path/to/tex-projects/cleanbib.sh&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&#34;putting-it-all-together&#34;&gt;Putting it all together&lt;/h2&gt;

&lt;p&gt;The last thing we need is to listen to changes in &lt;code&gt;library.bib&lt;/code&gt; and run the bash code on change detected. &lt;a href=&#34;https://github.com/emcrisostomo/fswatch&#34;&gt;&lt;i class=&#34;fa fa-github&#34;&gt;&lt;code&gt;fswatch&lt;/code&gt;&lt;/i&gt;&lt;/a&gt; is a nice cross-platform tool that provides the functionality we want. We will hook &lt;code&gt;fswatch&lt;/code&gt; with &lt;code&gt;cleanbib.sh&lt;/code&gt; with the following command:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;bash&#34;&gt;
fswatch -o /path/to/tex-projects/library.bib | xargs -n1 /path/to/tex-projects/cleanbib.sh &amp;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That&amp;rsquo;s it. Now &lt;code&gt;fswatch&lt;/code&gt; will work behind the scene, detecting any changes that Mendeley makes to &lt;code&gt;library.bib&lt;/code&gt;, then call &lt;code&gt;cleanbib.sh&lt;/code&gt; to clean up the &lt;code&gt;bib&lt;/code&gt; file and deploy it to all the projects that you&amp;rsquo;re working on. With this, as soon as you make any changes in Mendeley, you can immediately go back to your &lt;span class=&#34;latex&#34;&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt; editor (such as &lt;a href=&#34;http://www.texstudio.org/&#34;&gt;TexStudio&lt;/a&gt; - my recommendation) and cite the new or changed reference.&lt;/p&gt;

&lt;h2 id=&#34;future-work&#34;&gt;Future work&lt;/h2&gt;

&lt;p&gt;Obviously, these are quite some steps to do just a simple thing. In theory, a single &lt;code&gt;Python&lt;/code&gt; file should be able to do all that - listen to file change, displaying notification, clean up the &lt;code&gt;bib&lt;/code&gt; file and deploy to several places. In addition, it should be possible for user to provide a set of key they want to keep as argument, instead of having them hardcoded. This is dedicated as future work.&lt;/p&gt;</description>
		</item>
		
		<item>
			<title>Publication</title>
			<link>https://www.io.ac.nz/tags/publication/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/publication/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Matlab</title>
			<link>https://www.io.ac.nz/tags/matlab/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/matlab/</guid>
			<description></description>
		</item>
		
		<item>
			<title>High quality graphics for your Latex document: The Matlab route</title>
			<link>https://www.io.ac.nz/blog/matlab-to-latex/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/blog/matlab-to-latex/</guid>
			<description>&lt;p&gt;You use &lt;span class=&#34;latex&#34;&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt; instead of a WYSIWYG word processing program because they can&amp;rsquo;t cope with the high quality required for publication. But your nice professional looking documents can be ruined because you insert the wrong type of figures. Bitmap figures are easily pixelated because the actual size is not always known beforehand. Exporting figures as PDF to be included sounds like a good idea but you&amp;rsquo;ll quickly notice the problem with the text (e.g. axis label and ticks,&amp;hellip;) which needs to be rendered by Latex to get the correct font and size.
Hard-core Tex users can find the answer to this problem in Tikz or Pgfplot. Of course figures generated at this level is as good as it gets. I use Tikz picture quite frequently for text-heavy diagrams and simple plots. However, if the figure is moderately complicated or if it&amp;rsquo;s bound to precise data, then generating figures this way quickly becomes unmanageable.
&lt;/p&gt;

&lt;h2 id=&#34;matlab-comes-to-the-rescue&#34;&gt;Matlab comes to the rescue&lt;/h2&gt;

&lt;p&gt;An alternative solution is to draw the plots in Matlab/Python (with matplotlib) and export it in a format that can be included in Latex with the text part of the figure stored separately. Matlab does not support this natively but there are lots of community scripts capable of doing so. Below are a few that I have tried (to my knowledge, I have tried all of them):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;https://au.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz-matlab2tikz&#34;&gt;Matlab2Tikz&lt;/a&gt;: This script will convert Matlab plots to Tikz/PGFPlot figures which can be &lt;code&gt;\input{}&lt;/code&gt; directly into your Tex document. Basically it writes the Tikz commands for you. The catch is that it can&amp;rsquo;t deal with plots that have pixelated images, and not all types of plots can be converted. In my experience, this tools only works with simple plots. Try it with anything more than just a few curves and the generated file will likely to cause all sort of weird errors.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;a href=&#34;http://au.mathworks.com/matlabcentral/fileexchange/12962-matfig2pgf&#34;&gt;Matfig2PGF&lt;/a&gt;: Same idea as &lt;strong&gt;Matlab2Tikz&lt;/strong&gt; but it generates PGF code instead. PGF is a lower level language than Tikz, so the generated file is usually quite big. It can blow out of 5000 lines easily even for mildly complicated figures. This might render your Tex editor out of memory. It also can&amp;rsquo;t deal with pictures.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;a href=&#34;http://au.mathworks.com/matlabcentral/fileexchange/21286-matlabfrag&#34;&gt;Matlabfrag&lt;/a&gt;: This toll will generate two files, one EPS containing non-text part and one TEX file containing the text. Then you can use PsFrag to render the text and overlay it on top of the EPS file. This is one of the first complete solution I found, since the part that generates EPS file is actually a Matlab routine, so there should be no error to expect. However, PsFrag is notoriously difficult to handle, because it requires &lt;code&gt;--shell-escape&lt;/code&gt; to be enabled to call a external routine for generating figures. The smallest changes to your environment will result in an error. I once wasted a whole day bashing my head against the monitor because the same document that had rendered a day before now resulted in an error. I later found out that the shell it escape to is &lt;code&gt;sh&lt;/code&gt; (not even &lt;code&gt;Bash&lt;/code&gt;), and for some reason the &lt;code&gt;PATH&lt;/code&gt; variable was not loaded, preventing it from calling its external routines. Also, PsFrag requires &lt;span class=&#34;latex&#34;&gt;P&lt;cap&gt;d&lt;/cap&gt;&lt;cap&gt;f&lt;/cap&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt; to function, so &lt;span class=&#34;latex&#34;&gt;X&lt;sub&gt;Ǝ&lt;/sub&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt; will not work. Your only option if you want to use True Type Face fonts is &lt;span class=&#34;latex&#34;&gt;L&lt;cap&gt;u&lt;/cap&gt;&lt;cap&gt;a&lt;/cap&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt;, in theory - because it didn&amp;rsquo;t work for me. So I eventually ditched this option.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;a href=&#34;http://au.mathworks.com/matlabcentral/fileexchange/4638-laprint&#34;&gt;Laprint&lt;/a&gt; This is very similar to &lt;strong&gt;Matlabfrag&lt;/strong&gt; except that it requires more parameters to be passed into. They have the exact same pros and cons.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;a href=&#34;https://au.mathworks.com/matlabcentral/fileexchange/52700-plot2latex&#34;&gt;Plot2LaTeX&lt;/a&gt; So far this is the best option and I&amp;rsquo;ve been using this tool for a long time. It&amp;rsquo;s also based on the idea of exporting text and non-text separately, then typeset the text on top of the figure. But that part is done using Inkscape. The tool simply export a SVG file using Matlab&amp;rsquo;s built-in routine, then call inkscape to convert the SVG file to a PDF, which is purely graphic, and a &lt;code&gt;pdf_tex&lt;/code&gt; file containing instructions to overlay that PDF with text. What&amp;rsquo;s nice about it is that the SVG file is modifiable by inkscape. Sometimes the graph needs very minor modifications which might be difficult with Matlab (for example: convert the axes into arrows), but effortlessly doable in Inkscape. Detailed workflow for using Plot2LaTeX is presented below.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&#34;matlab-to-span-class-latex-l-sup-a-sup-t-sub-e-sub-x-span-via-plot2latex&#34;&gt;Matlab to &lt;span class=&#34;latex&#34;&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt; via Plot2LaTeX&lt;/h2&gt;

&lt;p&gt;The workflow is simple, you just need to install Plot2LaTeX and Inkscape once, then:&lt;/p&gt;

&lt;blockquote&gt;
&lt;h4 id=&#34;summary-of-steps&#34;&gt;Summary of steps:&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Plot in Matlab&lt;/li&gt;
&lt;li&gt;Export with &lt;code&gt;Plot2Latex()&lt;/code&gt; command&lt;/li&gt;
&lt;li&gt;If necessary: modify in Inkscape and save as &lt;code&gt;.pdf_tex&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Import into &lt;span class=&#34;latex&#34;&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let&amp;rsquo;s break it down:&lt;/p&gt;

&lt;h3 id=&#34;0-installation&#34;&gt;0. Installation&lt;/h3&gt;

&lt;p&gt;Google will let you know where to download the latest version of Plot2Latex and Inkscape. On Mac, Inkscape requires &lt;code&gt;XQuartz&lt;/code&gt; because it&amp;rsquo;s built on XWindow. There&amp;rsquo;s also a separate branch built on osxmenu which can run natively on Mac. There hasn&amp;rsquo;t been any official release and the development seems to have stopped since May 2015 (last version was based on r12922). However it&amp;rsquo;s stable enough for me (using OSX El Capitan) to recommend it. An executable can be downloaded from &lt;a href=&#34;https://inkscape.org/en/~su_v/galleries/osxmenu-r12922/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Plot2Latex will call Inkscape so it is necessary to provide the tool with the correct path to inkscape. Search for the line beginning with &lt;code&gt;DIR_INKSC =&lt;/code&gt; and modify it, e.g.:&lt;/p&gt;

&lt;pre&gt;
  &lt;code class=&#34;matlab&#34;&gt;
DIR_INKSC = &#39;/Applications/Inkscape.app/Contents/MacOS/inkscape&#39;;
  &lt;/code&gt;
&lt;/pre&gt;

&lt;h3 id=&#34;1-plot-in-matlab&#34;&gt;1. Plot in Matlab&lt;/h3&gt;

&lt;p&gt;You can seriously go nuts! Bring it on any sort of plot you can think of. The routine eventually call Matlab&amp;rsquo;s &lt;code&gt;saveas()&lt;/code&gt; so as long as the MathWork guys don&amp;rsquo;t mess it up, any plot should be savable. It&amp;rsquo;s also possible to use Latex as the renderer for your strings.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://www.io.ac.nz/img-1000/banners/latex-plot-2.png&#34; width=&#34;100%&#34;&gt;&lt;/p&gt;

&lt;h3 id=&#34;2-export-with-plot2latex&#34;&gt;2. Export with Plot2Latex&lt;/h3&gt;

&lt;p&gt;Once you&amp;rsquo;re happy with the plot, you can export it with the following command:&lt;/p&gt;

&lt;pre&gt;
  &lt;code class=&#34;matlab&#34;&gt;
Plot2LaTeX(gcf, &#39;/path/to/tex/figures/my_figure&#39;)
  &lt;/code&gt;
&lt;/pre&gt;

&lt;p&gt;This will generates &lt;code&gt;my_figure.svg&lt;/code&gt;, &lt;code&gt;my_figure.pdf&lt;/code&gt; and &lt;code&gt;my_figure.pdf_tex&lt;/code&gt; in folder &lt;code&gt;/path/to/tex/figures&lt;/code&gt;. It is possible to use the &lt;code&gt;.pdf_tex&lt;/code&gt; file right at this stage, but you might want to modify it a bit, at least to get rid of the empty margin surrounding the figures.&lt;/p&gt;

&lt;h3 id=&#34;3-modify-in-inkscape&#34;&gt;3. Modify in Inkscape&lt;/h3&gt;

&lt;p&gt;Open the SVG file with Inkscape. You&amp;rsquo;ll need to get used to a few Inkscape commands but in general it&amp;rsquo;s not that different from other image processing program. You&amp;rsquo;ll need to get rid of several blank layers that span the whole page before you can modify anything. You can get Inkscape to automatically shrink the page to fit the actual figure, removing all white margin. And you can do that by clicking &lt;code&gt;File&lt;/code&gt; -&amp;gt; &lt;code&gt;Document Properties&lt;/code&gt; (Keyboard shortcut:  &lt;kbd class=&#34;is-icon&#34;&gt;⇧⌘D&lt;/kbd&gt;), expand &lt;code&gt;Resize page to content...&lt;/code&gt;, then click on &lt;code&gt;Resize page to drawing or selection&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://www.io.ac.nz/img-1000/banners/latex-plot-3.png&#34; width=&#34;100%&#34; style=&#34;max-width: 500px;&#34;&gt;&lt;/p&gt;

&lt;p&gt;Now you can save the changes to &lt;code&gt;.pdf_tex&lt;/code&gt; by selecting &lt;code&gt;File&lt;/code&gt; -&amp;gt; &lt;code&gt;Save as&lt;/code&gt; (Keyboard shortcut:  &lt;kbd class=&#34;is-icon&#34;&gt;⇧⌘S&lt;/kbd&gt;), choose &lt;code&gt;PDF&lt;/code&gt;, select &lt;code&gt;Omit text in PDF and create LaTeX file&lt;/code&gt;. Now you&amp;rsquo;re ready to import the figure into &lt;span class=&#34;latex&#34;&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://www.io.ac.nz/img-1000/banners/latex-plot-4.png&#34; width=&#34;100%&#34; style=&#34;max-width: 500px;&#34;&gt;&lt;/p&gt;

&lt;h3 id=&#34;4-import-into-span-class-latex-l-sup-a-sup-t-sub-e-sub-x-span&#34;&gt;4. Import into &lt;span class=&#34;latex&#34;&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt;&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;.pdf_tex&lt;/code&gt; file is nothing but a piece of TEX code, so you would import it into &lt;span class=&#34;latex&#34;&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt; using &lt;code&gt;\input{}&lt;/code&gt; as following&lt;/p&gt;

&lt;pre&gt;
  &lt;code class=&#34;tex&#34;&gt;
\usepackage{graphicx}
\graphicspath{{./figures/}}

\begin{document}
...
\begin{figure}
  \footnotesize
  \def\svgwidth{.7\linewidth}
  \input{figures/my_figure.pdf_tex}
\end{figure}
...
\end{document}
  &lt;/code&gt;
&lt;/pre&gt;

&lt;blockquote&gt;
&lt;h5 id=&#34;explain&#34;&gt;Explain:&lt;/h5&gt;

&lt;p&gt;&lt;code&gt;\graphicspath{{./figures/}}&lt;/code&gt; You will need this because the &lt;code&gt;.pdf_tex&lt;/code&gt; file will import the PDF file without fully qualified path. This is to tell it to find any PDF files in &lt;code&gt;figures/&lt;/code&gt; folder.&lt;br /&gt;
&lt;code&gt;\footnotesize&lt;/code&gt; Set the size of text elements to footnotesize.&lt;br /&gt;
&lt;code&gt;\def\svgwidth{.7\linewidth}&lt;/code&gt; Set the overall width of the figure to be 0.7 the line&amp;rsquo;s width.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&#34;result&#34;&gt;Result:&lt;/h3&gt;

&lt;p&gt;&lt;img src=&#34;https://www.io.ac.nz/img-1000/banners/latex-plot-1.png&#34; width=&#34;100%&#34; style=&#34;max-width: 500px;&#34;&gt;&lt;/p&gt;

&lt;p&gt;You can notice that the figure looks infinitely sharp and the text is typeset using the right font and size.&lt;/p&gt;

&lt;h2 id=&#34;some-existing-problems&#34;&gt;Some existing problems&lt;/h2&gt;

&lt;p&gt;There are two known problems, both belong to Inkscape. It might have well been fixed in earlier versions of Inkscape but since I prefer the osxmenu version, I&amp;rsquo;m stuck with these bugs. I&amp;rsquo;m listing them out here together with the solutions, in case you bump into one:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Messy PDF pages
Ideally all graphic elements should be on one page, but for some reason, sometimes Inkscape decides to draw them separately on different pages, then instruct &lt;span class=&#34;latex&#34;&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt; to layout them on top of each other, such as:&lt;/p&gt;

&lt;pre&gt;
  &lt;code class=&#34;tex&#34;&gt;
\put(0,0){\includegraphics[width=\unitlength,page=1]{myfig.pdf}}
...
\put(0,0){\includegraphics[width=\unitlength,page=2]{myfig.pdf}}
  &lt;/code&gt;
&lt;/pre&gt;

&lt;p&gt;But the real problem comes from the generated &lt;code&gt;.pdf_tex&lt;/code&gt;, most of the time the pages are off by 1, e.g. if the element is on page 3, the instruction will be to draw page 4. This will lead to error when the last page is drawn because the index is 1 more than the maximum. You will need to manually modify the page numbers to fix the problem.&lt;/p&gt;

&lt;p&gt;Most of the time, there will be a single-page PDF, but the &lt;code&gt;.pdf_tex&lt;/code&gt; will import it twice, with the second time referring to page 2. In this case, simply remove the duplicate.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Percentage sign
&lt;code&gt;%&lt;/code&gt; is the beginning of a comment in &lt;span class=&#34;latex&#34;&gt;L&lt;sup&gt;a&lt;/sup&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt;, so if your plot has strings with a comment sign, it will be used without escaping in the &lt;code&gt;.pdf_tex&lt;/code&gt; file. This will obviously lead to invalid syntax. Again, manual modification is required to fix it. You can also modify &lt;code&gt;Plot2LaTeX.m&lt;/code&gt; to automatically escaping &lt;code&gt;%&lt;/code&gt; before rendering the SVG file as following:&lt;/p&gt;

&lt;pre&gt;
  &lt;code class=&#34;matlab&#34;&gt;
function strXML = EscapeXML(str)
  % ESCAPEXML repaces special characters(&lt;,&gt;,&#39;,&#34;,&amp;) -&gt; (&amp;lt;,&amp;gt;,&amp;apos;,&amp;quot;,&amp;amp;)
  escChar = {&#39;&amp;&#39;,&#39;&lt;&#39;,&#39;&gt;&#39;,&#39;&#39;&#39;&#39;,&#39;&#34;&#39;,&#39;%&#39;};
  repChar = {&#39;&amp;amp;&#39;,&#39;&amp;lt;&#39;,&#39;&amp;gt;&#39;,&#39;&amp;apos;&#39;,&#39;&amp;quot;&#39;,&#39;\\%&#39;};
  strXML = regexprep(str,escChar,repChar);
end
  &lt;/code&gt;
&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&#34;why-use-plot2latex-just-to-get-the-svg-file&#34;&gt;Why use Plot2LaTeX just to get the SVG file&lt;/h2&gt;

&lt;p&gt;You might have realised that it doesn&amp;rsquo;t seem necessary to use Plot2LaTeX, if we only care about the SVG, and the &lt;code&gt;.pdf_tex&lt;/code&gt; part is generated manually with Inkscape. Can we export the figure directly to SVG using &lt;code&gt;saveas()&lt;/code&gt;? Certainly, in some cases it might work. Problems arise when the plot has axes. All the ticks on an axis will be rendered as one long string, with single tick no longer binds to a data point. So when the figure is rendered in LaTex, the axis ticks will squash together. We need Plot2LaTeX to first separate the tick labels and bind them to the exact data point on the axes. This way no matter what font and size is used, the axis will always be rendered correctly.&lt;/p&gt;</description>
		</item>
		
		<item>
			<title>Publications</title>
			<link>https://www.io.ac.nz/publications/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/publications/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Segmentation of Harmonic Syllables in Noisy Recordings of Bird Vocalisations</title>
			<link>https://www.io.ac.nz/publications/ivcnz2016/</link>
			<pubDate>Thu, 24 Nov 2016 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/publications/ivcnz2016/</guid>
			<description>&lt;p&gt;The  study  of  birdsong  has  implications  in  a  num-ber  of  biological  and  conservational  applications.  However,  theanalysis of bird vocalisations in the natural habitat is still largelya  laborious  task.  One  of  the  bottle  necks  is  the  segmentation  ofbird  vocalisations  into  individual  syllables.  Simple  segmentationin  time  domain  proves  difficult  because  of  overlapping  signalsover  different  frequency  bands.  The  common  approach  is  toconvert  audio  recordings  into  a  spectrogram  and  apply  imageprocessing  techniques  to  pick  out  the  signal  of  interest.  Weexamine several methods that have been proposed recently to dojust this and find that they are inadequate to deal with harmonicvocalisations.  We  propose  a  method  that  segments  syllables  bylooking  for  the  fundamental  frequency  first  then  works  its  wayup in the frequency axis to find other harmonics if they exist. Weevaluate  our  method  against  another  popular  method  and  findthat the proposed method can segment correctly more than 70%the number of syllables, more than twice that of the method weare  comparing  to&lt;/p&gt;

&lt;div class=&#34;pdf-embedded&#34; src=&#34;https://www.io.ac.nz/files/ivcnz2016.pdf&#34; hwratio=1.4&gt;&lt;/div&gt;
</description>
		</item>
		
		<item>
			<title>Lorem</title>
			<link>https://www.io.ac.nz/categories/lorem/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/categories/lorem/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Ipsum</title>
			<link>https://www.io.ac.nz/tags/ipsum/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/ipsum/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Migrate from Jekyll</title>
			<link>https://www.io.ac.nz/blog/migrate-from-jekyll/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/blog/migrate-from-jekyll/</guid>
			<description>

&lt;h2 id=&#34;move-static-content-to-static&#34;&gt;Move static content to &lt;code&gt;static&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;Jekyll has a rule that any directory not starting with &lt;code&gt;_&lt;/code&gt; will be copied as-is to the &lt;code&gt;_site&lt;/code&gt; output. Hugo keeps all static content under &lt;code&gt;static&lt;/code&gt;. You should therefore move it all there.
With Jekyll, something that looked like&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
    ▾ images/
        logo.png
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;should become&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;▾ &amp;lt;root&amp;gt;/
    ▾ static/
        ▾ images/
            logo.png
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Additionally, you&amp;rsquo;ll want any files that should reside at the root (such as &lt;code&gt;CNAME&lt;/code&gt;) to be moved to &lt;code&gt;static&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&#34;create-your-hugo-configuration-file&#34;&gt;Create your Hugo configuration file&lt;/h2&gt;

&lt;p&gt;Hugo can read your configuration as JSON, YAML or TOML. Hugo supports parameters custom configuration too. Refer to the &lt;a href=&#34;https://www.io.ac.nz/overview/configuration/&#34;&gt;Hugo configuration documentation&lt;/a&gt; for details.&lt;/p&gt;

&lt;h2 id=&#34;set-your-configuration-publish-folder-to-site&#34;&gt;Set your configuration publish folder to &lt;code&gt;_site&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;The default is for Jekyll to publish to &lt;code&gt;_site&lt;/code&gt; and for Hugo to publish to &lt;code&gt;public&lt;/code&gt;. If, like me, you have &lt;a href=&#34;http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html&#34;&gt;&lt;code&gt;_site&lt;/code&gt; mapped to a git submodule on the &lt;code&gt;gh-pages&lt;/code&gt; branch&lt;/a&gt;, you&amp;rsquo;ll want to do one of two alternatives:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Change your submodule to point to map &lt;code&gt;gh-pages&lt;/code&gt; to public instead of &lt;code&gt;_site&lt;/code&gt; (recommended).&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git submodule deinit _site
git rm _site
git submodule add -b gh-pages git@github.com:your-username/your-repo.git public
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Or, change the Hugo configuration to use &lt;code&gt;_site&lt;/code&gt; instead of &lt;code&gt;public&lt;/code&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{
    ..
    &amp;quot;publishdir&amp;quot;: &amp;quot;_site&amp;quot;,
    ..
}
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&#34;convert-jekyll-templates-to-hugo-templates&#34;&gt;Convert Jekyll templates to Hugo templates&lt;/h2&gt;

&lt;p&gt;That&amp;rsquo;s the bulk of the work right here. The documentation is your friend. You should refer to &lt;a href=&#34;http://jekyllrb.com/docs/templates/&#34;&gt;Jekyll&amp;rsquo;s template documentation&lt;/a&gt; if you need to refresh your memory on how you built your blog and &lt;a href=&#34;https://www.io.ac.nz/layout/templates/&#34;&gt;Hugo&amp;rsquo;s template&lt;/a&gt; to learn Hugo&amp;rsquo;s way.&lt;/p&gt;

&lt;p&gt;As a single reference data point, converting my templates for &lt;a href=&#34;http://heyitsalex.net/&#34;&gt;heyitsalex.net&lt;/a&gt; took me no more than a few hours.&lt;/p&gt;

&lt;h2 id=&#34;convert-jekyll-plugins-to-hugo-shortcodes&#34;&gt;Convert Jekyll plugins to Hugo shortcodes&lt;/h2&gt;

&lt;p&gt;Jekyll has &lt;a href=&#34;http://jekyllrb.com/docs/plugins/&#34;&gt;plugins&lt;/a&gt;; Hugo has &lt;a href=&#34;https://www.io.ac.nz/doc/shortcodes/&#34;&gt;shortcodes&lt;/a&gt;. It&amp;rsquo;s fairly trivial to do a port.&lt;/p&gt;

&lt;h3 id=&#34;implementation&#34;&gt;Implementation&lt;/h3&gt;

&lt;p&gt;As an example, I was using a custom &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc06908ec/_plugins/image_tag.rb&#34;&gt;&lt;code&gt;image_tag&lt;/code&gt;&lt;/a&gt; plugin to generate figures with caption when running Jekyll. As I read about shortcodes, I found Hugo had a nice built-in shortcode that does exactly the same thing.&lt;/p&gt;

&lt;p&gt;Jekyll&amp;rsquo;s plugin:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;module Jekyll
  class ImageTag &amp;lt; Liquid::Tag
    @url = nil
    @caption = nil
    @class = nil
    @link = nil
    // Patterns
    IMAGE_URL_WITH_CLASS_AND_CAPTION =
    IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;(\s+)-&amp;gt;((https?:\/\/|\/)(\S+))(\s*)/i
    IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)&amp;quot;(.*?)&amp;quot;/i
    IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
    IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
    def initialize(tag_name, markup, tokens)
      super
      if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
        @class   = $1
        @url     = $3
        @caption = $7
        @link = $9
      elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
        @class   = $1
        @url     = $3
        @caption = $7
      elsif markup =~ IMAGE_URL_WITH_CAPTION
        @url     = $1
        @caption = $5
      elsif markup =~ IMAGE_URL_WITH_CLASS
        @class = $1
        @url   = $3
      elsif markup =~ IMAGE_URL
        @url = $1
      end
    end
    def render(context)
      if @class
        source = &amp;quot;&amp;lt;figure class=&#39;#{@class}&#39;&amp;gt;&amp;quot;
      else
        source = &amp;quot;&amp;lt;figure&amp;gt;&amp;quot;
      end
      if @link
        source += &amp;quot;&amp;lt;a href=\&amp;quot;#{@link}\&amp;quot;&amp;gt;&amp;quot;
      end
      source += &amp;quot;&amp;lt;img src=\&amp;quot;#{@url}\&amp;quot;&amp;gt;&amp;quot;
      if @link
        source += &amp;quot;&amp;lt;/a&amp;gt;&amp;quot;
      end
      source += &amp;quot;&amp;lt;figcaption&amp;gt;#{@caption}&amp;lt;/figcaption&amp;gt;&amp;quot; if @caption
      source += &amp;quot;&amp;lt;/figure&amp;gt;&amp;quot;
      source
    end
  end
end
Liquid::Template.register_tag(&#39;image&#39;, Jekyll::ImageTag)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;is written as this Hugo shortcode:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;!-- image --&amp;gt;
&amp;lt;figure {{ with .Get &amp;quot;class&amp;quot; }}class=&amp;quot;{{.}}&amp;quot;{{ end }}&amp;gt;
    {{ with .Get &amp;quot;link&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt;{{ end }}
        &amp;lt;img src=&amp;quot;{{ .Get &amp;quot;src&amp;quot; }}&amp;quot; {{ if or (.Get &amp;quot;alt&amp;quot;) (.Get &amp;quot;caption&amp;quot;) }}alt=&amp;quot;{{ with .Get &amp;quot;alt&amp;quot;}}{{.}}{{else}}{{ .Get &amp;quot;caption&amp;quot; }}{{ end }}&amp;quot;{{ end }} /&amp;gt;
    {{ if .Get &amp;quot;link&amp;quot;}}&amp;lt;/a&amp;gt;{{ end }}
    {{ if or (or (.Get &amp;quot;title&amp;quot;) (.Get &amp;quot;caption&amp;quot;)) (.Get &amp;quot;attr&amp;quot;)}}
    &amp;lt;figcaption&amp;gt;{{ if isset .Params &amp;quot;title&amp;quot; }}
        {{ .Get &amp;quot;title&amp;quot; }}{{ end }}
        {{ if or (.Get &amp;quot;caption&amp;quot;) (.Get &amp;quot;attr&amp;quot;)}}&amp;lt;p&amp;gt;
        {{ .Get &amp;quot;caption&amp;quot; }}
        {{ with .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;a href=&amp;quot;{{.}}&amp;quot;&amp;gt; {{ end }}
            {{ .Get &amp;quot;attr&amp;quot; }}
        {{ if .Get &amp;quot;attrlink&amp;quot;}}&amp;lt;/a&amp;gt; {{ end }}
        &amp;lt;/p&amp;gt; {{ end }}
    &amp;lt;/figcaption&amp;gt;
    {{ end }}
&amp;lt;/figure&amp;gt;
&amp;lt;!-- image --&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;usage&#34;&gt;Usage&lt;/h3&gt;

&lt;p&gt;I simply changed:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{% image full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg &amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were &amp;quot;having fun&amp;quot; and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; -&amp;gt;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/ %}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;to this (this example uses a slightly extended version named &lt;code&gt;fig&lt;/code&gt;, different than the built-in &lt;code&gt;figure&lt;/code&gt;):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{% fig class=&amp;quot;full&amp;quot; src=&amp;quot;http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg&amp;quot; title=&amp;quot;One of my favorite touristy-type photos. I secretly waited for the good light while we were having fun and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing.&amp;quot; link=&amp;quot;http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/&amp;quot; %}}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As a bonus, the shortcode named parameters are, arguably, more readable.&lt;/p&gt;

&lt;h2 id=&#34;finishing-touches&#34;&gt;Finishing touches&lt;/h2&gt;

&lt;h3 id=&#34;fix-content&#34;&gt;Fix content&lt;/h3&gt;

&lt;p&gt;Depending on the amount of customization that was done with each post with Jekyll, this step will require more or less effort. There are no hard and fast rules here except that &lt;code&gt;hugo server --watch&lt;/code&gt; is your friend. Test your changes and fix errors as needed.&lt;/p&gt;

&lt;h3 id=&#34;clean-up&#34;&gt;Clean up&lt;/h3&gt;

&lt;p&gt;You&amp;rsquo;ll want to remove the Jekyll configuration at this point. If you have anything else that isn&amp;rsquo;t used, delete it.&lt;/p&gt;

&lt;h2 id=&#34;a-practical-example-in-a-diff&#34;&gt;A practical example in a diff&lt;/h2&gt;

&lt;p&gt;&lt;a href=&#34;http://heyitsalex.net/&#34;&gt;Hey, it&amp;rsquo;s Alex&lt;/a&gt; was migrated in less than a &lt;em&gt;father-with-kids day&lt;/em&gt; from Jekyll to Hugo. You can see all the changes (and screw-ups) by looking at this &lt;a href=&#34;https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610&#34;&gt;diff&lt;/a&gt;.&lt;/p&gt;
</description>
		</item>
		
		<item>
			<title>Theme</title>
			<link>https://www.io.ac.nz/tags/theme/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/theme/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Programming</title>
			<link>https://www.io.ac.nz/categories/programming/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/categories/programming/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Programming</title>
			<link>https://www.io.ac.nz/tags/programming/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/programming/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Hugo</title>
			<link>https://www.io.ac.nz/tags/hugo/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/hugo/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Golang</title>
			<link>https://www.io.ac.nz/tags/golang/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/golang/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Linked post</title>
			<link>https://www.io.ac.nz/blog/linked-post/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/blog/linked-post/</guid>
			<description>&lt;p&gt;I&amp;rsquo;m a linked post in the menu. You can add other posts by adding the following line to the frontmatter:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;menu = &amp;quot;main&amp;quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. In mauris nulla, vestibulum vel auctor sed, posuere eu lorem. Aliquam consequat augue ut accumsan mollis. Suspendisse malesuada sodales tincidunt. Vivamus sed erat ac augue bibendum porta sed id ipsum. Ut mollis mauris eget ligula sagittis cursus. Aliquam id pharetra tellus. Pellentesque sed tempus risus. Proin id hendrerit ante. Vestibulum vitae urna ut mauris ultricies dignissim. Ut ante turpis, tristique vitae sagittis quis, sagittis nec diam. Fusce pulvinar cursus porta. Vivamus maximus leo dolor, ut pellentesque lorem fringilla nec. Mauris faucibus turpis posuere sapien euismod, a ullamcorper mi maximus.&lt;/p&gt;

&lt;p&gt;Morbi varius ex vel justo dictum placerat. Sed ac arcu pretium, varius elit eget, gravida purus. Fusce sit amet massa mollis eros tincidunt sollicitudin. Suspendisse iaculis cursus mauris ut sagittis. Interdum et malesuada fames ac ante ipsum primis in faucibus. Maecenas elit ligula, molestie quis magna eu, semper posuere lorem. Mauris a justo pharetra, congue ex eget, tincidunt massa. Maecenas sit amet neque lorem.&lt;/p&gt;

&lt;p&gt;Curabitur at elementum quam. Curabitur tristique elit non sapien aliquam vulputate. Vivamus in odio tincidunt, tempor sem quis, tincidunt lacus. Mauris pulvinar nunc sed tempus dictum. Nam vel arcu quis mi fermentum ullamcorper non ac lacus. Donec aliquet vitae ante at imperdiet. Aenean scelerisque venenatis urna, eget elementum risus convallis ac. Nullam gravida arcu lacus, non consectetur augue pretium non. Duis dignissim eros id urna pretium congue. Nullam eu magna in sem sollicitudin tempor. Pellentesque vel convallis ligula. Quisque semper, turpis a rhoncus efficitur, magna nibh iaculis elit, eget tempor dolor eros ut mi. Maecenas eu placerat lacus. Praesent congue pretium nulla, sed suscipit metus rutrum vel.&lt;/p&gt;
</description>
		</item>
		
		<item>
			<title>Go</title>
			<link>https://www.io.ac.nz/tags/go/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/tags/go/</guid>
			<description></description>
		</item>
		
		<item>
			<title>Go is for lovers</title>
			<link>https://www.io.ac.nz/blog/go-is-for-lovers/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/blog/go-is-for-lovers/</guid>
			<description>

&lt;p&gt;Hugo uses the excellent &lt;a href=&#34;http://golang.org/&amp;gt;&#34;&gt;go&lt;/a&gt; &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;html/template&lt;/a&gt; library for
its template engine. It is an extremely lightweight engine that provides a very
small amount of logic. In our experience that it is just the right amount of
logic to be able to create a good static website. If you have used other
template systems from different languages or frameworks you will find a lot of
similarities in go templates.&lt;/p&gt;

&lt;p&gt;This document is a brief primer on using go templates. The &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;
provide more details.&lt;/p&gt;

&lt;h2 id=&#34;introduction-to-go-templates&#34;&gt;Introduction to Go Templates&lt;/h2&gt;

&lt;p&gt;Go templates provide an extremely simple template language. It adheres to the
belief that only the most basic of logic belongs in the template or view layer.
One consequence of this simplicity is that go templates parse very quickly.&lt;/p&gt;

&lt;p&gt;A unique characteristic of go templates is they are content aware. Variables and
content will be sanitized depending on the context of where they are used. More
details can be found in the &lt;a href=&#34;http://golang.org/pkg/html/template/&amp;gt;&#34;&gt;go docs&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&#34;basic-syntax&#34;&gt;Basic Syntax&lt;/h2&gt;

&lt;p&gt;Go lang templates are html files with the addition of variables and
functions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Go variables and functions are accessible within {{ }}&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Accessing a predefined variable &amp;ldquo;foo&amp;rdquo;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{ foo }}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Parameters are separated using spaces&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Calling the add function with input of 1, 2:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{ add 1 2 }}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Methods and fields are accessed via dot notation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Accessing the Page Parameter &amp;ldquo;bar&amp;rdquo;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{ .Params.bar }}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Parentheses can be used to group items together&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{ if or (isset .Params &amp;quot;alt&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;) }} Caption {{ end }}
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;variables&#34;&gt;Variables&lt;/h2&gt;

&lt;p&gt;Each go template has a struct (object) made available to it. In hugo each
template is passed either a page or a node struct depending on which type of
page you are rendering. More details are available on the
&lt;a href=&#34;https://www.io.ac.nz/layout/variables&#34;&gt;variables&lt;/a&gt; page.&lt;/p&gt;

&lt;p&gt;A variable is accessed by referencing the variable name.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Variables can also be defined and referenced.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{ $address := &amp;quot;123 Main St.&amp;quot;}}
{{ $address }}
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;functions&#34;&gt;Functions&lt;/h2&gt;

&lt;p&gt;Go template ship with a few functions which provide basic functionality. The go
template system also provides a mechanism for applications to extend the
available functions with their own. &lt;a href=&#34;https://www.io.ac.nz/layout/functions&#34;&gt;Hugo template
functions&lt;/a&gt; provide some additional functionality we believe
are useful for building websites. Functions are called by using their name
followed by the required parameters separated by spaces. Template
functions cannot be added without recompiling hugo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{ add 1 2 }}
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;includes&#34;&gt;Includes&lt;/h2&gt;

&lt;p&gt;When including another template you will pass to it the data it will be
able to access. To pass along the current context please remember to
include a trailing dot. The templates location will always be starting at
the /layout/ directory within Hugo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{ template &amp;quot;chrome/header.html&amp;quot; . }}
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;logic&#34;&gt;Logic&lt;/h2&gt;

&lt;p&gt;Go templates provide the most basic iteration and conditional logic.&lt;/p&gt;

&lt;h3 id=&#34;iteration&#34;&gt;Iteration&lt;/h3&gt;

&lt;p&gt;Just like in go, the go templates make heavy use of range to iterate over
a map, array or slice. The following are different examples of how to use
range.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 1: Using Context&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{ range array }}
    {{ . }}
{{ end }}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Example 2: Declaring value variable name&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{range $element := array}}
    {{ $element }}
{{ end }}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Example 2: Declaring key and value variable name&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{range $index, $element := array}}
    {{ $index }}
    {{ $element }}
{{ end }}
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;conditionals&#34;&gt;Conditionals&lt;/h3&gt;

&lt;p&gt;If, else, with, or, &amp;amp; and provide the framework for handling conditional
logic in Go Templates. Like range, each statement is closed with &lt;code&gt;end&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Go Templates treat the following values as false:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;false&lt;/li&gt;
&lt;li&gt;0&lt;/li&gt;
&lt;li&gt;any array, slice, map, or string of length zero&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example 1: If&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;title&amp;quot; }}&amp;lt;h4&amp;gt;{{ index .Params &amp;quot;title&amp;quot; }}&amp;lt;/h4&amp;gt;{{ end }}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Example 2: If -&amp;gt; Else&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
    {{ index .Params &amp;quot;alt&amp;quot; }}
{{else}}
    {{ index .Params &amp;quot;caption&amp;quot; }}
{{ end }}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Example 3: And &amp;amp; Or&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{ if and (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Example 4: With&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An alternative way of writing &amp;ldquo;if&amp;rdquo; and then referencing the same value
is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
and skips the block if the variable is absent.&lt;/p&gt;

&lt;p&gt;The first example above could be simplified as:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{ with .Params.title }}&amp;lt;h4&amp;gt;{{ . }}&amp;lt;/h4&amp;gt;{{ end }}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Example 5: If -&amp;gt; Else If&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{ if isset .Params &amp;quot;alt&amp;quot; }}
    {{ index .Params &amp;quot;alt&amp;quot; }}
{{ else if isset .Params &amp;quot;caption&amp;quot; }}
    {{ index .Params &amp;quot;caption&amp;quot; }}
{{ end }}
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;pipes&#34;&gt;Pipes&lt;/h2&gt;

&lt;p&gt;One of the most powerful components of go templates is the ability to
stack actions one after another. This is done by using pipes. Borrowed
from unix pipes, the concept is simple, each pipeline&amp;rsquo;s output becomes the
input of the following pipe.&lt;/p&gt;

&lt;p&gt;Because of the very simple syntax of go templates, the pipe is essential
to being able to chain together function calls. One limitation of the
pipes is that they only can work with a single value and that value
becomes the last parameter of the next pipeline.&lt;/p&gt;

&lt;p&gt;A few simple examples should help convey how to use the pipe.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 1 :&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{ if eq 1 1 }} Same {{ end }}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;is the same as&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{ eq 1 1 | if }} Same {{ end }}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It does look odd to place the if at the end, but it does provide a good
illustration of how to use the pipes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 2 :&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{ index .Params &amp;quot;disqus_url&amp;quot; | html }}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Access the page parameter called &amp;ldquo;disqus_url&amp;rdquo; and escape the HTML.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 3 :&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{ if or (or (isset .Params &amp;quot;title&amp;quot;) (isset .Params &amp;quot;caption&amp;quot;)) (isset .Params &amp;quot;attr&amp;quot;)}}
Stuff Here
{{ end }}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Could be rewritten as&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{  isset .Params &amp;quot;caption&amp;quot; | or isset .Params &amp;quot;title&amp;quot; | or isset .Params &amp;quot;attr&amp;quot; | if }}
Stuff Here
{{ end }}
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;context-aka-the-dot&#34;&gt;Context (aka. the dot)&lt;/h2&gt;

&lt;p&gt;The most easily overlooked concept to understand about go templates is that {{ . }}
always refers to the current context. In the top level of your template this
will be the data set made available to it. Inside of a iteration it will have
the value of the current item. When inside of a loop the context has changed. .
will no longer refer to the data available to the entire page. If you need to
access this from within the loop you will likely want to set it to a variable
instead of depending on the context.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  {{ $title := .Site.Title }}
  {{ range .Params.tags }}
    &amp;lt;li&amp;gt; &amp;lt;a href=&amp;quot;{{ $baseurl }}/tags/{{ . | urlize | lower  }}&amp;quot;&amp;gt;{{ . }}&amp;lt;/a&amp;gt; - {{ $title }} &amp;lt;/li&amp;gt;
  {{ end }}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Notice how once we have entered the loop the value of {{ . }} has changed. We
have defined a variable outside of the loop so we have access to it from within
the loop.&lt;/p&gt;

&lt;h1 id=&#34;hugo-parameters&#34;&gt;Hugo Parameters&lt;/h1&gt;

&lt;p&gt;Hugo provides the option of passing values to the template language
through the site configuration (for sitewide values), or through the meta
data of each specific piece of content. You can define any values of any
type (supported by your front matter/config format) and use them however
you want to inside of your templates.&lt;/p&gt;

&lt;h2 id=&#34;using-content-page-parameters&#34;&gt;Using Content (page) Parameters&lt;/h2&gt;

&lt;p&gt;In each piece of content you can provide variables to be used by the
templates. This happens in the &lt;a href=&#34;https://www.io.ac.nz/content/front-matter&#34;&gt;front matter&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;An example of this is used in this documentation site. Most of the pages
benefit from having the table of contents provided. Sometimes the TOC just
doesn&amp;rsquo;t make a lot of sense. We&amp;rsquo;ve defined a variable in our front matter
of some pages to turn off the TOC from being displayed.&lt;/p&gt;

&lt;p&gt;Here is the example front matter:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;---
title: &amp;quot;Permalinks&amp;quot;
date: &amp;quot;2013-11-18&amp;quot;
aliases:
  - &amp;quot;/doc/permalinks/&amp;quot;
groups: [&amp;quot;extras&amp;quot;]
groups_weight: 30
notoc: true
---
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here is the corresponding code inside of the template:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  {{ if not .Params.notoc }}
    &amp;lt;div id=&amp;quot;toc&amp;quot; class=&amp;quot;well col-md-4 col-sm-6&amp;quot;&amp;gt;
    {{ .TableOfContents }}
    &amp;lt;/div&amp;gt;
  {{ end }}
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;using-site-config-parameters&#34;&gt;Using Site (config) Parameters&lt;/h2&gt;

&lt;p&gt;In your top-level configuration file (eg, &lt;code&gt;config.yaml&lt;/code&gt;) you can define site
parameters, which are values which will be available to you in chrome.&lt;/p&gt;

&lt;p&gt;For instance, you might declare:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;params:
  CopyrightHTML: &amp;quot;Copyright &amp;amp;#xA9; 2013 John Doe. All Rights Reserved.&amp;quot;
  TwitterUser: &amp;quot;spf13&amp;quot;
  SidebarRecentLimit: 5
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Within a footer layout, you might then declare a &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt; which is only
provided if the &lt;code&gt;CopyrightHTML&lt;/code&gt; parameter is provided, and if it is given,
you would declare it to be HTML-safe, so that the HTML entity is not escaped
again.  This would let you easily update just your top-level config file each
January 1st, instead of hunting through your templates.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{if .Site.Params.CopyrightHTML}}&amp;lt;footer&amp;gt;
&amp;lt;div class=&amp;quot;text-center&amp;quot;&amp;gt;{{.Site.Params.CopyrightHTML | safeHtml}}&amp;lt;/div&amp;gt;
&amp;lt;/footer&amp;gt;{{end}}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;An alternative way of writing the &amp;ldquo;if&amp;rdquo; and then referencing the same value
is to use &amp;ldquo;with&amp;rdquo; instead. With rebinds the context &lt;code&gt;.&lt;/code&gt; within its scope,
and skips the block if the variable is absent:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{{with .Site.Params.TwitterUser}}&amp;lt;span class=&amp;quot;twitter&amp;quot;&amp;gt;
&amp;lt;a href=&amp;quot;https://twitter.com/{{.}}&amp;quot; rel=&amp;quot;author&amp;quot;&amp;gt;
&amp;lt;img src=&amp;quot;/images/twitter.png&amp;quot; width=&amp;quot;48&amp;quot; height=&amp;quot;48&amp;quot; title=&amp;quot;Twitter: {{.}}&amp;quot;
 alt=&amp;quot;Twitter&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;
&amp;lt;/span&amp;gt;{{end}}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Finally, if you want to pull &amp;ldquo;magic constants&amp;rdquo; out of your layouts, you can do
so, such as in this example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;nav class=&amp;quot;recent&amp;quot;&amp;gt;
  &amp;lt;h1&amp;gt;Recent Posts&amp;lt;/h1&amp;gt;
  &amp;lt;ul&amp;gt;{{range first .Site.Params.SidebarRecentLimit .Site.Recent}}
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;{{.RelPermalink}}&amp;quot;&amp;gt;{{.Title}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
  {{end}}&amp;lt;/ul&amp;gt;
&amp;lt;/nav&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
</description>
		</item>
		
		<item>
			<title>Pseudo</title>
			<link>https://www.io.ac.nz/categories/pseudo/</link>
			<pubDate>Mon, 01 Jan 0001 00:00:00 UTC</pubDate>
			<guid>https://www.io.ac.nz/categories/pseudo/</guid>
			<description></description>
		</item>
		
	</channel>
</rss>
