Nicholas Brandt
Nicholas Brandt

Reputation: 374

Specify the file to be compiled in VSCode Latex Workshop

I have a folder with two .tex files, say a.tex and b.tex opened in VSCode. When launching Recipe: latexmk (Latex Workshop extension) from the Commands tab, or Ctrl+Alt+B, it always compiles a.tex even when b.tex is focused in the editor.

How do I specify which .tex file I'd like to be compiled, if not by focusing in the editor?

Upvotes: 7

Views: 15487

Answers (2)

Nicholas Brandt
Nicholas Brandt

Reputation: 374

Actually, the answer can be found here: https://github.com/James-Yu/LaTeX-Workshop/wiki/Compile

My personal issue was that my b.tex file does not contain \begin{document} which Latex Workshop looks for when automatically finding the root file.

Upvotes: 6

finder2
finder2

Reputation: 1084

According to the documentation They search in multiple steps:

  1. magic comment % !TEX root =path to root.tex -> I recommend to put it in every tex-file to assure the right file is used
  2. the file with \documentclass[...]{...}
  3. ...

Upvotes: 6

Related Questions