Please fill the following fields with a star (*) and provide as much related information as possible.
Pre-checks*
Please change the following [ ] to [x] for confirmation.
- [x ] The issue has not been reported in this repository.
- [x ] The issue remains after disabling all other extensions and restarting Visual Studio Code.
- [x ] The FAQ cannot address the issue.
- [x ] The issue is not related to compiling a document, or the document can be successfully compiled in the OS terminal but not in Visual Studio Code with this extension.
Environment*
Please write exact version numbers instead of descriptors such as latest.
- Operating System: Windows 11
- Visual Studio Code Version: 1.136.1
- LaTeX Workshop Version: 10.18.0
- TeX Distribution Version: MiKTeX 4.14
The Issue*
Please briefly describe the issue you come across.
Unable to build using latexmk with -lualatex option using magic comments because of the way arguments get parsed and passed to latexmk.
Reproduction Steps
Please list out the steps to reproduce your bug. Include relevant environmental variables or any other configuration.
- Create a simple file with the following header
%!TEX program = latexmk
%!TEX options = -lualatex -synctex=1 -interaction=nonstopmode -file-line-error "%DOC%"
- Trigger compilation by the extension
- Confirm it fails
Expected Behavior
What were you expecting to see? Include any relevant examples or documentation links.
Should simply compile, without issues.
Logs
LaTeX Workshop Output*
Please paste the whole log messages below, not parts of ones. The log should start with New log placeholder %WS1% registered.
[13:20:44.957][Extension] onDidSaveTextDocument triggered: file:///c:/Users/AngeloPaiva/Git/imaestro-one/docs/user-manual/main.tex
[13:20:45.038][Cacher][Watcher] "change" emitted on file:///c:/Users/AngeloPaiva/Git/imaestro-one/docs/user-manual/main.tex.
[13:20:45.039][Cacher] Caching %WS1%\docs\user-manual\main.tex .
[13:20:45.040][Build] Auto build started detecting the change of a file: %WS1%\docs\user-manual\main.tex .
[13:20:45.040][Event] AUTO_BUILD_INITIATED: {"type":"onFileChange","file":"c:\\Users\\AngeloPaiva\\Git\\imaestro-one\\docs\\user-manual\\main.tex"}
[13:20:45.040][Build][Executor] The document of the active editor: file:///c:/Users/AngeloPaiva/Git/imaestro-one/docs/user-manual/main.tex
[13:20:45.040][Build][Executor] The languageId of the document: latex
[13:20:45.041][Event] FILE_CHANGED: "file:///c:/Users/AngeloPaiva/Git/imaestro-one/docs/user-manual/main.tex"
[13:20:45.042][Build][Executor] Building root file: %WS1%\docs\user-manual\main.tex
[13:20:45.044][Build][Recipe] Build root file %WS1%\docs\user-manual\main.tex
[13:20:45.052][Build][Recipe] Found TeX program by magic comment: latexmk.
[13:20:45.052][Build][Recipe] Found TeX options by magic comment: -lualatex -synctex=1 -interaction=nonstopmode -file-line-error "%DOC%".
[13:20:45.055][Build][Executor] RootFile auxDir: c:/Users/AngeloPaiva/Git/imaestro-one/docs/user-manual .
[13:20:45.061][Build][Step] Recipe step 1 The command is latexmk:["--max-print-line=10000 \"-lualatex -synctex=1 -interaction=nonstopmode -file-line-error \"c:/Users/AngeloPaiva/Git/imaestro-one/docs/user-manual/main\"\""].
[13:20:45.061][Build][Step] env: undefined
[13:20:45.062][Build][Step] root: %WS1%\docs\user-manual\main.tex
[13:20:45.062][Build][Step] cwd: %WS1%\docs\user-manual
[13:20:45.067][Build][Step] LaTeX build process spawned with PID 17636.
[13:20:45.117][Cacher] Input %WS1%\docs\user-manual\introduction.tex from %WS1%\docs\user-manual\main.tex .
[13:20:45.140][Cacher] Input %WS1%\docs\user-manual\developing-robots.tex from %WS1%\docs\user-manual\main.tex .
[13:20:45.141][Cacher] Updated inputs of %WS1%\docs\user-manual\main.tex .
[13:20:45.141][Cacher] Parse LaTeX AST: %WS1%\docs\user-manual\main.tex .
[13:20:45.145][Cacher] Parsed LaTeX AST in 3.55 ms: %WS1%\docs\user-manual\main.tex .
[13:20:45.146][File] kpsewhich cache hit on report.cls: C:/Users/AngeloPaiva/AppData/Local/Programs/MiKTeX/tex/latex/base/report.cls .
[13:20:45.147][Cacher] Updated elements in 1.27 ms: %WS1%\docs\user-manual\main.tex .
[13:20:45.148][Event] FILE_PARSED: "c:\\Users\\AngeloPaiva\\Git\\imaestro-one\\docs\\user-manual\\main.tex"
[13:20:45.179][Structure] Structure force updated with 2 root sections for %WS1%\docs\user-manual\main.tex .
[13:20:45.180][Event] STRUCTURE_UPDATED
[13:20:45.534][Build][Step] Recipe returns with error code 10/null on PID 17636.
[13:20:45.534][Build][Step] Does the executable exist? $PATH: undefined, $Path: C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Global Libs\poppler\Library\bin;C:\Program Files (x86)\Nodist\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\KeePassXC\;C:\Program Files\Docker\Docker\resources\bin;C:\StrawberryPerl\c\bin;C:\StrawberryPerl\perl\site\bin;C:\StrawberryPerl\perl\bin;C:\Users\AngeloPaiva\.local\bin;C:\Users\AngeloPaiva\AppData\Local\Microsoft\WindowsApps;C:\Users\AngeloPaiva\AppData\Local\JetBrains\Toolbox\scripts;C:\Users\AngeloPaiva\AppData\Local\PowerToys\DSCModules\;C:\Users\AngeloPaiva\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\AngeloPaiva\.dotnet\tools;C:\Users\AngeloPaiva\AppData\Roaming\Python\Scripts;C:\Users\AngeloPaiva\AppData\Local\Python\bin;C:\Users\AngeloPaiva\AppData\Local\Microsoft\WinGet\Packages\evilmartians.lefthook_Microsoft.Winget.Source_8wekyb3d8bbwe;C:\Users\AngeloPaiva\.dotnet\tools;C:\Users\AngeloPaiva\AppData\Local\Programs\MiKTeX\miktex\bin\x64\, $SHELL: undefined
[13:20:45.534][Build][Step] Initial Win CP for (console input, console output, system): (CP850, CP65001, CP1252)
I changed them all to CP1252
Rc files read (in order):
NONE
Latexmk: Bad options specified
Use
latexmk -help
to get usage information
[13:20:45.534][Build][Step] Latexmk: -lualatex -synctex=1 -interaction=nonstopmode -file-line-error c:/Users/AngeloPaiva/Git/imaestro-one/docs/user-manual/main unknown option
Reverting Windows console CPs to (in,out) = (850,65001)
[13:20:45.535][Build][Plan] Cleaning auxiliary files and retrying build after toolchain error.
[13:20:45.536][Cleaner] Clean temporary files command The command is latexmk:["-outdir=c:/Users/AngeloPaiva/Git/imaestro-one/docs/user-manual","-auxdir=c:/Users/AngeloPaiva/Git/imaestro-one/docs/user-manual","-c","c:\\Users\\AngeloPaiva\\Git\\imaestro-one\\docs\\user-manual\\main.tex"].
[13:20:45.923][Build][Step] Recipe step 1 The command is latexmk:["--max-print-line=10000 \"-lualatex -synctex=1 -interaction=nonstopmode -file-line-error \"c:/Users/AngeloPaiva/Git/imaestro-one/docs/user-manual/main\"\""].
[13:20:45.924][Build][Step] env: undefined
[13:20:45.924][Build][Step] root: %WS1%\docs\user-manual\main.tex
[13:20:45.924][Build][Step] cwd: %WS1%\docs\user-manual
[13:20:45.926][Build][Step] LaTeX build process spawned with PID 19088.
[13:20:46.348][Build][Step] Recipe returns with error code 10/null on PID 19088.
[13:20:46.348][Build][Step] Does the executable exist? $PATH: undefined, $Path: C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Global Libs\poppler\Library\bin;C:\Program Files (x86)\Nodist\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\KeePassXC\;C:\Program Files\Docker\Docker\resources\bin;C:\StrawberryPerl\c\bin;C:\StrawberryPerl\perl\site\bin;C:\StrawberryPerl\perl\bin;C:\Users\AngeloPaiva\.local\bin;C:\Users\AngeloPaiva\AppData\Local\Microsoft\WindowsApps;C:\Users\AngeloPaiva\AppData\Local\JetBrains\Toolbox\scripts;C:\Users\AngeloPaiva\AppData\Local\PowerToys\DSCModules\;C:\Users\AngeloPaiva\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\AngeloPaiva\.dotnet\tools;C:\Users\AngeloPaiva\AppData\Roaming\Python\Scripts;C:\Users\AngeloPaiva\AppData\Local\Python\bin;C:\Users\AngeloPaiva\AppData\Local\Microsoft\WinGet\Packages\evilmartians.lefthook_Microsoft.Winget.Source_8wekyb3d8bbwe;C:\Users\AngeloPaiva\.dotnet\tools;C:\Users\AngeloPaiva\AppData\Local\Programs\MiKTeX\miktex\bin\x64\, $SHELL: undefined
[13:20:46.349][Build][Step] Initial Win CP for (console input, console output, system): (CP850, CP65001, CP1252)
I changed them all to CP1252
Rc files read (in order):
NONE
Latexmk: Bad options specified
Use
latexmk -help
to get usage information
[13:20:46.349][Build][Step] Latexmk: -lualatex -synctex=1 -interaction=nonstopmode -file-line-error c:/Users/AngeloPaiva/Git/imaestro-one/docs/user-manual/main unknown option
Reverting Windows console CPs to (in,out) = (850,65001)
LaTeX Compiler
Initial Win CP for (console input, console output, system): (CP850, CP65001, CP1252)
I changed them all to CP1252
Rc files read (in order):
NONE
Latexmk: Bad options specified
Use
latexmk -help
to get usage information
Latexmk: -lualatex -synctex=1 -interaction=nonstopmode -file-line-error c:/Users/AngeloPaiva/Git/imaestro-one/docs/user-manual/main unknown option
Reverting Windows console CPs to (in,out) = (850,65001)
Anything Else?
Checking the logs we can very easily see what is happening:
[13:20:45.923][Build][Step] Recipe step 1 The command is latexmk:["--max-print-line=10000 \"-lualatex -synctex=1 -interaction=nonstopmode -file-line-error \"c:/Users/AngeloPaiva/Git/imaestro-one/docs/user-manual/main\"\""].
The magic options part gets put between quotes and latexmk interprets it as a single string (as expected), which triggers the bad option error.
Pre-checks*
Environment*
The Issue*
Unable to build using latexmk with
-lualatexoption using magic comments because of the way arguments get parsed and passed to latexmk.Reproduction Steps
Expected Behavior
Should simply compile, without issues.
Logs
LaTeX Workshop Output*
LaTeX Compiler
Anything Else?
Checking the logs we can very easily see what is happening:
The magic options part gets put between quotes and latexmk interprets it as a single string (as expected), which triggers the bad option error.