thomasjo / atom-latex

Compile LaTeX or knitr documents from within Atom
https://atom.io/packages/latex
MIT License
223 stars 42 forks source link

Output Directory not working on Windows 10 #409

Closed maecky closed 2 years ago

maecky commented 7 years ago

First of all, I want to say thank you for the awesome work you are doing. I like the plugin a lot but today I ran into an issue:

I want my generated files to be redirected to a folder called "build". Therefore, I put "build" into the "Output Directory" settings.

On Windows 10 with Latesmk version 4.52c this is not working. The folder gets created in my project but then an error occurs:

TeXification failed with status code 2 and output of "Latexmk: This is Latexmk, John Collins, 19 Jan. 2017, version 4.52c.

Latexmk: making output directory 'build'

Cannot write file 'build/S:\Documents\LatexTemplates\Report\main.aux'
"
Parsing of log files failed.

The odd thing is, the S:\Documents\LatexTemplates\Report\build got created but after that, somehow the path gets messed up?

yitzchak commented 7 years ago

This could be a latexmk bug. The most recent version (change log) has a note about changing the handling of output directories. Given that I would suggest upgrading if possible.

maecky commented 7 years ago

Thanks for your answer. I did update latexmk, the issue stays the same. Tried it with texlive and miktex (manually installed the latest version of latexmk).

yitzchak commented 7 years ago

Is S: a network drive or a removable drive?

You could also try executing latexmk from the command line to help determine if it is a latexmk or a atom-latex issue. From a command shell try:

S:
cd Documents\LatexTemplates\Report
latexmk -pdf -outdir=build main.tex
stale[bot] commented 7 years ago

This issue has been marked as stale because due to inactivity. It will be closed in 7 days if no further activity occurs.

maecky commented 7 years ago

Sorry for the late response:

S: is a VeraCrypt volume.

I tried your suggested command from a command line. From there everything works perfectly fine (except the PDF file stays in the build folder but I suppose that's supposed to be?). That means, it seems to be an atom-latex issue?

yitzchak commented 7 years ago

Is the VeraCrypt volume a physical drive?

Also, can you try using the DiCy builder so we can see if the issue is builder specific?

maecky commented 7 years ago

No, the VeraCrypt volume is a file that is mounted.

The DiCy builder works (sometimes). All files are generated in the .build folder and then 3 files are copied to the root: main.pdf main.gz main.yaml

If I delete the .build folder and the generated files, I have to restart Atom - otherwise, the files aren't created again. There is no error message, it just doesn't work after deleting the files and folders.

avonmoll commented 7 years ago

I'm getting a similar issue on Windows 7. I was getting status code 1 (could not find scriptEngine: perl.exe), but after adding perl path to atom-latex settings I'm getting status code 2 with a similar error as OP.

Basically it looks like latexmk prepends the build directory instead of appending: Cannot write file 'build/C:\Users\-----\-----\manuscript.aux'

Running latexmk manuscript.tex -pdf -auxdir=dir works fine from terminal.


Edit: Note that removing Output Directory setting in atom-latex allows build to proceed properly


Edit2: I suspect it has to do with jobState.jobName. I can produce a similar error by calling latexmk with arguments like this package does and setting -jobname=/path/to/manuscript. Since latexmk argument -cd is passed, the path portion of the jobname is superfluous.


Edit3: Ignore Edit2, jobName is irrelevant. The error appears to be a latexmk bug. This package calls latexmk like this:

latexmk -interaction=nonstopmode -f -cd -file-line-error -synctex=1 -pdf -outdir="build" "C:\Users\---\---\manuscript.tex"

I confirmed this fails with the same error when calling from terminal. However, the following works:

latexmk -interaction=nonstopmode -f -cd -file-line-error -synctex=1 -pdf -outdir="build" C:/Users/---/---/manuscript.tex

Note the quotes are removed from the file and the direction of slashes is changed. I'm not sure if this package can or should handle this case :/

stale[bot] commented 6 years ago

This issue has been marked as stale because due to inactivity. It will be closed in 7 days if no further activity occurs.