Latex-workshop: bibtex couldn't open .aux file

Created on 17 Apr 2020  Â·  6Comments  Â·  Source: James-Yu/LaTeX-Workshop

Preliminary questions [Required]

Disable all the other extensions except for LaTeX Workshop, and check that you still see this issue. [Required]

You still see this issue?: Yes

Make sure to visit the wiki FAQ before filling an issue.

You visited the wiki?: Yes

If your issue is with compiling a document (not having to do with finding the root file of a project), check first that you can compile manually.

You can compile a TeX document manually?: Yes

Describe the bug [Required]

After I added --output-directory option to xelatex, bibtex reported an error saying I couldn't open file name 'template.aux'.

Output directory is ./Tmp

 "latex-workshop.latex.outDir": "%DIR%/Tmp",

And my recipe is as follows

        {
            "name": "xelatex ➞ bibtex ➞ xelatex`×2",
            "tools": [
                "xelatex",
                "bibtex",
                "xelatex",
                "xelatex"
            ]
        }

latex-workshop.latex.tools are

        {
            "name": "xelatex",
            "command": "xelatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "--output-directory=%OUTDIR%",
                "%DOC%"
            ],
            "env": {}
        },
        {
            "name": "bibtex",
            "command": "bibtex",
            "args": [
                "%DOCFILE%"
            ],
            "env": {}
        }

When I set "latex-workshop.latex.outDir": "%DIR%", everything works fine.

I think the problem is that bibtex couldn't find the .aux file in the root directory. How do I set the arguments of bibtex? I don't see any placeholder that meets my need.

Logs [Required]

Please paste the whole log messages here, not parts of ones. It is very important to identify problems.

LaTeX Workshop Output [Required]


LaTeX Workshop extension log

[12:52:23] Initializing LaTeX Workshop.
[12:52:23] Creating file watcher for .pdf files.
[12:52:24] Creating LaTeX Workshop http and websocket server.
[12:52:24] LaTeX Workshop initialized.
[12:52:24] Found root file from active editor: c:\Users\Tonakai\Desktop\test\template.tex
[12:52:24] Root file changed from: undefined to c:\Users\Tonakai\Desktop\test\template.tex. Find all dependencies.
[12:52:24] Instantiating a new file watcher for c:\Users\Tonakai\Desktop\test\template.tex
[12:52:24] Creating file watcher for .bib files.
[12:52:24] Parsing c:\Users\Tonakai\Desktop\test\template.tex
[12:52:24] Found .bib file c:\Users\Tonakai\Desktop\test\ref.bib
[12:52:24] Adding .bib file c:\Users\Tonakai\Desktop\test\ref.bib to bib file watcher.
[12:52:24] Parsing .bib entries from c:\Users\Tonakai\Desktop\test\ref.bib
[12:52:24] Parse fls file.
[12:52:24] Cannot find fls file.
[12:52:25] Server created on 127.0.0.1:3036
[12:52:25] Adding c:\Users\Tonakai\Desktop\test\template.tex to file watcher.
[12:52:25] Parsed 10 bib entries from c:\Users\Tonakai\Desktop\test\ref.bib.
[12:52:25] Found root file from active editor: c:\Users\Tonakai\Desktop\test\template.tex
[12:52:25] Root file remains unchanged from: c:\Users\Tonakai\Desktop\test\template.tex.
[12:52:25] Snippet data loaded.
[12:52:25] LaTeX Workshop version: 8.8.0
[12:52:34] RECIPES command invoked.
[12:52:34] BUILD command invoked.
[12:52:34] Found root file from active editor: c:\Users\Tonakai\Desktop\test\template.tex
[12:52:34] Root file remains unchanged from: c:\Users\Tonakai\Desktop\test\template.tex.
[12:52:34] Building root file: c:\Users\Tonakai\Desktop\test\template.tex
[12:52:34] Build root file c:\Users\Tonakai\Desktop\test\template.tex
[12:52:34] Recipe step 1: xelatex, -synctex=1,-interaction=nonstopmode,-file-line-error,--output-directory=c:\Users\Tonakai\Desktop\test\Tmp,c:/Users/Tonakai/Desktop/test/template
[12:52:34] cwd: c:\Users\Tonakai\Desktop\test
[12:52:34] LaTeX build process spawned. PID: 18848.
[12:52:36] LaTeX log parsed with 2 messages.
[12:52:36] A step in recipe finished. PID: 18848.
[12:52:36] Recipe step 2: bibtex, template
[12:52:36] cwd: c:\Users\Tonakai\Desktop\test
[12:52:36] LaTeX build process spawned. PID: 20008.
[12:52:37] Recipe returns with error: 1/null. PID: 20008. message: .
[12:52:37] Cleaning auxillary files and retrying build after toolchain error.
[12:52:37] File cleaned: c:\Users\Tonakai\Desktop\test\Tmp\template.aux
[12:52:37] File cleaned: c:\Users\Tonakai\Desktop\test\Tmp\template.log
[12:52:37] Recipe step 1: xelatex, -synctex=1,-interaction=nonstopmode,-file-line-error,--output-directory=c:\Users\Tonakai\Desktop\test\Tmp,c:/Users/Tonakai/Desktop/test/template
[12:52:37] cwd: c:\Users\Tonakai\Desktop\test
[12:52:37] LaTeX build process spawned. PID: 19356.
[12:52:40] LaTeX log parsed with 2 messages.
[12:52:40] A step in recipe finished. PID: 19356.
[12:52:40] Recipe step 2: bibtex, template
[12:52:40] cwd: c:\Users\Tonakai\Desktop\test
[12:52:40] LaTeX build process spawned. PID: 11356.
[12:52:40] Recipe returns with error: 1/null. PID: 11356. message: .
[12:52:42] Found root file from active editor: c:\Users\Tonakai\Desktop\test\template.tex
[12:52:42] Root file remains unchanged from: c:\Users\Tonakai\Desktop\test\template.tex.
[12:52:48] LOG command invoked.
[12:52:49] Found root file from active editor: c:\Users\Tonakai\Desktop\test\template.tex
[12:52:49] Root file remains unchanged from: c:\Users\Tonakai\Desktop\test\template.tex.

LaTeX compiler log:

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

Desktop [Required]

  • OS: Windows 10
  • VS Code version: 1.44.1
  • Extension version: 8.8.0
  • TeX distribution version: TeX Live 2019

Additional questions

Are you using LaTeX Workshop with VS Code Remote?

No

duplicate enhancement

Most helpful comment

It might be related to #2010. Please wait for the next release.

All 6 comments

This is because the .aux file is located under ./Tmp directory.
In bibtex args, try to use %OUTDIR%/%DOCFILE%. Note that all compiling commands are launched from the root file directory.

I've tried this before and that didn't work. %OUTDIR%/%DOCFILE% pops up an error saying bibtex couldn't open .blg file.

LaTeX complier log:

I couldn't open file name `c:\Users\Tonakai\Desktop\test\Tmp/template.blg'

bibtex.exe: Not writing to c:\Users\Tonakai\Desktop\test\Tmp/template.blg (openout_any = p).

Here's the extension log:

[13:32:22] BUILD command invoked.
[13:32:22] Found root file from active editor: c:\Users\Tonakai\Desktop\test\template.tex
[13:32:22] Root file remains unchanged from: c:\Users\Tonakai\Desktop\test\template.tex.
[13:32:22] Building root file: c:\Users\Tonakai\Desktop\test\template.tex
[13:32:22] Build root file c:\Users\Tonakai\Desktop\test\template.tex
[13:32:23] Recipe step 1: xelatex, -synctex=1,-interaction=nonstopmode,-file-line-error,--output-directory=c:\Users\Tonakai\Desktop\test\Tmp,c:/Users/Tonakai/Desktop/test/template
[13:32:23] cwd: c:\Users\Tonakai\Desktop\test
[13:32:23] LaTeX build process spawned. PID: 7236.
[13:32:28] LaTeX log parsed with 2 messages.
[13:32:28] A step in recipe finished. PID: 7236.
[13:32:28] Recipe step 2: bibtex, c:\Users\Tonakai\Desktop\test\Tmp/template
[13:32:28] cwd: c:\Users\Tonakai\Desktop\test
[13:32:28] LaTeX build process spawned. PID: 4788.
[13:32:29] Recipe returns with error: 1/null. PID: 4788. message: 
bibtex.exe: Not writing to c:\Users\Tonakai\Desktop\test\Tmp/template.blg (openout_any = p).
.
[13:32:29] Cleaning auxillary files and retrying build after toolchain error.
[13:32:29] File cleaned: c:\Users\Tonakai\Desktop\test\Tmp\template.aux
[13:32:29] File cleaned: c:\Users\Tonakai\Desktop\test\Tmp\template.log
[13:32:29] Recipe step 1: xelatex, -synctex=1,-interaction=nonstopmode,-file-line-error,--output-directory=c:\Users\Tonakai\Desktop\test\Tmp,c:/Users/Tonakai/Desktop/test/template
[13:32:29] cwd: c:\Users\Tonakai\Desktop\test
[13:32:29] LaTeX build process spawned. PID: 21196.
[13:32:32] LaTeX log parsed with 2 messages.
[13:32:32] A step in recipe finished. PID: 21196.
[13:32:32] Recipe step 2: bibtex, c:\Users\Tonakai\Desktop\test\Tmp/template
[13:32:32] cwd: c:\Users\Tonakai\Desktop\test
[13:32:32] LaTeX build process spawned. PID: 21388.
[13:32:33] Recipe returns with error: 1/null. PID: 21388. message: 
bibtex.exe: Not writing to c:\Users\Tonakai\Desktop\test\Tmp/template.blg (openout_any = p).
.

I did not notice that you were using Windows, you may need to use \ instead of /.
Try %OUTDIR%\\%DOCFILE%

I also tried %OUTDIR%\\%DOCFILE% as well but the same error occurred.

I couldn't open file name `c:\Users\Tonakai\Desktop\test\Tmp\template.blg'

bibtex.exe: Not writing to c:\Users\Tonakai\Desktop\test\Tmp\template.blg (openout_any = p).

It might be related to #2010. Please wait for the next release.

It is indeed. Meanwhile you could use latexmk with the -xelatex option, see #1170

Was this page helpful?
0 / 5 - 0 ratings