Contents

Setting Up a Local LaTeX Environment: Build Your Own Overleaf with TeX Live and VS Code

The cover image was created by the author and features the $\LaTeX$, TeX Live, and VS Code logos.

Have you ever been frustrated by Overleaf’s compilation timeouts? Or encountered network issues that prevented you from compiling online? Maybe you’re a beginner learning to typeset with $\LaTeX$? This article will guide you step by step through installing TeX Live on your own computer and using VS Code as your $\LaTeX$ editor.

What is $\LaTeX$?

$\LaTeX$ is a typesetting system based on $\TeX$. Unlike common word processors such as Microsoft Word or Google Docs, $\LaTeX$ does not use a graphical interface for formatting. Instead, users write documents through lines of commands.
The first version of $\LaTeX$ was released in 1984 by American computer scientist Leslie Lamport, whose goal was to “free users from the hassle of typesetting.” Even users without background knowledge in design or programming can easily produce well-formatted documents with $\LaTeX$.

$\LaTeX$ supports not only mathematical equations, figures, and tables, common in mathematics, physics, and engineering, but also offers packages for music notation, chess, and other typesetting tasks. It features convenient tools such as cross-referencing, bibliographic citation, and automatic table of contents generation. Because of these strengths, $\LaTeX$ is widely used in academia and publishing.

Unlike visual editors, $\LaTeX$ follows a content–format separation principle. This means users cannot immediately preview their formatted results, they must compile the .tex file with a $\LaTeX$ compiler first. The benefit of this approach is that .tex files are lightweight, version-control friendly, and ensure consistent formatting across platforms.

As mentioned above, $\LaTeX$ is particularly suited for academic papers, reports, and technical documentation. For general users, graphical editors might still be more convenient. However, beginners who need to format academic reports can try free online tools such as Overleaf, which lowers the learning curve and avoids setup issues with local compilers.

In the following sections, we’ll start by installing TeX Live, and then set up VS Code as our $\LaTeX$ text editor.

Installing TeX Live

First, visit https://tug.org/texlive/acquire-iso.html to download the required software.

Step 1: Click installing TeX Live over the Internet.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/1.png

Step 2: Download the installer corresponding to your operating system. Here, using Windows 11 as an example, click install-tl-windows.exe.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/2.png

Step 3: Open the TeX Live installer you just downloaded. If prompted by security warnings, click More info.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/3.png

Step 4: Click Run anyway.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/4.png

Step 5: Click Install.

Step 6: Click Next >.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/5.png

Step 7: Click Install.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/6.png

Wait for the installer to initialize.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/7.png

Once the installer interface appears, you can begin the installation.

Step 8: Click Advanced.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/8.png

Step 9: Choose the installation root directory; modification is not required.

Step 10: Click Customize.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/9.png

Step 11: Select the languages you will use when writing $\LaTeX$, then click OK.
Typically, at minimum, choose Chinese, CJK (Chinese/Japanese/Korean - basic), and English.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/11.png

Step 12: If no other adjustments are needed, click Install.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/12.png

Wait for the installation to complete. The installer will download the necessary files from the internet and install them.
Make sure your internet connection remains stable during this process. The installation does not consume much bandwidth, so you can continue using your computer normally.
Note that the installation can take a long time, depending on your chosen options, it may take 3 to 5 hours.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/13.png

When you see running package-specific postactions and the installation screen no longer updates, the installation is likely complete.
At this point, you can check the installation directory for the log files to confirm that the installation has finished.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/14.png

Step 13: Navigate to the installation folder, typically located at installation-root/texlive/2025/.

Step 14: Open the install-tl.log file.

Step 15: Check for messages indicating the installation is complete and a welcome message.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/15.png

Step 16: Click Close to exit the TeX Live installer.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/16.png

Step 17: Click Close.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/17.png

Step 18: Open a terminal, such as Command Prompt, and enter:

1
latex -v

Check that information about the LaTeX compiler is displayed. If nothing appears, you may need to set up environment variables. See Steps 19 to 27 for instructions.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/19.png

Step 19: Open Settings by clicking the icon or using the shortcut Win + i, then navigate to System > About.

Step 20: Click Advanced system settings.

Step 21: Click Environment Variables.

Step 22: Under System variables, select Path.

Step 23: Click Edit.

Step 24: Check whether the TeX Live installation directory is listed, which should look like installation-root\texlive\2025\bin\windows.
If it is not present, click New and add the path manually.

Step 25: Click OK.

Step 26: Click OK.

Step 27: Click OK.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/20.png

Editing in VS Code

Before you start editing .tex files in VS Code, you need to install the necessary extensions to use the LaTeX compiler you just installed.

Step 1: Click Extensions.

Step 2: In the search box, type LaTeX.

Step 3: Click the LaTeX Workshop extension.

Step 4: Click Install.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/21.png

Step 5: Click Trust the publisher and install.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/22.png

After the extension is installed, you still need to configure it to use the compiler you just installed.

Step 6: Click Manage.

Step 7: Click Settings.

Step 8: Click Open Settings (JSON).

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/23.png

This is VS Code’s JSON settings file.
Add a comma at the end of the second-to-last line, then on a new line, add the following content:

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
    "latex-workshop.hover.preview.enabled": true,
    "latex-workshop.latex.autoBuild.run": "onSave",
    "latex-workshop.showContextMenu": true,
    "latex-workshop.intellisense.package.enabled": true,
    "latex-workshop.message.error.show": false,
    "latex-workshop.message.warning.show": false,
    "latex-workshop.latex.tools": [
        {
            "name": "xelatex",
            "command": "D:/Program Files/texlive/2025/bin/windows/xelatex.exe",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOCFILE%"
            ]
        },
        {
            "name": "pdflatex",
            "command": "D:/Program Files/texlive/2025/bin/windows/pdflatex.exe",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOCFILE%"
            ]
        },
        {
            "name": "latexmk",
            "command": "D:/Program Files/texlive/2025/bin/windows/latexmk.exte",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-pdf",
                "-outdir=%OUTDIR%",
                "%DOCFILE%"
            ]
        },
        {
            "name": "bibtex",
            "command": "bibtex",
            "args": [
                "%DOCFILE%"
            ]
        },
        {
            "name": "biber",
            "command": "biber",
            "args": [
                "%DOCFILE%"
            ]
        }
    ],
    "latex-workshop.latex.recipes": [
        {
            "name": "pdflatex -> bibtex -> pdflatex*2",
            "tools": [
                "pdflatex",
                "bibtex",
                "pdflatex",
                "pdflatex"
            ]
        },
        {
            "name": "XeLaTeX",
            "tools": [
                "xelatex"
            ]
        },
        {
            "name": "PDFLaTeX",
            "tools": [
                "pdflatex"
            ]
        },
        {
            "name": "BibTeX",
            "tools": [
                "bibtex"
            ]
        },
        {
            "name": "LaTeXmk",
            "tools": [
                "latexmk"
            ]
        },
        {
            "name": "xelatex -> bibtex -> xelatex*2",
            "tools": [
                "xelatex",
                "bibtex",
                "xelatex",
                "xelatex"
            ]
        },
        {
            "name": "xelatex -> biber -> xelatex*2",
            "tools": [
                "xelatex",
                "biber",
                "xelatex",
                "xelatex"
            ]
        },
        
    ],
    "latex-workshop.latex.clean.fileTypes": [
        "*.aux",
        "*.bbl",
        "*.blg",
        "*.idx",
        "*.ind",
        "*.lof",
        "*.lot",
        "*.out",
        "*.toc",
        "*.acn",
        "*.acr",
        "*.alg",
        "*.glg",
        "*.glo",
        "*.gls",
        "*.ist",
        "*.fls",
        "*.log",
        "*.fdb_latexmk"
    ],
    "latex-workshop.latex.autoClean.run": "onFailed",
    "latex-workshop.latex.recipe.default": "lastUsed",
    "latex-workshop.view.pdf.internal.synctex.keybinding": "double-click",
    "latex-workshop.view.pdf.viewer": "external",
    "latex-workshop.view.pdf.ref.viewer":"auto",
    "latex-workshop.view.pdf.external.viewer.args": [
        "%PDF%"
    ],
    "latex-workshop.view.pdf.external.synctex.args": [
        "-forward-search",
        "%TEX%",
        "%LINE%",
        "-reuse-instance",
        "-inverse-search",
        "\"D:/Users/user/AppData/Local/Programs/Microsoft VS Code/Code.exe\" \"D:/Users/user/AppData/Local/Programs/Microsoft VS Code/resources/app/out/cli.js\" -r -g \"%f:%l\"",
        "%PDF%"
    ]

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/25.png

Step 9: Modify the build target.
In principle, you can simply enter xelatex, pdflatex, or latexmk, but sometimes the compiler may fail to launch. In such cases, you need to specify its absolute path.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/26.png

Also update the related VS Code paths accordingly.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/27.png

Now you can start editing your documents.

Step 10: Create and open a .tex file. A $\TeX$ icon will appear on the left sidebar.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/28.png

Once you have finished writing your $\LaTeX$ document, you can start compiling.

Step 11: Click the $\TeX$ icon.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/29.png

Step 12: In Build LaTeX project, select the compilation method you want to use.

During compilation, you can also monitor the progress in the lower-left corner.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/30.png

If you encounter issues during compilation, you can check for errors and warnings.

Step 13: Click Warnings and Info in the lower-left corner.

Step 14: View the Warnings and Info under the Problems tab.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/31.png

After successful compilation, you can view the output.

Step 15: Click View LaTeX PDF and choose either View in VS Code tab or View in browser.

The compiled PDF file will be located in the same directory as the .tex file.

https://raw.githubusercontent.com/Josh-test-lab/website-assets-repository/refs/heads/main/posts/Setting%20Up%20a%20Local%20LaTeX%20Environment%20Build%20Your%20Own%20Overleaf%20with%20TeX%20Live%20and%20VS%20Code/32.png

Conclusion

$\LaTeX$ is a powerful and convenient typesetting system for academic documents. It not only produces aesthetically pleasing and consistent formatting across different platforms, but also greatly simplifies issues commonly encountered with equation formatting in other editors.
Although you may encounter various challenges during the installation process, having a local environment allows unlimited compilation time, offering greater flexibility and convenience compared to using Overleaf alone.

References

Warning
The last update time of this article is November 3, 2025, and the content may be outdated. Please be aware. If you notice any errors or broken images, feel free to leave a comment for corrections.