<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Thesis |</title><link>https://yu-cheng.co/tags/thesis/</link><atom:link href="https://yu-cheng.co/tags/thesis/index.xml" rel="self" type="application/rss+xml"/><description>Thesis</description><generator>HugoBlox Kit (https://hugoblox.com)</generator><language>en-us</language><lastBuildDate>Sat, 25 Feb 2017 20:13:52 +0000</lastBuildDate><image><url>https://yu-cheng.co/media/icon_hu_87a968e0c4fc153c.png</url><title>Thesis</title><link>https://yu-cheng.co/tags/thesis/</link></image><item><title>Using git-latexdiff to track changes in tex-file graphically</title><link>https://yu-cheng.co/blog/git-latexdiff/</link><pubDate>Sat, 25 Feb 2017 20:13:52 +0000</pubDate><guid>https://yu-cheng.co/blog/git-latexdiff/</guid><description>&lt;p&gt;It&amp;rsquo;s been a while since I started using &lt;code&gt;git&lt;/code&gt;. The version control system helps to track changes in computer files and coordinating work on those files among multiple people. Composing a manuscript is nothing unlike developing a program. If multiple authors work on the same manuscript, &lt;code&gt;git&lt;/code&gt; can be very helpful to avoid conflicts. If you are the only author, &lt;code&gt;git&lt;/code&gt; can help you to document what has been changed since the last commit or put your advisor&amp;rsquo;s comment in another branch.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m a big fan of $\Latex$. It&amp;rsquo;s powerful and elegant. With a given template, one should only focus on the content. However, when it comes to tracking changes, $\Latex$ is a lightyear behind Word. Fortunately, I recently bumped into a program &lt;code&gt;latexdiff&lt;/code&gt;, which visually tracks changes between $\Latex$ generated pdfs, much like how Word does. Before, I often manually color the lines I changed when sending to my advisor.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;git-latexdiff&lt;/code&gt; is a wrapper around &lt;code&gt;git&lt;/code&gt; and &lt;code&gt;latexdiff&lt;/code&gt;. Instead of manually generating dummy tex files of different names (and also the auxiliary files), &lt;code&gt;git-latexdiff&lt;/code&gt; can graphically show the differences between various versions of a LaTeX-generated pdf. Below is an example of how I incorporate these tools to my workflow.&lt;/p&gt;
&lt;h3 id="git-basics"&gt;Git basics&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;You can turn any folders into &lt;em&gt;git-tracking&lt;/em&gt; folders by typing the command &lt;code&gt;git init .&lt;/code&gt; in the targeting folder.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git add .&lt;/code&gt;: add all files in the folder to staging&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git commit&lt;/code&gt;: commit changes to head (the changes are still local)&lt;/li&gt;
&lt;li&gt;These committed changes can then be pushed to a remote repository hosted on GitHub or gitlab.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git checkout -b branchname&lt;/code&gt; to create and switch to new branch (&lt;code&gt;git checkout branchname&lt;/code&gt; to switch after commit if the branch already exists)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git status&lt;/code&gt; to check current branch and status&lt;/li&gt;
&lt;li&gt;After you are satisfied with the changes you made in a developing branch, merge back to &lt;code&gt;master&lt;/code&gt; by &lt;code&gt;git merge branchname&lt;/code&gt;, assuming the current branch is &lt;code&gt;master&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Many GUI git
can save the day if you are not used to command lines. For now, I am using &lt;em&gt;GitKraken&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="track-changes"&gt;Track changes&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;latexdiff&lt;/code&gt; works like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-latex" data-lang="latex"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;latexdiff draft.tex revision.tex &amp;gt; diff.tex
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To compare the difference between first two versions of .tex, a third dummy diff.tex is created, along with many auxiliary files. Check this
for better control over &lt;code&gt;latexdiff&lt;/code&gt;. Using &lt;code&gt;git-latexdiff&lt;/code&gt;, one can track the differences between the same file on different branches or versions, like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-latex" data-lang="latex"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git latexdiff --latexmk --append-context2cmd=&amp;#34;abstract&amp;#34; --main Largescale&lt;span class="nb"&gt;_&lt;/span&gt;eddy&lt;span class="nb"&gt;_&lt;/span&gt;interannual&lt;span class="nb"&gt;_&lt;/span&gt;AL.tex master advisor
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;git-latexdiff&lt;/code&gt; also has many additional options. More detailed information can be found
and the gitlab page of
.&lt;/p&gt;</description></item></channel></rss>