LaTeX + VS Code + Docker = 🚀

Tim J
2 min readSep 11, 2023
Hey, this is one of my first posts. Please leave feedback in the comments.

How to use LaTeX without installing MikTex or TeX Live.

LaTeX is one of the most widely used non WYSIWYG programs for creating documents. The installation however can be very complicated. You need to find the correct distribution, you then need to configure it correctly and time to time you need to update your distribution and packages.

What if I tell you, that you can get all advantages of LaTeX but don't need to download it the complex way. After this guide, your LaTeX compiler is executing in a Docker container and the image can just be swapped with a newer one.

Sure, you could use Overleaf. In the case of using the editor on their website, you don't even need to download anything other than a browser. But with that option, you don't have the ability to work offline, and you depend on Overleaf for their availability.

1. Installing Docker Desktop

In general, you just need to follow their installation guide: https://docs.docker.com/desktop/ but there is a quicker way in most cases.

Mac:

brew install docker

Windows:

  1. Install wsl2: https://learn.microsoft.com/en-us/windows/wsl/install
wsl --install

2. Install the distribution of your choice

wsl --list --online # List the available distributions
wsl --install -d <Distribution Name> # Install one

3. Either download the executable from docker or just use winget

winget install -e --id Docker.DockerDesktop

2. Install VS Code

Mac:

brew install --cask visual-studio-code

Windows:

winget install -e --id Microsoft.VisualStudioCode

3. Install LaTeX Workshop for VS Code

  "latex-workshop.docker.enabled": true,
"latex-workshop.docker.image.latex": "ghcr.io/xu-cheng/texlive-full",

When you open a .tex file the next time, you will see a little run icon, which will compile your latex project in a container. The generated PDF file will be in a directory called “out” next to your root file.

Have in mind that you can tweak every setting you can think of. The location of the root file, the location of the out directory, the arguments which will be used to call texlive.

If you have question or feedback, don't hesitate to share in the comments.

Thank you for reading!

--

--

Tim J

Software Developer in 🇩🇪 Bachelor Student of Business Informatics