8

I've installed TeX Live and Visual Studio Code with the LaTeX Workshop extension. Previously, I'd installed LyX. VSCode is looking at the LyX installation. I know this because I had an error complaining it couldn't find a library and it listed the LyX install directory. When I copied the folder from TeX Live to LyX's directory, that error went away. The problem is, I would prefer to use TeX Live. It already has packages I need installed. How can I get VSCode and the LaTeX extension to look at the TeX Live directory? I've looked at the settings and don't see anything that sets that path.

EDIT: I've tried following the information on James Wu's page but I am new to LaTeX and not succeeding. Note that I'm trying to follow instructions given here to format a poem. I am using the example from that article for my test.

My recipe is:

[  {
"name": "latexmk 🔃",
"tools": [
  "latexmk"
]   },  {     "name": "latexmk",
"command": "latexmk",
"args": [
  "-synctex=1",
  "-interaction=nonstopmode",
  "-file-line-error",
  "-pdf",
  "-outdir=%OUTDIR%",
  "%DOC%"
],
"env": {"TEXMFHOME": "c:/texlive/2019"}   } ]  

The errors I am getting are:

Latexmk: This is Latexmk, John Collins, 26 Dec. 2019, version: 4.67.
Latexmk: Changing directory to 'c:/Users/tuata/OneDrive/Documents/'
Rule 'pdflatex': The following rules & subrules became out-of-date:
      'pdflatex'
------------ Run number 1 of rule 'pdflatex'
------------
------------ Running 'pdflatex  --max-print-line=10000 -synctex=1 -interaction=nonstopmode -file-line-error -recorder -output-directory="c:/Users/tuata/OneDrive/Documents"  "texsample.tex"'
------------ Latexmk: applying rule 'pdflatex'... This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6630) entering extended
mode (c:/Users/tuata/OneDrive/Documents/texsample.tex LaTeX2e
<2017-04-15> Babel <3.18> and hyphenation patterns for 75 language(s)
loaded.

c:/Users/tuata/OneDrive/Documents/texsample.tex:1: LaTeX Error:
There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation. Type  H
<return>  for immediate help

c:/Users/tuata/OneDrive/Documents/texsample.tex:1: LaTeX Error:
Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation. Type  H
<return>  for immediate help

Overfull \hbox (20.0pt too wide) in paragraph at lines 1--5 [] 

c:/Users/tuata/OneDrive/Documents/texsample.tex:6: LaTeX Error:
There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation. Type  H
<return>  for immediate help

c:/Users/tuata/OneDrive/Documents/texsample.tex:6: LaTeX Error:
Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation. Type  H
<return>  for immediate help

Overfull \hbox (20.0pt too wide) in paragraph at lines 6--26 [] 

c:/Users/tuata/OneDrive/Documents/texsample.tex:27: LaTeX Error:
There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation. Type  H
<return>  for immediate help

c:/Users/tuata/OneDrive/Documents/texsample.tex:27: LaTeX Error:
Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation. Type  H
<return>  for immediate help ) ! Emergency stop !  ==> Fatal error
occurred, no output PDF file produced! Transcript written on
c:/Users\tuata\OneDrive\Documents\texsample.log. Latexmk: Summary of
warnings from last run of (pdf)latex:   =====Latex reported missing or
unavailable character(s).
=====See log file for details. Collected error summary (may duplicate other messages):   pdflatex: Command for 'pdflatex' gave return code 1
      Refer to 'c:/Users/tuata/OneDrive/Documents/texsample.log' for details Latexmk: Undoing directory change
=== TeX engine is 'pdfTeX' Latexmk: Errors, so I did not complete making targets Latexmk: Use the -f option to force complete
processing,  unless error was exceeding maximum runs, or warnings
treated as errors.

Here is the sample code I am using:

\\poemtitle{Pied Beauty}
\\begin{poem}
\\begin{stanza}
G\\textsc{lory} be to God for dappled things--- \\verseline
\\verseindent For skies of couple-colour as a brinded cow; \\verseline
\\verseindent\\verseindent For rose-moles all in stipple upon trout that swim;\\verseline
Fresh-firecoal chestnut-falls; finches’ wings;\\verseline
\\verseindent Landscape plotted and pieced—fold, fallow, and plough;\\verseline
\\verseindent\\verseindent And all trades, their gear and tackle and trim.\\verseline
\\end{stanza}
\\begin{stanza}
All things counter, original, spare, strange;\\verseline
\\verseindent Whatever is fickle, freckled (who knows how?)\\verseline
\\verseindent\\verseindent With swift, slow; sweet, sour; adazzle, dim;\\verseline
He fathers-forth whose beauty is past change:\\verseline
\\versephantom{He fathers-}Praise him.
\\end{stanza}
\\end{poem}
8
  • Have a look here: github.com/James-Yu/LaTeX-Workshop/wiki/…
    – DG'
    Commented Jan 30, 2020 at 23:12
  • I've tried doing what I think this is telling me, but I'm failing miserably. I'm going to edit my question to include more info. Commented Jan 31, 2020 at 2:26
  • Please post the code you used. And: are you using single or double backslashes, i.e. \\documentclass{article} or \documentclass{article}?
    – DG'
    Commented Jan 31, 2020 at 6:08
  • @DG' I added the code. I'm using double backslashes. Commented Jan 31, 2020 at 16:27
  • 1
    This has wandered away from my original question. I've figured that out, so I will post that as an answer. Thanks for your help. Commented Feb 1, 2020 at 23:58

1 Answer 1

4

I figured out how to change the path. In VSCode, click on Extensions (the icon with the 4 boxes). Then select LaTeX Workshop and click on Settings. Scroll down to Latex Workshop -> Latex: Tools. Click on "Edit Settings in Json" and type in the following:

[
  {
    "name": "latexmk",
    "tools": [
      "latexmk"
    ]
  },
  {
    "name": "latexmk",
    "command": "latexmk",
    "args": [
      "-synctex=1",
      "-interaction=nonstopmode",
      "-file-line-error",
      "-pdf",
      "-outdir=%OUTDIR%",
      "%DOC%"
    ],
    "env": {"TEXMFHOME": "c:/texlive/2019"}
  }
] 

Set your TEXFMHOME path as needed. Save. This should get you the installation you want.

1
  • 1
    I just found the existing latexmk blurb and added the path that shows up under `which latex' to its env, and now it works! Commented Jun 3, 2022 at 18:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .