How to Run LaTeX Projects Locally (for Free) On Windows

LaTeX is a high-quality typesetting system that is widely used in technical, academic, and scientific writing. It’s very popular in academia, especially in fields like mathematics, physics, computer science, and engineering.

LaTeX is not a word processor like Microsoft Word – rather, it’s a document preparation system that allows you to focus on the content of your writing while it handles the formatting. If you use LaTeX to write your formal documents (like a CV, résumé, or research paper), then you don’t need to worry about the formatting and structure, as everything can be done using LaTeX scripts.

If you use LaTeX to write your academic or research papers, you might be familiar with website-based applications like Overleaf. Overleaf is a website that allows anyone to read, write, and compile LaTeX scripts online.

These sites are okay for small tasks or compilations, or if you need only a little bit of free collaboration. But if you need to work on bigger projects or need to conduct many collaborative tasks, then the free tier may be insufficient. And in my opinion, the paid subscription costs too much.

But don’t worry: running LaTeX locally may be the perfect solution for you. I know this because I also faced a similar situation, and this simply changed my life! I also keep all of the tracks in Git (GitHub, GitLab, and so on) along with unlimited collaboration opportunities and compilation. And the great thing is, all of these are completely free as it’s all happening on my local machine.

So in this article, I am going to discuss the methods in detail. I have also created an in-depth video for you to understand how this works.

Video Tutorial

Resources You’ll Need:

1. GitHub Repository

This entire guide is available in one of my GitHub projects named Install-LaTeX. The live website is available here (fahimfba.github.io/Install-LaTeX) as well. I would highly appreciate it if you star (⭐) the repository. Also, you can create issues there if you face any problems. Any kind of good contribution is also welcome here.

2. Operating System

You can install LaTeX on any major operating system (Windows, MacOS, and Linux-based OSes). But in this article, I am only going to talk about the Windows operating system.

Here, I’m using the latest Windows 11 operating system, but the same procedure should be applicable to all of the Windows-based operating systems that are going to come out in the future. Windows 10 should also be okay too.

3. Editor

I am going to use the popular Visual Studio Code as my editor. It is a 100% free and robust editor that’s very popular among devs all over the world. If you don’t already have it, go ahead and install it before proceeding further.

VS Code

4. LaTeX Compiler/IDE

To work on LaTeX files, you’ll need a specific compiler. I am going to use MikTeX. There are other tools out there, but this is the best tool right now (according to me!). It is completely free and supports all major operating systems as well. It also has a built-in IDE, but we are going to use VS Code as our main editor.

MiKTeX

Download the Windows executable file from the Download section.

Download MiKTeX

After the download is finished, install the executable. At the end of the installation, keep the tick in “Check for updates now”.

Check for update

You will find the MikTeX console in your taskbar. Open that.

MiKTeX console

Go to the “Updates” tab and click “Update now”. It will install all of those packages.

At the end, it will prompt you to close the console. Click “OK”. Open MiKTeX again.

That’s it for this tool.

5. Perl

The commands we are going to execute for building the LaTeX files are dependent on Perl. As the Windows operating system doesn’t come with a built-in Perl compiler, we are going to install the Strawberry Perl.

Perl

Download the latest MSI package from it.

Download Strawberry perl

Install the executable after it gets finished downloading the application.

We need to add Perl’s path to the system environment. To do that, go into the location where it has been installed. By default, it gets installed inside C:\Strawberry\perl\bin directory. Copy the path.

Now search for “env” in the Windows search bar until you find something called “Edit the system environment variable”.

env

Now click on “Environment Variables…”.

System Properties

Now select “Path” from “System variables” and click “Edit”.

System variables

Click “New”. Paste the path. Now exit every windows sequentially by clicking on “OK” in each window.

add var inside system path

Visual Code Studio Extensions

We need some extensions in VS Code to streamline our workflow.

First, let’s get LaTeX Workshop. It is the core extension for working with LaTeX files inside VS Code Studio.

Next, you’ll need Rewrap. It is an amazing tool that lets you wrap longer lines. It helps you work in a long line in separate lines without breaking any structure or sentence.

Build the LaTeX File

Whenever you want to build any LaTeX file inside VS Code studio, simply open that file in it. Then open the command palette using Ctrl + Shift + P.

Search for “LaTeX Workshop: Build with recipe” and go there. It will start building the file. Whenever it prompts you to install any missing package, untick the box that says “Always show this dialog” and press “Install”. I do this because clicking on “Install” on hundreds of prompt windows for building a LaTeX file is very difficult for me.

package installation

After it finishes building the LaTeX file, you will get the output PDF file inside VS Code. You can open the PDF file directly in VS Code.

If you want to go into any specific line in the code from the output PDF file like Overleaf, simply click on that specific portion in the PDF by pressing the Ctrl key. It will immediately take you to the code part where it belongs.

That’s it! It’s now running on your local machine and there are no restrictions or limitation to it, literally! Also, for collaboration and keeping track of the history, using Git is the best option, like I do.

Conclusion

Thanks for reading this short tutorial. I hope it helped you interact more easily with LaTeX.

You can follow me on GitHub, LinkedIn, and YouTube to get more content like this. Also, my website is always available for you!

0
Subscribe to my newsletter

Read articles from Md. Fahim Bin Amin directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Md. Fahim Bin Amin
Md. Fahim Bin Amin

Microsoft Research Investigation Contributor to OSS (GitHub: FahimFBA) | Software Engineer | Top Contributor 2022, 2023 @freeCodeCamp | ➡️http://youtube.com/@FahimAmin