Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong path formatting in Windows leads to build error #1897

Closed
funnym0nk3y opened this issue Jan 9, 2020 · 15 comments
Closed

Wrong path formatting in Windows leads to build error #1897

funnym0nk3y opened this issue Jan 9, 2020 · 15 comments
Labels
external issue Issue with something else than LaTeX-Wokshop

Comments

@funnym0nk3y
Copy link

funnym0nk3y commented Jan 9, 2020

Hey,

I'm using version 8.5.0 with VS Code 1.41 on Windows 10. When building my project with pdflatex everything works fine, but when using luatexmk the build fails with an error "Undefined control sequence". I tried several solutions an it seems the bug is in the path formatting on windows. luatex expects the %DOC% to be formatted according to the format used on Linux (/), but the placeholder %DOC% returns the path formatted like on Windows (\). pdflatex does not seem to mind.

Greetings
funnym0nk3y

@jlelong jlelong added the bug Issue identified by LW maintainers as bug label Jan 9, 2020
@jlelong
Copy link
Collaborator

jlelong commented Jan 10, 2020

To help us identify where this is happening, can you post the logs of the extension?

@jlelong jlelong added need more info More information needed to identify the issue and removed bug Issue identified by LW maintainers as bug labels Jan 10, 2020
@funnym0nk3y
Copy link
Author

Sure!

That's the complete log when I try to build through the recipe latexmk (lualatex).

Latexmk: This is Latexmk, John Collins, 26 Dec. 2019, version: 4.67.
Rule 'lualatex': The following rules & subrules became out-of-date:
      'lualatex'
------------
Run number 1 of rule 'lualatex'
------------
------------
Running 'lualatex  -synctex=1 -interaction=nonstopmode -file-line-error -recorder -output-directory="c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis"  "c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\BA_MA_NameOfStudent.tex"'
------------
Latexmk: applying rule 'lualatex'...
This is LuaTeX, Version 1.10.0 (TeX Live 2019/W32TeX) 
 restricted system commands enabled.
! Undefined control sequence.
<*> "c:\Users
          \Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\BA_MA_Nam...
! Undefined control sequence.
<*> "c:\Users\Michael
                  \Google Drive\KIT\Bachelorarbeit\bachelor_thesis\BA_MA_Nam...
! Undefined control sequence.
<*> "c:\Users\Michael\Google
                          Drive\KIT\Bachelorarbeit\bachelor_thesis\BA_MA_Nam...
! Undefined control sequence.
<*> "c:\Users\Michael\Google Drive\KIT
                                   \Bachelorarbeit\bachelor_thesis\BA_MA_Nam...
! Undefined control sequence.
<*> "c:\Users\Michael\Google Drive\KIT\Bachelorarbeit
                                                  \bachelor_thesis\BA_MA_Nam...
! Undefined control sequence.
<*> ...chael\Google Drive\KIT\Bachelorarbeit\bachelor
                                                  _thesis\BA_MA_NameOfStuden...
! Undefined control sequence.
<*> ...le Drive\KIT\Bachelorarbeit\bachelor_thesis\BA
                                                  _MA_NameOfStudent.tex"
! I can't find file `c:Drive_thesis_MA_NameOfStudent.tex'.
<*> ...rbeit\bachelor_thesis\BA_MA_NameOfStudent.tex"
                                                  
(Press Enter to retry, or Control-Z to exit)
Please type another input file name
! Emergency stop.
<*> ...rbeit\bachelor_thesis\BA_MA_NameOfStudent.tex"
                                                  
 241 words of node memory still in use:
   35 glue_spec nodes
   avail lists: 2:12,3:1,4:1,5:1
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on texput.log.
Latexmk: fls file doesn't appear to have been made.
Collected error summary (may duplicate other messages):
  lualatex: Command for 'lualatex' gave return code 1
      Refer to 'c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis/BA_MA_NameOfStudent.log' for details
Latexmk: Errors, so I did not complete making targets
----------------------
This message may duplicate earlier message.
Latexmk: Failure in processing file 'c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis/BA_MA_NameOfStudent':
   (Pdf)LaTeX didn't generate the expected log file 'c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis/BA_MA_NameOfStudent.log'
----------------------
Latexmk: Use the -f option to force complete processing,
 unless error was exceeding maximum runs, or warnings treated as errors.
C:\texlive\2019\bin\win32\runscript.tlu:907: command failed with exit code 12:
perl.exe c:\texlive\2019\texmf-dist\scripts\latexmk\latexmk.pl -synctex=1 -interaction=nonstopmode -file-line-error -lualatex "-outdir=c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis" "c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis/BA_MA_NameOfStudent"

As far as I understand latexmk and the logfile it invokes the command:

lualatex  -synctex=1 -interaction=nonstopmode -file-line-error -recorder -output-directory="c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis"  "c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\BA_MA_NameOfStudent.tex"

When I change the last option of the command from \ to / everything works:

lualatex  -synctex=1 -interaction=nonstopmode -file-line-error -recorder -output-directory="c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis"  "c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis/BA_MA_NameOfStudent.tex"

A short research indicates that Lua has a problem with \ because it is used as a escape sequence. Maybe that's the explanation why pdflatex does not care.

@jlelong
Copy link
Collaborator

jlelong commented Jan 10, 2020

A short research indicates that Lua has a problem with \ because it is used as a escape sequence. Maybe that's the explanation why pdflatex does not care.

Yes. That's the issue for sure.

I will look into it. As you can see, the -output-directory directory already uses /. We must have missed a conversion somewhere in the code.

@jlelong
Copy link
Collaborator

jlelong commented Jan 11, 2020

You pasted the logs of the compiler. I would rather need the logs of the extension and the values of latex-workshop.latex.recipes and latex-workshop.latex.recipes.

@funnym0nk3y
Copy link
Author

I did not change the defaults of the extension, but I got them anyway. Here you go:
latex-workshop.latex.recipes

"latex-workshop.latex.recipes": [
    {
      "name": "latexmk 🔃",
      "tools": [
        "latexmk"
      ]
    },
    {
      "name": "latexmk (latexmkrc)",
      "tools": [
        "latexmk_rconly"
      ]
    },
    {
      "name": "latexmk (lualatex)",
      "tools": [
        "lualatexmk"
      ]
    },
    {
      "name": "pdflatex ➞ bibtex ➞ pdflatex × 2",
      "tools": [
        "pdflatex",
        "bibtex",
        "pdflatex",
        "pdflatex"
      ]
    }
  ]

And I think you need latex-workshop.latex.tools:

"latex-workshop.latex.tools": [
    {
      "name": "latexmk",
      "command": "latexmk",
      "args": [
        "-synctex=1",
        "-interaction=nonstopmode",
        "-file-line-error",
        "-pdf",
        "-outdir=%OUTDIR%",
        "%DOC%"
      ],
      "env": {}
    },
    {
      "name": "lualatexmk",
      "command": "latexmk",
      "args": [
        "-synctex=1",
        "-interaction=nonstopmode",
        "-file-line-error",
        "-lualatex",
        "-outdir=%OUTDIR%",
        "%DOC%"
      ],
      "env": {}
    },
    {
      "name": "latexmk_rconly",
      "command": "latexmk",
      "args": [
        "%DOC%"
      ],
      "env": {}
    },
    {
      "name": "pdflatex",
      "command": "pdflatex",
      "args": [
        "-synctex=1",
        "-interaction=nonstopmode",
        "-file-line-error",
        "%DOC%"
      ],
      "env": {}
    },
    {
      "name": "bibtex",
      "command": "bibtex",
      "args": [
        "%DOCFILE%"
      ],
      "env": {}
    }
  ]

Unfortunately I don't know how to get the logs of the extension.

@jlelong
Copy link
Collaborator

jlelong commented Jan 12, 2020

To get the logs of the extension, from the TeX panel (on the left)

View log messages -> View LaTeX Workshop extension logs

@funnym0nk3y
Copy link
Author

Thanks!
This is the log when I invoke the lualatex command:

[16:18:08] Linter for active file started.
[16:18:08] Linter for active file running command chktex with arguments -wall,-n22,-n30,-e16,-q,-I0,-f%f:%l:%c:%d:%k:%n:%m

[16:18:08] Found root file from active editor: c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\BA_MA_NameOfStudent.tex
[16:18:08] Root file remains unchanged from: c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\BA_MA_NameOfStudent.tex.
[16:18:09] Linter for active file successfully finished in 1s 434ms
[16:18:09] Linter log parsed with 10 messages.
[16:18:21] RECIPES command invoked.
[16:18:21] BUILD command invoked.
[16:18:21] Found root file from active editor: c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\BA_MA_NameOfStudent.tex
[16:18:21] Root file remains unchanged from: c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\BA_MA_NameOfStudent.tex.
[16:18:21] Building root file: c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\BA_MA_NameOfStudent.tex
[16:18:21] Build root file c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\BA_MA_NameOfStudent.tex
[16:18:21] Recipe step 1: latexmk, -synctex=1,-interaction=nonstopmode,-file-line-error,-lualatex,-outdir=c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis,c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis/BA_MA_NameOfStudent
[16:18:21] LaTeX build process spawned. PID: 22384.
[16:18:25] LaTeX log parsed with 10 messages.
[16:18:25] Recipe returns with error: 12/null. PID: 22384. message: Latexmk: This is Latexmk, John Collins, 26 Dec. 2019, version: 4.67.
Rule 'lualatex': The following rules & subrules became out-of-date:
      'lualatex'
------------
Run number 1 of rule 'lualatex'
------------
------------
Running 'lualatex  -synctex=1 -interaction=nonstopmode -file-line-error -recorder -output-directory="c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis"  "c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\BA_MA_NameOfStudent.tex"'
------------
Latexmk: fls file doesn't appear to have been made.
Collected error summary (may duplicate other messages):
  lualatex: Command for 'lualatex' gave return code 1
      Refer to 'c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis/BA_MA_NameOfStudent.log' for details
----------------------
This message may duplicate earlier message.
Latexmk: Failure in processing file 'c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis/BA_MA_NameOfStudent':
   (Pdf)LaTeX didn't generate the expected log file 'c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis/BA_MA_NameOfStudent.log'
----------------------
Latexmk: Use the -f option to force complete processing,
 unless error was exceeding maximum runs, or warnings treated as errors.
C:\texlive\2019\bin\win32\runscript.tlu:907: command failed with exit code 12:
perl.exe c:\texlive\2019\texmf-dist\scripts\latexmk\latexmk.pl -synctex=1 -interaction=nonstopmode -file-line-error -lualatex "-outdir=c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis" "c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis/BA_MA_NameOfStudent"
.
[16:18:25] Cleaning auxillary files and retrying build after toolchain error.
[16:18:25] File cleaned: c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\BA_MA_NameOfStudent.aux
[16:18:25] File cleaned: c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\BA_MA_NameOfStudent.fdb_latexmk
[16:18:25] File cleaned: c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\texput.fls
[16:18:25] File cleaned: c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\texput.log
[16:18:25] Recipe step 1: latexmk, -synctex=1,-interaction=nonstopmode,-file-line-error,-lualatex,-outdir=c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis,c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis/BA_MA_NameOfStudent
[16:18:25] LaTeX build process spawned. PID: 24808.
[16:18:27] LaTeX log parsed with 10 messages.
[16:18:27] Recipe returns with error: 12/null. PID: 24808. message: Latexmk: This is Latexmk, John Collins, 26 Dec. 2019, version: 4.67.
Rule 'lualatex': The following rules & subrules became out-of-date:
      'lualatex'
------------
Run number 1 of rule 'lualatex'
------------
------------
Running 'lualatex  -synctex=1 -interaction=nonstopmode -file-line-error -recorder -output-directory="c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis"  "c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\BA_MA_NameOfStudent.tex"'
------------
Latexmk: fls file doesn't appear to have been made.
Collected error summary (may duplicate other messages):
  lualatex: Command for 'lualatex' gave return code 1
      Refer to 'c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis/BA_MA_NameOfStudent.log' for details
----------------------
This message may duplicate earlier message.
Latexmk: Failure in processing file 'c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis/BA_MA_NameOfStudent':
   (Pdf)LaTeX didn't generate the expected log file 'c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis/BA_MA_NameOfStudent.log'
----------------------
Latexmk: Use the -f option to force complete processing,
 unless error was exceeding maximum runs, or warnings treated as errors.
C:\texlive\2019\bin\win32\runscript.tlu:907: command failed with exit code 12:
perl.exe c:\texlive\2019\texmf-dist\scripts\latexmk\latexmk.pl -synctex=1 -interaction=nonstopmode -file-line-error -lualatex "-outdir=c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis" "c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis/BA_MA_NameOfStudent"
.
[16:18:27] File cleaned: c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\BA_MA_NameOfStudent.aux
[16:18:27] File cleaned: c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\texput.fls
[16:18:27] File cleaned: c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\texput.log
[16:18:27] File cleaned: c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\BA_MA_NameOfStudent.fdb_latexmk

@jlelong
Copy link
Collaborator

jlelong commented Jan 12, 2020

Actually, the paths passed to latexmk are using / and not \

Recipe step 1: latexmk, -synctex=1,-interaction=nonstopmode,-file-line-error,-lualatex,-outdir=c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis,c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis/BA_MA_NameOfStudent

and then latexmk calls lualatex with \

Running 'lualatex  -synctex=1 -interaction=nonstopmode -file-line-error -recorder -output-directory="c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis"  "c:\Users\Michael\Google Drive\KIT\Bachelorarbeit\bachelor_thesis\BA_MA_NameOfStudent.tex"'

The issue seems to be related to latexmk. Can you check that directly running

 latexmk -lualatex -outdir="c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis" "c:/Users/Michael/Google Drive/KIT/Bachelorarbeit/bachelor_thesis/BA_MA_NameOfStudent"

from the command line produces the same error? I cannot see anything we can do from the extension side to fix this.

@funnym0nk3y
Copy link
Author

Yeah, you are right! Totally forgot to check that. latexmk changes / to \ for whatever reason... Unfortunately I can't find a repo to report this bug to... Anyway, thanks for your help!

@jlelong
Copy link
Collaborator

jlelong commented Jan 13, 2020

Maybe you can send a mail to the maintainer jcc8@psu.edu
See the latexmk home page

@jlelong jlelong closed this as completed Jan 13, 2020
@jlelong jlelong added external issue Issue with something else than LaTeX-Wokshop and removed need more info More information needed to identify the issue labels Jan 13, 2020
@funnym0nk3y
Copy link
Author

funnym0nk3y commented Jan 13, 2020

Short workaround by John Collins:

Add the line $MSWin_back_slash = 0; to the .latexmkrc file in the users home directory. If the file does not exist, create a new one. Furthermore I could make the command work when separating the options with spaces instead of , and adding -e '$MSWin_back_slash=0;' between latexmk
and the options.

Maybe there will be a command-line option for that or even a change to the default.

EDIT:
John Collins says, we will get a CLI option in the next release.

@funnym0nk3y
Copy link
Author

I'd like to reopen this issue: Since version 8.6.0 the path separator used to call the latexmk command uses inconsistent path separators. -outdir uses \ while the path uses /

@jlelong
Copy link
Collaborator

jlelong commented Jan 16, 2020

Since e372e2b, the paths have been normalised to always use / even on Windows. This was done after release 8.6.0. Could you check that the development version works well? See https://github.com/James-Yu/LaTeX-Workshop/blob/master/CONTRIBUTING.md for how to do so.

If you still find issues, please post the logs (extension and compiler).

@zareami10

This comment has been minimized.

@tamuratak

This comment has been minimized.

Repository owner locked as resolved and limited conversation to collaborators May 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
external issue Issue with something else than LaTeX-Wokshop
Projects
None yet
Development

No branches or pull requests

4 participants