How to write LaTeX documents using Visual Studio Code

You can use Visual Studio Code to edit LaTeX files on your machine. You can have the possibility to edit offline and you can use your git to manage versions or publish to an online repository.

For the ones who like to use LaTeX to create long files or to create papers, there is a good way to do it. Visual Studio Code is a good code editor to use for writing LaTeX files in MS Windows. This tutorial will be a good guide to configuring your system to create LaTeX files/projects.

First, you need to install MiKTeX which is a great tool to manage packages for TeX (just install the required packages, it is a good way to keep TeX installation as minimal as possible). Not just for managing packages, but also have programs, styles, fonts, and other requirements. In the alternative, you can use TeX Live.

Also, need to install a Perl environment. Once the objective is to edit LaTeX on MS Windows, I suggest using Strawberry Perl as a result of being created to be as similar as feasible to the Perl environment found on UNIX systems.

After that, you just need to install the LaTeX WorkShop extension on Visual Studio Code and start creating and editing files.

Parts Required

Install Miktex

1. Go to and download the installer.

2. Execute the installer. (You need to accept the terms and conditions to continue.)

3. Choose if you want to install it for all users or just for the current user.

4. Choose the location to install the files.

5. You need to select the paper type for default (A4 or Letter) and if you want to validate the library’s installation when you add a library for the first time on a project.

6. Just click “Start” to initiate the installation.

7. When the installation process stops proceed and check for updates.

8. After that you can close the installer.

NOTE 1: Opening the MiKTeX Console is another way to check for updates. After that, you need to select the “Updates” section and click on “Check for updates” to refresh the libraries you need to install and click on “Update now“.

Checking for updates and applying them.
Example of update progress.

NOTE 2: To prevent malfunctions of some libraries or packages, I recommend installing the Pygments package on Python to support some MiKTeX packages. For that, you need open a command line or Windows PowerShell and run: pip install Pygments.

Install Perl environment

1. Go to and download the installer.

2. Execute the installer file. (You need to accept the terms and conditions to continue.)

3. Choose the location to install the files.

4. Proceed with the installation process.

5. When the installation process finishes you can click on “Finish” to close the installer.

Install the extension on Visual Studio Code

To help with the LaTeX files edition and compilation, you need to install the “LaTeX Workshop” extension on Visual Studio Code.

1. Open the Visual Studio Code and go to the extensions section.

2. Search for latex and on “LaTeX Workshop” click on install.

3. When the installation finishes the extension page should be like this.

Creating a project example

To test the installation you create a simple project or document like this.

1. After creating a directory for your project like “SampleProject” and opening it on Visual Studio Code you can create a new “.tex” file (for example, “main.tex”).

2. Now you can edit your document the way you like. A simple way is using the sampling above where is used the “lipsum” library generates random text to fill in the space. To compile the file just click on the green play symbol like on the figure or “Ctrl+Alt+B“.







3. When it is compiling is possible that a pop-up will appear to validate the installation of the new libraries by MiKTeX.

4. To see the generated “.pdf” file, side by side with your “.tex” file, you can on the symbol shown below.

NOTE: Another way to see the generated “.pdf” file is open the “LaTeX Workshop” extension option (like shown below). In-ear you can select the compiler type you want to use.





[4] LaTeX: Generate dummy text (lorem ipsum) in your document – Mukesh Chapagain Blog

Leave a Reply

Your email address will not be published. Required fields are marked *

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock