<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Latex on kistu</title>
  <link rel="alternate" href="/tags/latex/" />
  <link rel="self" href="/tags/latex/index.xml" />
  <subtitle>Recent content in Latex on kistu</subtitle>
  <id>/tags/latex/</id>
  <generator uri="http://gohugo.io" version="0.124.0">Hugo</generator>
  <language>en</language>
  <updated>0001-01-01T00:00:00Z</updated>
  <author>
    
    
  </author>
  
      <entry>
        <title>A LaTeX Workflow</title>
        <link rel="alternate" href="/drafts/a-latex-workflow/" />
        <id>/drafts/a-latex-workflow/</id>
        <published>0001-01-01T00:00:00Z</published>
        <updated>0001-01-01T00:00:00Z</updated>
        <summary type="html">Notes are digital, and there is a challenge in it&amp;rsquo;s transition from handwriting. While this transition is in many cases vastly beneficial, the author no longer has the freedom to design their writings exactly as they wish. They are constrained by the limitations of the software systems they choose to use.
Plaintext (&amp;quot;*.txt&amp;quot;) is the most basic of such systems - it simply stores symbols in order as they appear without any other formatting.</summary>
          <content type="html"><![CDATA[<p>Notes are digital, and there is a challenge in it&rsquo;s transition from handwriting. While this transition is in many cases vastly beneficial, the author no longer has the freedom to design their writings exactly as they wish. They are constrained by the limitations of the software systems they choose to use.</p>
<p><strong>Plaintext</strong> (&quot;*.txt&quot;) is the most basic of such systems - it simply stores symbols in order as they appear without any other formatting. These files can be edited directly with any text editor.<br>
<strong>Markup</strong> (&quot;*.md&quot;, &ldquo;*.tex&rdquo;, &ldquo;*.html&rdquo;) languages include additional text to specify some formatting, but can still be reasonably edited with a text editor.
<strong>Richtext</strong> formats (&quot;*.rtf&quot;, &ldquo;*.docx&rdquo;) store content with formatting instructions that typically require specialized software (word processors) to edit and render.</p>
<p>



    
    <input type="checkbox" id="zoomCheck-15c07" hidden>
    <label for="zoomCheck-15c07">
        <img class="zoomCheck" loading="lazy" decoding="async" 
            src="types-of-documents.svg" alt="types of documents" 
             />
    </label>

</p>
<p>There are two broad categories of editors:</p>
<ul>
<li>Code editors where a source file is edited and seperately rendered into a final document</li>
<li>What You See Is What You Get (WYSIWYG) editors where the document is rendered and edited seamlessly in the same place</li>
</ul>
<p>



    
    <input type="checkbox" id="zoomCheck-22373" hidden>
    <label for="zoomCheck-22373">
        <img class="zoomCheck" loading="lazy" decoding="async" 
            src="types-of-editors.svg" alt="types of editors" 
             />
    </label>

</p>
<p>Latex typically uses code editors, and this may seem imtimidating and complicated until the initial learning curve is overcome.<br>
If a visual editor is strongly preffered, <a href="https://www.lyx.org">LyX</a> works with latex and is completely free and open source (GPL).<br>
If the goal is to just explore latex without setting it up on your system, <a href="https://www.overleaf.com/">Overleaf</a> is very useful. Note that some features are locked behind a subscription.</p>
<h1 id="latex">LaTeX</h1>
<p>LaTeX is a typesetting system - it is a way of organizing text and images on a page using text commands, templates and composition.</p>
<h2 id="simple-document">Simple Document</h2>
<p>This is a simple latex source file (hello.tex) to show some of the features of latex:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-latex" data-lang="latex"><span class="line"><span class="cl"><span class="k">\documentclass</span><span class="nb">{</span>article<span class="nb">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">\begin</span><span class="nb">{</span>document<span class="nb">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">\chapter</span><span class="nb">{</span>Title<span class="nb">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">\end</span><span class="nb">{</span>document<span class="nb">}</span>
</span></span></code></pre></div><p>You can use it to create a pdf:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">latexmk -pdf -outdir<span class="o">=</span>build hello.tex
</span></span></code></pre></div><h2 id="quick-reference">Quick Reference</h2>
<h2 id="value">Value</h2>
<ul>
<li>supports scientific and mathematical notation</li>
<li>creates a higher degree of separation of content from formatting</li>
<li>high typographical quality</li>
<li>stable and longevity</li>
<li>free and open source</li>
<li>robust referencing system</li>
</ul>
<p>Extensive use in the scientific community</p>
<h2 id="template">Template</h2>
<p>The following is an example of a template that can be created:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">.
</span></span><span class="line"><span class="cl">├── build
</span></span><span class="line"><span class="cl">├── chapters
</span></span><span class="line"><span class="cl">│   ├── introduction.tex
</span></span><span class="line"><span class="cl">│   ├── chapter1.tex
</span></span><span class="line"><span class="cl">│   ├── chapter2.tex
</span></span><span class="line"><span class="cl">│   ├── references.bib
</span></span><span class="line"><span class="cl">│   └── title.tex
</span></span><span class="line"><span class="cl">├── figures
</span></span><span class="line"><span class="cl">├── main.tex
</span></span><span class="line"><span class="cl">├── Makefile
</span></span><span class="line"><span class="cl">└── style
</span></span><span class="line"><span class="cl">    └── style.tex
</span></span></code></pre></div><p>The entire document does not need to be contained in a single source file - it can be composed from many files.</p>
<p>In this structure, each chapter has it&rsquo;s own <code>tex</code> file. Figures are kept in a dedicated directory (<code>figures/</code>) and the styling is defined in <code>style.tex</code>.</p>
<p><code>main.tex</code> brings everything together with the <code>\input</code> command:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-latex" data-lang="latex"><span class="line"><span class="cl"><span class="k">\documentclass</span><span class="nb">{</span>report<span class="nb">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">\input</span><span class="nb">{</span>style/style.tex<span class="nb">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">\begin</span><span class="nb">{</span>document<span class="nb">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">\pagenumbering</span><span class="nb">{</span>roman<span class="nb">}</span>
</span></span><span class="line"><span class="cl"><span class="k">\input</span><span class="nb">{</span>chapters/title<span class="nb">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">\tableofcontents</span>
</span></span><span class="line"><span class="cl"><span class="k">\newpage</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">\pagenumbering</span><span class="nb">{</span>arabic<span class="nb">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">\input</span><span class="nb">{</span>chapters/introduction<span class="nb">}</span>
</span></span><span class="line"><span class="cl"><span class="k">\input</span><span class="nb">{</span>chapters/chapter1<span class="nb">}</span>
</span></span><span class="line"><span class="cl"><span class="k">\input</span><span class="nb">{</span>chapters/chapter2<span class="nb">}</span>
</span></span><span class="line"><span class="cl"><span class="k">\newpage</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">\bibliography</span><span class="nb">{</span>chapters/references.bib<span class="nb">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">\end</span><span class="nb">{</span>document<span class="nb">}</span>
</span></span></code></pre></div><p>This should give an idea of how latex can be used to create a powerful and efficient system - once a document format is well defined, it can be reproduced very easily. For most formatting you wish to do, there likely already exists some template. If you are creating one from scratch, or modifying an existing template to meet your requirement, the process may feel tedious and unncessary, but this is a once-off cost that will be rewarded every time it is reused.</p>
<h1 id="the-workflow">The Workflow</h1>
<p>text editor: neovim
document generator: latexmk
viewer: evince</p>
<p>



    
    <input type="checkbox" id="zoomCheck-b6d2c" hidden>
    <label for="zoomCheck-b6d2c">
        <img class="zoomCheck" loading="lazy" decoding="async" 
            src="the-latex-workflow.svg" alt="the latex workflow" 
             />
    </label>

</p>
<p>Your workflow will depend on your operating system and software preferences. While the workflow defined uses examples for Linux, the general setup should be readily applicable to any platform.</p>
<h2 id="document-generator">Document Generator</h2>
<p>This is the core software that automates the building of latex source files to the desired output document.</p>
<p><a href="https://www.cantab.net/users/johncollins/latexmk/index.html">latexmk</a> supports many operarating systems (including Linux, MacOS and Windows) and, given the source files for a document, it issues the appropriate sequence of commands to generate a <code>pdf</code>, <code>ps</code> or <code>dvi</code> document. <sup id="fnref:1"><a href="#fn:1" class="footnote-ref" role="doc-noteref">1</a></sup></p>
<p>continous watching and updates pvc</p>
<h2 id="text-editor">Text Editor</h2>
<p>To edit the latex source files, any text editor will do.</p>
<p>Not much features are required, but the following makes the editing easier:</p>
<ul>
<li>Syntax highlighting (to validate syntax and quickly identify errors)</li>
<li>Autosave (to automatically trigger re-rendering on changes)</li>
</ul>
<p>A terminal based text editor like <code>neovim</code> works perfectly too!</p>
<blockquote>
<p>To autosave for the current file in <code>neovim</code>, run command <code>autocmd TextChanged,TextChangedI &lt;buffer&gt; silent write</code>.</p>
</blockquote>
<h2 id="viewer">Viewer</h2>
<p>Once again, any PDF viewer will work. Some viewers may not automatically update if the output file changes - these are not very nice to work with as they have to be refreshed manally each time.</p>
<p>Evince is the default document view on GNOME. A cool feature is that it supports dark mode (color inversion)!</p>
<div class="footnotes" role="doc-endnotes">
<hr>
<ol>
<li id="fn:1">
<p><a href="https://ctan.org/pkg/latexmk/">https://ctan.org/pkg/latexmk/</a>&#160;<a href="#fnref:1" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
</ol>
</div>
]]></content>
      </entry>

</feed>


