<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hannw on Medium]]></title>
        <description><![CDATA[Stories by Hannw on Medium]]></description>
        <link>https://medium.com/@alex.wu157004861?source=rss-4a7ab53ba84d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*aSYmF_6BmFepWFGr</url>
            <title>Stories by Hannw on Medium</title>
            <link>https://medium.com/@alex.wu157004861?source=rss-4a7ab53ba84d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 18:58:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alex.wu157004861/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Docker[LaTeX]+VSCode: Setting up a Lightweight LaTeX Environment for MacOS]]></title>
            <link>https://medium.com/@alex.wu157004861/vscode-docker-latex-setting-up-a-lightweight-latex-environment-for-mac-1426182eeca0?source=rss-4a7ab53ba84d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1426182eeca0</guid>
            <category><![CDATA[latex]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[typesetting]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[academic-writing]]></category>
            <dc:creator><![CDATA[Hannw]]></dc:creator>
            <pubDate>Wed, 20 Nov 2024 20:27:11 GMT</pubDate>
            <atom:updated>2026-01-27T16:07:55.938Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*287Bk7htK3M0L7RvGvR7gA.png" /></figure><p>As a LaTeX user with a Mac machine, I wanted a clean, containerized setup for document writing in VSCode. However, most of the containers were built for AMD64 devices, with platform compatibility issues for ARM64 users. Here’s how I configured a minimal LaTeX environment using Docker and the LaTeX Workshop extension, on the Apple Silicon platform.</p><h3>The Docker Solution</h3><p>I created a lightweight LaTeX Docker image (<a href="https://hub.docker.com/r/noahwu/minimal-latex">noahwu/minimal-latex</a>) specifically optimized for ARM64 architecture. The image is based on debian:bullseye-slim and includes only the essential LaTeX packages needed for most document writing tasks.</p><p>The Docker image includes:</p><ul><li>Basic texlive distribution</li><li>Common LaTeX extras (texlive-latex-extra)</li><li>Scientific and picture packages</li><li>latexmk for building</li><li>Supporting tools (git, wget, python3-pygments)</li></ul><h3>Getting Started</h3><ol><li>Install Docker and VSCode</li><li>Install the LaTeX Workshop extension for VSCode. Restart it if the LaTeX Workshop icon does not show up on the sidebar after installation.</li><li>Copy the configuration below to your settings.json</li><li>Compile a .tex file (compile icon would show up in the upper right corner as a triangle if you are opening a .tex file), and it initializes for you. Or manually, pull the Docker image: docker pull noahwu/minimal-latex:latest</li><li>Start writing your LaTeX documents!</li></ol><p>The PDF viewer is configured to open in a new tab within VSCode, making it easy to see your changes as you write.</p><h3>VSCode Configuration</h3><h4>For the extension</h4><p>Here’s the essential configuration for settings.json:</p><pre>{<br>  &quot;latex-workshop.docker.enabled&quot;: true,<br>  &quot;latex-workshop.docker.platform&quot;: &quot;linux/arm64&quot;,<br>  &quot;latex-workshop.docker.image.latex&quot;: &quot;noahwu/minimal-latex:latest&quot;<br>}</pre><h4>Build Recipes</h4><p>I’ve set up two build recipes:</p><ol><li>A simple latexmk workflow</li><li>A traditional pdflatex + bibtex workflow</li></ol><pre>&quot;latex-workshop.latex.recipes&quot;: [<br>  {<br>    &quot;name&quot;: &quot;latexmk&quot;,<br>    &quot;tools&quot;: [&quot;latexmk&quot;]<br>  },<br>  {<br>    &quot;name&quot;: &quot;pdflatex&quot;,<br>    &quot;tools&quot;: [&quot;pdflatex&quot;, &quot;bibtex&quot;, &quot;pdflatex&quot;, &quot;pdflatex&quot;]<br>  }<br>],</pre><h4>LaTeX Tools Configuration</h4><p>An essential part of the setup is configuring the LaTeX tools that will be used for compilation, e.g., the recipes above. Here’s how I configured the three main tools:</p><pre>&quot;latex-workshop.latex.tools&quot;: [<br>    {<br>      &quot;name&quot;: &quot;latexmk&quot;,<br>      &quot;command&quot;: &quot;latexmk&quot;,<br>      &quot;args&quot;: [<br>        &quot;-synctex=1&quot;,           // Enable SyncTeX for source-PDF synchronization<br>        &quot;-interaction=nonstopmode&quot;,  // Keep compiling even if there are errors<br>        &quot;-file-line-error&quot;,     // Show file and line number for errors<br>        &quot;-pdf&quot;,                 // Generate PDF output<br>        &quot;-outdir=%OUTDIR%&quot;,     // Output directory<br>        &quot;%DOC%&quot;                 // Input file<br>      ]<br>    },<br>    {<br>      &quot;name&quot;: &quot;pdflatex&quot;,<br>      &quot;command&quot;: &quot;pdflatex&quot;,<br>      &quot;args&quot;: [<br>        &quot;-synctex=1&quot;,<br>        &quot;-interaction=nonstopmode&quot;,<br>        &quot;-file-line-error&quot;,<br>        &quot;-recorder&quot;,            // Record dependencies in .fls file<br>        &quot;%DOC%&quot;<br>      ]<br>    },<br>    {<br>      &quot;name&quot;: &quot;bibtex&quot;,<br>      &quot;command&quot;: &quot;bibtex&quot;,<br>      &quot;args&quot;: [&quot;%DOCFILE%&quot;]     // Process bibliography<br>    }<br>]</pre><p>Let’s break down each tool:</p><ol><li><strong>latexmk</strong>: This is a Perl script that automates the process of generating a LaTeX document. It determines which commands need to be run and in what order, making it particularly useful for documents with bibliographies and cross-references.</li><li><strong>pdflatex</strong>: This is the traditional LaTeX compiler that directly produces PDF output. The configuration includes options for better error reporting and synchronization between the source and output.</li><li><strong>bibtex</strong>: This tool processes bibliography files (.bib) to generate the formatted bibliography in your document.</li></ol><p>The arguments for each tool are carefully chosen to provide:</p><ul><li>Detailed error reporting (-file-line-error)</li><li>Continuous compilation even when errors occur (-interaction=nonstopmode)</li><li>Source-PDF synchronization (-synctex=1)</li><li>Proper output directory handling (-outdir=%OUTDIR%)</li></ul><p>These tools work in conjunction with the recipes we defined earlier, allowing for both simple one-step compilation with latexmk and more traditional multi-step compilation with pdflatex and bibtex.</p><h4>Compilation Cleanup Configuration</h4><p>To keep your working directory clean, I’ve configured the extension to remove common auxiliary files:</p><pre>&quot;latex-workshop.latex.clean.fileTypes&quot;: [<br>  &quot;*.aux&quot;, &quot;*.bbl&quot;, &quot;*.blg&quot;, &quot;*.idx&quot;, &quot;*.ind&quot;,<br>  &quot;*.lof&quot;, &quot;*.lot&quot;, &quot;*.out&quot;, &quot;*.toc&quot;, &quot;*.acn&quot;,<br>  &quot;*.acr&quot;, &quot;*.alg&quot;, &quot;*.glg&quot;, &quot;*.glo&quot;, &quot;*.gls&quot;,<br>  &quot;*.ist&quot;, &quot;*.fls&quot;, &quot;*.log&quot;, &quot;*.fdb_latexmk&quot;<br>],<br>  &quot;latex-workshop.latex.autoClean.run&quot;: &quot;onBuilt&quot;,<br>  &quot;latex-workshop.latex.clean.method&quot;: &quot;glob&quot;</pre><h3>Customization</h3><p>If you need to customize the LaTeX environment, the Dockerfile is publicly available below in the post. You can modify it to add additional packages or tools as needed. The Dockerfile uses build arguments for easy customization of the user settings:</p><pre>ARG USER_NAME=latex<br>ARG USER_HOME=/home/latex<br>ARG USER_ID=1000<br>ARG USER_GECOS=LaTeX</pre><h3>Benefits of This Setup</h3><ol><li><strong>Isolated Environment</strong>: The Docker container keeps your LaTeX installation separate from your system.</li><li><strong>Reproducible</strong>: Anyone can use the same setup by pulling the Docker image.</li><li><strong>Lightweight</strong>: Only includes essential packages to keep the image size minimal.</li><li><strong>ARM64 Optimized</strong>: Specifically built for modern ARM64 architecture.</li></ol><h3>Conclusion</h3><p>This setup provides a clean, containerized LaTeX environment that’s easy to set up and maintain. The combination of Docker and VSCode’s LaTeX Workshop extension creates a powerful yet lightweight document writing environment that works especially well on ARM64 systems.</p><p>Feel free to customize the Docker image or VSCode settings to better suit your needs. The Dockerfile is available for those who want to add additional packages or make other modifications to the base image.</p><pre>FROM debian:bullseye-slim<br><br># Use build args for customization<br>ARG USER_NAME=latex<br>ARG USER_HOME=/home/latex<br>ARG USER_ID=1000<br>ARG USER_GECOS=LaTeX<br><br># Create user<br>RUN adduser \<br>--home &quot;$USER_HOME&quot; \<br>--uid $USER_ID \<br>--gecos &quot;$USER_GECOS&quot; \<br>--disabled-password \<br>&quot;$USER_NAME&quot;<br><br># Install only essential packages<br>RUN apt-get update &amp;&amp; apt-get install -y --no-install-recommends \<br>texlive \<br>texlive-latex-extra \<br>texlive-pictures \<br>texlive-science \<br>latexmk \<br>make \<br>git \<br>wget \<br>python3-pygments &amp;&amp; \<br>rm -rf /var/lib/apt/lists/* &amp;&amp; \<br>apt-get clean<br><br># Set working directory<br>WORKDIR $USER_HOME<br>USER $USER_NAME<br><br># Add a healthcheck<br>HEALTHCHECK CMD pdflatex --version || exit 1<br><br># Add labels for better maintainability<br>LABEL maintainer=&quot;noahwo&quot; \<br>description=&quot;Lightweight LaTeX environment for ARM64&quot; \<br>version=&quot;1.0&quot;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1426182eeca0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>