- Analysis
Version info: VS code:1.50.0, Tex Live:2019/Debian, LaTex Workshop:8.13.2 - Action
Make sure your operation is correct by referencing to official guideline and VS Code + LaTeX.- Install TexLive: TeXLive即LaTeX的编译环境, Use
latex --help
orlatex -version
to check the installation status and result. For me, I just usedsudo apt install texlive-latex-base
to install it. - Install LaTex Workshop Plugin
- PATH related, Does the executable exist?
See the OUTPUT of LaTex Workshop and got:
- Install TexLive: TeXLive即LaTeX的编译环境, Use
[16:26:14] BUILD command invoked.
[16:26:14] Current workspace folders: ["file:///home/shane/repo/hello-world"]
[16:26:14] Current workspaceRootDir: /home/shane/repo/hello-world
[16:26:14] Found root file from active editor: /home/shane/repo/hello-world/toExplore/LaTex/template/IS2019_paper_kit/IS2019_paper_kit/LaTeX/template.tex
[16:26:14] Keep using the same root file: /home/shane/repo/hello-world/toExplore/LaTex/template/IS2019_paper_kit/IS2019_paper_kit/LaTeX/template.tex.
[16:26:14] Building root file: /home/shane/repo/hello-world/toExplore/LaTex/template/IS2019_paper_kit/IS2019_paper_kit/LaTeX/template.tex
[16:26:14] Build root file /home/shane/repo/hello-world/toExplore/LaTex/template/IS2019_paper_kit/IS2019_paper_kit/LaTeX/template.tex
[16:26:14] Recipe step 1: latexmk, -synctex=1,-interaction=nonstopmode,-file-line-error,-pdf,-outdir=/home/shane/repo/hello-world/toExplore/LaTex/template/IS2019_paper_kit/IS2019_paper_kit/LaTeX,/home/shane/repo/hello-world/toExplore/LaTex/template/IS2019_paper_kit/IS2019_paper_kit/LaTeX/template
[16:26:14] cwd: /home/shane/repo/hello-world/toExplore/LaTex/template/IS2019_paper_kit/IS2019_paper_kit/LaTeX
[16:26:14] LaTeX build process spawned. PID: undefined.
[16:26:14] LaTeX fatal error: spawn latexmk ENOENT, . PID: undefined.
[16:26:14] Does the executable exist? PATH: /home/shane/anaconda3/bin:/home/shane/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
[16:26:14] The current SHELL: /bin/bash
- Solution
From Github, this seems to be correct solution shown as below,
Replicating the value of
PATH
in theenv
field of the plugin recipe resolves the issue. For some reason, it looks like VSCode does not retrieve the $PATH from the shell. I did not have this issue until today, quite possibly until the latest VSCode update, released this morning (GMT).(https://github.com/James-Yu/LaTeX-Workshop/issues/1742)
But how to replicate the value of PATH in the env field of the plugin recipe?
[201027] Make it work
After uninstalled texlive-latex-base by sudo apt-get autoremove --purge texlive-latex-base
, and re-install texlive 2020, I got ‘Command ‘tex’ not found’ when I type tex --version
.
Then I followed guideline texlive-en.pdf, and the following lines to ‘$HOME/.profile’:
PATH=/usr/local/texlive/2020/bin/x86_64-linux:$PATH; export PATH
MANPATH=/usr/local/texlive/2020/texmf-dist/doc/man:$MANPATH; export MANPATH
INFOPATH=/usr/local/texlive/2020/texmf-dist/doc/info:$INFOPATH; export INFOPATH
Then I run source ~/.profile
to reload .profile
And read version was succeeded.
Then I installed LaTex workshop in VS code, and it run well.
Lesson learn
- Follow guide of Latex Workshop instead of thinking it by yourself. For me, I just made a mistake in installing Tex Live.