avatarLen_dde

Summary

The website provides a step-by-step guide for setting up LaTeX in Visual Studio Code, including the installation of necessary software like MiKTeX and the LaTeX Workshop extension, and troubleshooting common issues.

Abstract

The article "Easy Setup of LaTeX in Visual Studio Code" addresses the common challenges faced by users when setting up LaTeX in Visual Studio Code (VSC). It offers a simplified approach to configure a LaTeX environment within VSC, ensuring that users can start writing LaTeX documents without extensive setup. The guide begins with the prerequisites, which include installing VSC and MiKTeX, and then proceeds through the process of installing essential VSC extensions such as Latex Workshop. It also suggests optional extensions for enhanced functionality. The article provides a basic "Hello World" LaTeX document template and instructions for compiling it into a PDF. Additionally, it troubleshoots a common "Perl" error by guiding users on how to change the default LaTeX builder recipe. The conclusion reassures readers that they now have a fully functional LaTeX environment in VSC and ends with a promotion for an AI service, ZAI.chat, as a cost-effective alternative to ChatGPT Plus.

Opinions

  • The author acknowledges the difficulty many users face with LaTeX setup and aims to provide a clear and straightforward guide.
  • MiKTeX is recommended as a preferred LaTeX distribution for Windows users.
  • The LaTeX Workshop extension is considered mandatory for LaTeX typesetting in Visual Studio Code.
  • The article emphasizes the ease of use and convenience of the described setup process.
  • Optional extensions like Latex Utilities, Citation Picker for Zotero, and LTeX are suggested to enhance the LaTeX writing experience.
  • The author provides a direct solution to a specific "Perl" error, indicating a common pitfall and its resolution.
  • The guide is tailored for users who prefer a minimal setup approach, focusing on essential tools and steps.
  • The conclusion includes a personal endorsement for ZAI.chat, implying satisfaction with the service and its value proposition compared to ChatGPT Plus.

Easy Setup of LaTeX in Visual Studio Code

How to setup latex with Visual stuido code

If you’ve been struggling to set up LaTeX in Visual Studio Code (VSC), you’re not alone. Many guides online can be overwhelming or don’t quite fit your needs. If you simply want to open a folder in VSC and start writing LaTeX without any setup beforehand, there’s a straightforward solution that worked for me, and I’m here to share it with you.

What You’ll Need

  • Visual Studio Code (VSC)
  • MiKTeX

Step-by-Step Guide

1. Install Visual Studio Code

First things first, make sure you have Visual Studio Code installed on your system. If not, you can download and install it from the official website: Visual Studio Code

2. Install MiKTeX

MiKTeX is a popular distribution of LaTeX for Windows. It provides the necessary tools and packages to compile LaTeX documents. You can download and install MiKTeX from its official website: MiKTeX

3. Visual Studio Code Extensions

Once you have both Visual Studio Code and MiKTeX installed, open Visual Studio Code on your system. Navigate to the extension store and install:

Mandatory: Latex Workshop

Optional:

  • Latex Utilities
  • Citation Picker for Zotero
  • LTeX — LanguageTool grammar/spell checking

4. Open Your LaTeX Folder

Navigate to the folder where you want to write your LaTeX documents. You can either open an existing LaTeX project or create a new folder for your LaTeX files.

Here’s a simple LaTeX “Hello World” document that you can use to get started. This document will create a PDF containing the phrase “Hello, World!” when compiled.

Create a new text file, name it hello_world.tex, and insert the following content:

\documentclass[12pt]{article}

\begin{document}

Hello, World!

\end{document}

5. Compile Your LaTeX Document

To compile your LaTeX document into a PDF, you can use the built-in LaTeX Workshop extension in Visual Studio Code. If you don’t have it installed already, you can find it in the Extensions view (Ctrl+Shift+X) by searching for “LaTeX Workshop” and install it.

Once installed, you can use the shortcut Ctrl+Alt+B to compile your LaTeX document into a PDF. Alternatively, you can use the command palette (Ctrl+Shift+P) and search for “Build LaTeX project”.

6. “Perl” error

If you are now receiving the above error — fear not! Simpliy switch your default latex builder recipe from latexmk to pdflatex.

In Visual Studio Code (VSC), you can open extension settings as JSON by following these steps:

  1. Open Visual Studio Code.
  2. Click on the gear icon (⚙️) in the lower-left corner to open the Settings menu.
  3. In the Settings menu, you’ll see a search bar at the top. Type “Extensions” into the search bar.
  4. Look for the “Extensions” section in the search results and click on it.
  5. Scroll down until you find the extension for which you want to modify settings. Click on it.
  6. You’ll see a list of settings for that extension. Look for the “Edit in settings.json” link on the right side and click on it.
  7. This will open the settings.json file with the settings for the selected extension.

Now you can change the receipe the following:

"latex-workshop.latex.recipes": [
  
  {
   "name": "pdflatex ➞ bibtex ➞ pdflatex × 2",
   "tools": [
    "pdflatex",
    "bibtex",
    "pdflatex",
    "pdflatex"
   ]
  }
 ],

 "latex-workshop.latex.recipe.default": "pdflatex ➞ bibtex ➞ pdflatex × 2",

Alternatively go to settings ( CMD+,) and search for latex-workshop recipes. There you can change the setting from “first” to “lastUsed” which allows you to still switch between the default receipes but remembers the lastUsed one.

Conclusion

Thats it. You should now have a working enviornment. Enjoy!

Latex
Latex Setup
Vscode
Visual Studio Code
Scientific Writing
Recommended from ReadMedium