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

Build error in document with BibTeX using ‘latexmk’ recipe #1137

Closed
leafac opened this issue Jan 22, 2019 · 13 comments
Closed

Build error in document with BibTeX using ‘latexmk’ recipe #1137

leafac opened this issue Jan 22, 2019 · 13 comments
Labels
enhancement Issue suggests an enhancement

Comments

@leafac
Copy link
Contributor

leafac commented Jan 22, 2019

Describe the bug
Build error in document with BibTeX using latexmk recipe.

To Reproduce
Steps to reproduce the behavior:

  1. Create a simple LaTeX project using BibTex:

    main.tex

    \documentclass{report}
    
    \begin{document}
      \cite{a-reference}
    
      \bibliographystyle{plain}
      \bibliography{bibliography}
    \end{document}

    bibliography.bib

    @inproceedings{a-reference,
    	title = {A Reference},
    	author = {Leandro Facchinetti},
    	year = {2019},
    }
  2. Open main.tex in VS Code, go to the TeX menu on the left, and then Build LaTeX project > Recipe: latexmk.

Expected behavior
Compilation should succeed.

Logs

LaTeX Workshop Output
[08:37:59] RECIPES command invoked.
[08:37:59] BUILD command invoked.
[08:37:59] Found root file from active editor: /private/tmp/bug-report/main.tex
[08:37:59] Root file remains unchanged from: /private/tmp/bug-report/main.tex.
[08:37:59] Building root file: /private/tmp/bug-report/main.tex
[08:37:59] Build root file /private/tmp/bug-report/main.tex
[08:37:59] Recipe step 1: latexmk, -synctex=1,-interaction=nonstopmode,-file-line-error,-pdf,-outdir=.,/private/tmp/bug-report/main
[08:38:00] LaTeX log parsed with 2 messages.
[08:38:00] Recipe returns with error: 12/null.
[08:38:00] Cleaning auxillary files and retrying build after toolchain error.
[08:38:00] CLEAN command invoked.
[08:38:00] Found root file from active editor: /private/tmp/bug-report/main.tex
[08:38:00] Root file remains unchanged from: /private/tmp/bug-report/main.tex.
[08:38:00] Found root file from active editor: /private/tmp/bug-report/main.tex
[08:38:00] Root file remains unchanged from: /private/tmp/bug-report/main.tex.
[08:38:00] File cleaned: /private/tmp/bug-report/main.fls
[08:38:00] File cleaned: /private/tmp/bug-report/main.aux
[08:38:00] File cleaned: /private/tmp/bug-report/main.log
[08:38:00] File cleaned: /private/tmp/bug-report/main.fdb_latexmk
[08:38:00] Recipe step 1: latexmk, -synctex=1,-interaction=nonstopmode,-file-line-error,-pdf,-outdir=.,/private/tmp/bug-report/main
[08:38:01] LaTeX log parsed with 2 messages.
[08:38:01] Recipe returns with error: 12/null.
LaTeX Compiler Output
Latexmk: This is Latexmk, John Collins, 17 Jan. 2018, version: 4.55.
Rule 'pdflatex': Rules & subrules not known to be previously run:
   pdflatex
Rule 'pdflatex': The following rules & subrules became out-of-date:
      'pdflatex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex  -synctex=1 -interaction=nonstopmode -file-line-error -recorder -output-directory="."  "/private/tmp/bug-report/main.tex"'
------------
Latexmk: applying rule 'pdflatex'...
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(/private/tmp/bug-report/main.tex
LaTeX2e <2018-04-01> patch level 2
Babel <3.18> and hyphenation patterns for 84 language(s) loaded.
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/report.cls
Document Class: report 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/size10.clo)) (./main.aux)

LaTeX Warning: Citation `a-reference' on page 1 undefined on input line 4.

No file main.bbl.
[1{/usr/local/texlive/2018/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./main.aux)

LaTeX Warning: There were undefined references.

 )</usr/local/texlive/2018/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></usr/local/texlive/2018/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on ./main.pdf (1 page, 17326 bytes).
SyncTeX written on ./main.synctex.gz.
Transcript written on ./main.log.
Latexmk: Non-existent bbl file 'main.bbl'
 No file main.bbl.
Latexmk: Log file says output to 'main.pdf'
Latexmk: List of undefined refs and citations:
  Citation `a-reference' on page 1 undefined on input line 4
=== TeX engine is 'pdfTeX'
Latexmk: Found bibliography file(s) [bibliography.bib]
Latexmk: Summary of warnings:
  Latex failed to resolve 1 citation(s)
Rule 'bibtex main': File changes, etc:
   Changed files, or newly in use since previous run(s):
      'main.aux'
   Non-existent destination files:
      'main.bbl'
------------
Run number 1 of rule 'bibtex main'
------------
Latexmk: applying rule 'bibtex main'...
For rule 'bibtex main', running '&run_bibtex(  )' ...
Use of chdir('') or chdir(undef) as chdir() is deprecated at /System/Library/Perl/5.18/darwin-thread-multi-2level/Cwd.pm line 507.
------------
Running 'bibtex  "main"'
------------
I couldn't open file name `main.aux'
Collected error summary (may duplicate other messages):
  bibtex main: Could not open bibtex log file for 'main'
Latexmk: Use the -f option to force complete processing,
 unless error was exceeding maximum runs of latex/pdflatex.
Latexmk: Errors, so I did not complete making targets
Developer Tools Console Nothing suspicious.

Desktop (please complete the following information):

  • OS: macOS Mojave 10.14.2
  • VS Code version: 1.30.2
  • Extension version: 5.20.2

Additional context

  • I can reproduce the problem by going to the command line and running the command that LaTeX-Workshop runs:

    $ latexmk -synctex=1 -interaction=nonstopmode -file-line-error -pdf -outdir=. /private/tmp/bug-report/main

    But if I change -outdir=. to the absolute path, then compilation succeeds:

    $ latexmk -synctex=1 -interaction=nonstopmode -file-line-error -pdf -outdir=/private/tmp/bug-report /private/tmp/bug-report/main
  • The other build recipe (pdflatex -> bibtex -> pdflatex*2) works.

@jlelong
Copy link
Collaborator

jlelong commented Jan 22, 2019

I cannot reproduce the problem. It probably has to do with your latexmk or LaTeX installation.
The line

I couldn't open file name `main.aux'

is surprising.

@leafac
Copy link
Contributor Author

leafac commented Jan 22, 2019

I’m running The MacTeX-2018 Distribution installed via the Homebrew Cask. I didn’t do anything fancy in configuration—neither in MacTeX nor in VS Code/LaTeX-Workshop. Can you suggest where I should start investigating?

@jlelong
Copy link
Collaborator

jlelong commented Jan 23, 2019

What is your version of latexmk?
From which directory, do you run the first command?

$ latexmk -synctex=1 -interaction=nonstopmode -file-line-error -pdf -outdir=. /private/tmp/bug-report/main

@leafac
Copy link
Contributor Author

leafac commented Jan 23, 2019

$ latexmk --version

Latexmk, John Collins, 17 Jan. 2018. Version 4.55
$ pwd # Note that in macOS ‘/tmp’ and ‘/private/tmp’ are synonyms
/tmp/bug-report
$ ls
bibliography.bib	main.tex

@jlelong
Copy link
Collaborator

jlelong commented Jan 23, 2019

I have latexmk 4.61. Could you try to update using TeX Live Utility.app?

@leafac
Copy link
Contributor Author

leafac commented Jan 23, 2019

Good call. I updated to latexmk 4.61 and it worked.

But it’d be better if LaTeX-Workshop worked out of the box with a fresh MacTeX installation. It seems like a minor modification to the default recipe to invoke latexmk with -outdir=<absolute-path> instead of -outdir=.; and the <absolute-path> is already available as part of the %DOC%.

@jlelong
Copy link
Collaborator

jlelong commented Jan 23, 2019

@leafac I somehow share your feeling on this. Actually, the behaviour of latexmk regarding relative outdir does not seem coherent across versions. I will change the code to use an absolute one instead.

@zoehneto
Copy link
Contributor

@jlelong it really seems that way, since in the original change I tested with ./ which worked for me but seems to break for many other people.

@jlelong
Copy link
Collaborator

jlelong commented Jan 23, 2019

@James-Yu Looking at this, I have the impression that setting latex-workshop.latex.outputDir to %DIR% would solve all our problems related to latexmk as %DIR% is the absolute path for .. I am not sure if it could have side effects, especially in the tests

if (outputDir !== './' && outputDir !== '.')

What do you think?

@miaodi
Copy link

miaodi commented Jan 23, 2019

I am suffering the same issue and my latexmk version is also 4.55.

The compiler says

I couldn't open file name prospectus.aux'`

@leafac
Copy link
Contributor Author

leafac commented Jan 24, 2019

Thanks for the fix and for this project in general—it’s great!

@SamP20
Copy link

SamP20 commented Jan 25, 2019

This fix unfortunately broke latexmk building with Docker. Before, it would do the right thing and place all output in the current working directory which in the container is the /data folder, but now it tries to put it into /data/c:/Users/<myusername>/etc... which is incorrect.

@jlelong jlelong reopened this Jan 25, 2019
@James-Yu
Copy link
Owner

Nice catch @SamP20 can you please confirm if the above fix does its job?

Repository owner locked as resolved and limited conversation to collaborators Oct 12, 2021
@tamuratak tamuratak added the enhancement Issue suggests an enhancement label Oct 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Issue suggests an enhancement
Projects
None yet
Development

No branches or pull requests

7 participants