# Could somebody give me a tutorial for setting up LaTex Workshop in VS Code on Windows 10?

Unfortunately all information I can find is merely for macOS or Linux and I haven't been able to translate the solutions to my Windows 10 system.

I'm trying to set up LaTeX in VS Code on Windows 10 but I keep getting:

``````latexmk: The script engine could not be found.
latexmk: Data: scriptEngine="perl.exe", scriptName="latexmk"
``````

I installed the LaTeX Workshop extension for VS Code as well as TeX Live and `C:\texlive\2018\bin\win32` is part of my `PATH` environment variable.

• I don't use `latexmk`. There are many available recipes there, you can even define some new recipes through `settings.json`. Define a recipe named e.g. `pdflatex`, and use that recipe to compile your documents
– user156344
Apr 20, 2019 at 2:22

## 3 Answers

In order to use LaTeX Workshop in VS Code on Windows you need to download and install Perl. After downloading and installing the extension should be able to compile your document. You might also need to then install the `latexmk` package, but I am not sure.

I personally have Strawberry Perl installed on my PC, but Active Perl should work just as well for this.

In the link you posted titled "information" following the answer given by K. Paul should solve your problem in Windows.

• Thank you, however, now I get this error message upon trying to build a project: `Can't spawn "pdflatex -synctex=1 -interaction=nonstopmode -file-line-error -recorder -output-directory="c:/Users/chris/Downloads" "c:\Users\chris\Downloads\u14.tex"": Inappropriate I/O control operation at C:\Users\chris\AppData\Local\Programs\MiKTeX 2.9\scripts/latexmk\latexmk.pl line 9616. Latexmk: fls file doesn't appear to have been made.` Any idea what's the problem here? Mar 20, 2019 at 21:44
• Are you able to compile your file in a different program like texstudio? Mar 20, 2019 at 22:32

Your first link is the correct one for windows but unfortunately as often happens was hijacked by other users populist answers and then it snowballs so you can't see the key bits of advise.

Heini is describing MiKTeX but his comments would apply to Tex Live. That is you don't need to download Perl or Latexmk as such since TeX Live includes Perl and Latexmk especially since you are finding they may interfere with what should be simple basic compilation runs.

EQUALLY IGNORE his reference to download anything else such as his suggestion for synctex 1) it is already built into tex live 2) there is an issue with windows workshop extension and synctex that's undergoing current changes so lets wait.

Presuming you are at a command line (Cortana task bar = C + enter or WIN+C+Enter)

To check where Perl should be run> `where /r \ perl` and the response should be something like

c:\texlive\2018\tlpkg\tlperl\bin\perl.exe

So to call Perl you should have that bin directory early on path as well as the main bin.

Back to your question VS Code is an IDE so edit and save the u14.TeX

TeX Live is a suite of compilers and make commands so you can run say >
`PdfLaTeX "c:\Users\chris\Downloads\u14.tex"`
and presuming no errors makes `"c:\Users\chris\Downloads\u14.pdf"` simples

Back to your problem Latexmk tries to run several passes of the make comands in effect it is a script kiddie on caffeine and employs the Perl environment to run in so first test is ignore it and check you can manually run pdfLaTeX on your file as above proving that Tex Live is not an issue. now try at cmd>

``````pdflatex -synctex=1 -interaction=nonstopmode -file-line-error -recorder -output-directory="c:/Users/chris/Downloads" "c:\Users\chris\Downloads\u14.tex"
``````

That is what latexmk is trying to "shell" out to and if it does not work at the command line the errors should be relayed to you by latexmk

Depending on your variant of TeX Live you should have the default editor (TeXworks) installed at `c:\texlive\2018\tlpkg\texworks\texworks.exe` which is a native TeX editor with PDF viewer and can be used for comparison purposes to check fairly complex TeX compilations.

One way to avoid using latexmk should be to have the compilation directives at the start of the tex file(s) so in this case the first line of u14.tex would be.

``````% !TEX options = -synctex=1 -interaction=nonstopmode -file-line-error "%DOC%"
``````

note that does NOT include the latexmk -recorder option and that may be why you are having an issue see latexmk -recorder doesn't find .fls file containing pdflatex process ID in its name

Download and install https://mirror.ctan.org/systems/texlive/tlnet/install-tl-windows.exe. This distribution of LaTeX will contain everything needed to use LaTeX Workshop in VSCode / VSCodium when doing the full installation. After the installation completes, you should be able to use LaTeX Workshop without issues.

In case you decide to only do a partial installation, make sure to also install the additionally required packages. Otherwise, the build might fail and will tell you which tools or packages are missing. For example, `latexmk` and `xstring` must be installed. This can be done easily using the Tex Live Manager program.

• Thanks. A complete installation of TeXLive did work, even though it took more than an hour to install in my case. I also found that I need to restart my PC to make LaTeX Workshop work after the installation. Jan 10 at 13:31
• @chjch - I'm pretty sure that you don't need to re-boot the computer, but you'd have to restart vscode / vscodium in order for LaTeX Workshop to pick up on the newly installed TexLive. hth Jan 11 at 14:37