James-Yu / LaTeX-Workshop

Boost LaTeX typesetting efficiency with preview, compile, autocomplete, colorize, and more.
MIT License
10.57k stars 526 forks source link

Latexmk with Latex-Workshop is running different then from the terminal #4043

Closed Vasco-Da-Gama-png closed 11 months ago

Vasco-Da-Gama-png commented 11 months ago

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.
  • [ ] 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 10 with Docker Debian based image
  • Visual Studio Code Version: 1.83.1
  • LaTeX Workshop Version: 9.14.1
  • TeX Distribution Version: TeX Live 2023

Please list the environment and version number if you are using VSCodium, Snap or Flatpack versions of Visual Studio Code, and/or Visual Studio Code Remote Containers/SSH/WSL.

  • I am using Dev Containers whose version is 0.315.1

The Issue*

Please briefly describe the issue you come across.

  • My problem is, that my latexmk results differ from invoking via Latex-Workshop or the VSC terminal with the same command.
  • My settings for latexmk are stored in the file .latexmkrc and are the following:
    
    #!/bin/env perl

This file contains instructions and configurations for the latexmk program.

That program is somewhat like make, but tailored to LaTeX.

LaTeX has a distinct characteristic of regularly requiring multiple runs of

the same program (e.g. lualatex) before the build is finished.

It's a multi-pass system.

In the intermediary runs, latex generates auxiliary files responsible for resolving

references, links, tables of content etc.

latexmk knows about these dependencies (otherwise we tell it in this very config

file, see below), detects these and runs latex (and other, outside programs)

accordingly.

Now, why do we need both latexmk and make?

Both automate builds.

latexmk is not powerful enough to cover all use cases.

make is more general and more suitable to be integrated in CI.

For our latex needs, make basically only delegates to latexmk.

We do not call e.g. lualatex multiple times manually from make:

this logic is left to latexmk and .latexmkrc.

However, make can also do much more, e.g. cover pandoc, clean-up operations etc.

Therefore, make and latexmkrc together are just super powerful and useful.

The shebang at the top is only to get syntax highlighting right across GitLab,

GitHub and IDEs.

This file is not meant to be run, but read by latexmk.

======================================================================================

Perl latexmk configuration file

======================================================================================

======================================================================================

PDF Generation/Building/Compilation

======================================================================================

PDF-generating modes are:

1: pdflatex, as specified by $pdflatex variable (still largely in use)

2: postscript conversion, as specified by the $ps2pdf variable (useless)

3: dvi conversion, as specified by the $dvipdf variable (useless)

4: lualatex, as specified by the $lualatex variable (best)

5: xelatex, as specified by the $xelatex variable (second best)

$pdf_mode = 1;

Treat undefined references and citations as well as multiply defined references as

ERRORS instead of WARNINGS.

This is only checked in the last run, since naturally, there are undefined references

in initial runs.

This setting is potentially annoying when debugging/editing, but highly desirable

in the CI pipeline, where such a warning should result in a failed pipeline, since the

final document is incomplete/corrupted.

#

However, I could not eradicate all warnings, so that latexmk currently fails with

this option enabled.

Specifically, microtype fails together with fontawesome/fontawesome5, see:

https://tex.stackexchange.com/a/547514/120853

The fix in that answer did not help.

Setting verbose=silent to mute microtype warnings did not work.

Switching between fontawesome and fontawesome5 did not help.

$warnings_as_errors = 0;

Show used CPU time. Looks like: https://tex.stackexchange.com/a/312224/120853

$show_time = 1;

Default is 5; we seem to need more owed to the complexity of the document.

Actual documents probably don't need this many since they won't use all features,

plus won't be compiling from cold each time.

$max_repeat=7;

--shell-escape option (execution of code outside of latex) is required for the

'svg' package.

It converts raw SVG files to the PDF+PDF_TEX combo using InkScape.

#

SyncTeX allows to jump between source (code) and output (PDF) in IDEs with support

(many have it). A value of 1 is enabled (gzipped), -1 is enabled but uncompressed,

0 is off.

Testing in VSCode w/ LaTeX Workshop only worked for the compressed version.

Adjust this as needed. Of course, only relevant for local use, no effect on a remote

CI pipeline (except for slower compilation, probably).

#

%O and %S will forward Options and the Source file, respectively, given to latexmk.

#

set_tex_cmds applies to all *latex commands (latex, xelatex, lualatex, ...), so

no need to specify these each. This allows to simply change $pdf_mode to get a

different engine. Check if this works with latexmk --commands.

The options are:

--shell-escape: enable system commands

--synctex=1: enable synctex (see man synctex)

--file-line-error: Writes out the concrete file line in which the error occured

--halt-on-error: stop processing at the first error

set_tex_cmds("--shell-escape --synctex=1 --file-line-error --halt-on-error %O %S");

option 2 is same as 1 (run biber when necessary), but also deletes the

regeneratable bbl-file in a clenaup (latexmk -c). Do not use if original

bib file is not available!

$bibtex_use = 2; # default: 1

Change default biber call, help catch errors faster/clearer. See

https://web.archive.org/web/20200526101657/https://www.semipol.de/2018/06/12/latex-best-practices.html#database-entries

$biber = "biber --validate-datamodel %O %S";

@BIBINPUTS = ( ".", "/bib" );

======================================================================================

Auxiliary Files

======================================================================================

Let latexmk know about generated files, so they can be used to detect if a

rerun is required, or be deleted in a cleanup.

loe: List of Examples (KOMAScript)

lol: List of Listings (listings and minted packages)

run.xml: biber runs

glg: glossaries log

glstex: generated from glossaries-extra

push @generated_exts, 'loe', 'lol', 'lor', 'run.xml', 'glg', 'glstex';

Also delete the *.glstex files from package glossaries-extra. Problem is,

that that package generates files of the form "basename-digit.glstex" if

multiple glossaries are present. Latexmk looks for "basename.glstex" and so

does not find those. For that purpose, use wildcard.

Also delete files generated by gnuplot/pgfplots contour plots

(.dat, .script, .table).

$clean_ext = "%R-.glstex %R_contourtmp.*";

======================================================================================

bib2gls as a custom dependency

======================================================================================

Grabbed from latexmk CTAN distribution:

Implementing glossary with bib2gls and glossaries-extra, with the

log file (.glg) analyzed to get dependence on a .bib file.

!!! ONLY WORKS WITH VERSION 4.54 or higher of latexmk

Add custom dependency.

latexmk checks whether a file with ending as given in the 2nd

argument exists ('toextension'). If yes, check if file with

ending as in first argument ('fromextension') exists. If yes,

run subroutine as given in fourth argument.

Third argument is whether file MUST exist. If 0, no action taken.

add_cus_dep('aux', 'glstex', 0, 'run_bib2gls');

PERL subroutine. $_[0] is the argument (filename in this case).

File from author from here: https://tex.stackexchange.com/a/401979/120853

sub run_bib2gls { if ( $silent ) {

my $ret = system "bib2gls --silent --group '$_[0]'"; # Original version

    my $ret = system "bib2gls --silent --group $_[0]"; # Runs in PowerShell
} else {
#    my $ret = system "bib2gls --group '$_[0]'"; # Original version
    my $ret = system "bib2gls --group $_[0]"; # Runs in PowerShell
};

my ($base, $path) = fileparse( $_[0] );
if ($path && -e "$base.glstex") {
    rename "$base.glstex", "$path$base.glstex";
}

# Analyze log file.
local *LOG;
$LOG = "$_[0].glg";
if (!$ret && -e $LOG) {
    open LOG, "<$LOG";
while (<LOG>) {
        if (/^Reading (.*\.bib)\s$/) {
    rdb_ensure_file( $rule, $1 );
    }
}
close LOG;
}
return $ret;

}

The "strange" thing is, that latexmk works with Latex-Workshop as expected and via the terminal not. But because I build my project via a CI/CD pipeline as well, I would like to understand why it isn't working via the terminal. And why it even differs.
Because invoking it with Latex-Workshop with the recipe "Complete compilation":

{ "latex-workshop.latex.recipes": [ { "name": "Complete compilation", "tools": [ "latexmk" ] }, { "name": "Faster Compilation", "tools": [ "latexmk_once" ] }, { "name": "Fastest Compilation", "tools": [ "pdflatex" ] } ], "latex-workshop.latex.tools": [ { "name": "latexmk", "command": "latexmk", "args": [ // latexmk doesn't need a file argument, but provide it to avoid running // on all found tex files "%DOC%" ], "env": {} }, { "name": "latexmk_once", "command": "latexmk", "args": [ // Don't know why, but the normal command/flag -e '$max_repeat=1' // doesn't work because of the space. If it is seperated in two // lines it works. "--e", "$max_repeat=1", "%DOC%" ], "env": {} }, { "name": "pdflatex", "command": "pdflatex", "args": [ "--shell-escape", "--synctex=1", "--file-line-error", "--halt-on-error", "%DOC%" ], "env": {} }

],
It works as expected and pdflatex **AND bibtex** are ran to compile the document.
Invoking it from the terminal from cold (without auxillary files) only pdflatex is used and **NO bibtex**.
When you run it with Latex-Workshop first and then delete some files, except the .aux file and then run it via terminal, suddendly bibtex is also used there. So why is that the case, for my understanding there should be no difference and I even looked a bit in the source code of Latex-Workshop, if latexmk is run with a special option, but I don't see something like this.

In both cases an .aux file is created with the line `\bibdata{bib/bibliography}`, which should be parsed by latexmk. If run from the terminal this seems to not work.
### Reproduction Steps
> _Please list out the steps to reproduce your bug. Include relevant environmental variables or any other configuration._
1. Clone the [repo](https://collaborating.tuhh.de/m21/public/theses/elsevier-latex)
2. Open it in VSC with Dev Containers and open in remote Container
3. Compile from the terminal end of output will be something like this:

Latexmk: All targets () are up-to-date 'pdflatex': time = 2.03 'pdflatex': time = 1.76 'pdflatex': time = 1.83 Processing time = 6.06 Number of rules run = 3

4. Run recipe "Complete compilation" from Latex-Workshop. Output will be something like this:

Latexmk: All targets () are up-to-date 'pdflatex': time = 1.64 'bibtex elsarticle-template': time = 0.06 'pdflatex': time = 1.71 'bibtex elsarticle-template': time = 0.07 'pdflatex': time = 1.87 'bibtex elsarticle-template': time = 0.07 'pdflatex': time = 1.88 Processing time = 8.27 Number of rules run = 7


### Expected Behavior
> _What were you expecting to see? Include any relevant examples or documentation links._
- Latexmk should work the same from the terminal as invoked from Latex-Workshop.
- 

## 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`._

[Paste the log here. Do not remove the surrounding backquotes (`).]


### Developer Tools Console
> _Please paste the whole log messages below, not parts of ones. This console logs can sometimes be very important in many cases. To access the log, click `Help` -> `Toggle Developer Tools` -> `Console`._

[08:05:01.401][Logger] New log placeholder %WS1% registered for /workspaces/Elsevier LaTeX . [08:05:01.401][Config] latex-workshop.latex.recipes: [{"name":"Complete compilation","tools":["latexmk"]},{"name":"Faster Compilation","tools":["latexmk_once"]},{"name":"Fastest Compilation","tools":["pdflatex"]}] . [08:05:01.434][Config] latex-workshop.latex.tools: [{"name":"latexmk","command":"latexmk","args":["%DOC%"],"env":{}},{"name":"latexmk_once","command":"latexmk","args":["--e","$max_repeat=1","%DOC%"],"env":{}},{"name":"pdflatex","command":"pdflatex","args":["--shell-escape","--synctex=1","--file-line-error","--halt-on-error","%DOC%"],"env":{}},{"name":"latexmk_print","command":"latexmk","args":["--jobname=printversion-print","%DOC%"],"env":{}}] . [08:05:01.449][Config] latex-workshop.latex.autoBuild.run: "never" . [08:05:01.451][Config] latex-workshop.latex.autoBuild.cleanAndRetry.enabled: false . [08:05:01.459][Config] latex-workshop.linting.chktex.enabled: true . [08:05:01.463][Config] latex-workshop.intellisense.update.aggressive.enabled: true . [08:05:01.493][Config] latex-workshop.intellisense.package.extra: ["siunitx","hyperref"] . [08:05:01.518][Config] latex-workshop.bibtex-format.sort.enabled: true . [08:05:01.530][Manager] Set $LATEXWORKSHOP_DOCKER_LATEX: "" [08:05:01.543][Server] Creating LaTeX Workshop http and websocket server. [08:05:01.900][Server] Server successfully started: {"address":"127.0.0.1","family":"IPv4","port":34043} . [08:05:01.965][Extension] Initializing LaTeX Workshop. [08:05:01.966][Extension] Extension root: /home/tex/.vscode-server/extensions/james-yu.latex-workshop-9.14.1 [08:05:01.966][Extension] $PATH: /vscode/vscode-server/bin/linux-x64/f1b07bd25dfad64b0167beb15359ae573aecd2cc/bin/remote-cli:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin [08:05:01.966][Extension] $SHELL: /bin/sh [08:05:01.967][Extension] $LANG: C.utf8 [08:05:01.967][Extension] $LC_ALL: C.utf8 [08:05:01.967][Extension] process.platform: linux [08:05:01.967][Extension] process.arch: x64 [08:05:01.968][Extension] vscode.env.appName: Visual Studio Code [08:05:01.968][Extension] vscode.env.remoteName: dev-container [08:05:01.969][Extension] vscode.env.uiKind: 1 [08:05:01.970][Extension] LaTeX Workshop initialized. [08:05:01.979][Format][Bib] Bibtex format config: {"tab":" ","case":"lowercase","left":"{","right":"}","trailingComma":false,"sort":["key"],"alignOnEqual":true,"sortFields":false,"fieldsOrder":[],"firstEntries":["string","xdata"]} [08:05:01.983][Extension] Trigger characters for intellisense of LaTeX documents: ["\",",","{"] [08:05:01.987][Manager] Current workspace folders: ["file://%WS1%"] [08:05:02.087][Manager] Current workspaceRootDir: file://%WS1% [08:05:02.127][Server] valdOrigin is http://127.0.0.1:34043 [08:05:02.525][Viewer][Panel] Internal PDF viewer at http://127.0.0.1:34043/viewer.html?file=pdf..ZmlsZSUzQSUyRiUyRiUyRndvcmtzcGFjZXMlMkZFbHNldmllciUyMExhVGVYJTJGZWxzYXJ0aWNsZS10ZW1wbGF0ZS5wZGY . [08:05:02.527][Cacher][Watcher] Watched %WS1%/elsarticle-template.pdf with a new watcher on %WS1% . [08:05:02.527][Event] FILE_WATCHED: "%WS1%/elsarticle-template.pdf" [08:05:02.727][Cacher] Cache not finished on %WS1%/elsarticle-template.tex when getting its children. [08:05:02.735][Cacher] Caching %WS1%/elsarticle-template.tex . [08:05:02.742][Cacher] Input %WS1%/chapters/frontmatter.tex from %WS1%/elsarticle-template.tex . [08:05:02.746][Cacher] Adding %WS1%/chapters/frontmatter.tex . [08:05:02.747][Cacher][Watcher] Watched %WS1%/chapters/frontmatter.tex with a new watcher on %WS1%/chapters . [08:05:02.747][Event] FILE_WATCHED: "%WS1%/chapters/frontmatter.tex" [08:05:02.748][Cacher] Caching %WS1%/chapters/frontmatter.tex . [08:05:02.751][Cacher] Updated inputs of %WS1%/chapters/frontmatter.tex . [08:05:02.751][Cacher] Parse LaTeX AST: %WS1%/chapters/frontmatter.tex . [08:05:02.755][Cacher] Input %WS1%/chapters/mainmatter.tex from %WS1%/elsarticle-template.tex . [08:05:02.756][Cacher] Adding %WS1%/chapters/mainmatter.tex . [08:05:02.756][Cacher][Watcher] Watched %WS1%/chapters/mainmatter.tex . [08:05:02.757][Event] FILE_WATCHED: "%WS1%/chapters/mainmatter.tex" [08:05:02.758][Cacher] Caching %WS1%/chapters/mainmatter.tex . [08:05:02.769][Cacher] Input %WS1%/chapters/mainmatter/01_introduction.tex from %WS1%/chapters/mainmatter.tex . [08:05:02.770][Cacher] Adding %WS1%/chapters/mainmatter/01_introduction.tex . [08:05:02.771][Cacher][Watcher] Watched %WS1%/chapters/mainmatter/01_introduction.tex with a new watcher on %WS1%/chapters/mainmatter . [08:05:02.771][Event] FILE_WATCHED: "%WS1%/chapters/mainmatter/01_introduction.tex" [08:05:02.773][Cacher] Caching %WS1%/chapters/mainmatter/01_introduction.tex . [08:05:02.783][Cacher] Updated inputs of %WS1%/chapters/mainmatter/01_introduction.tex . [08:05:02.784][Cacher] Parse LaTeX AST: %WS1%/chapters/mainmatter/01_introduction.tex . [08:05:02.792][Cacher] Input %WS1%/chapters/mainmatter/02_material_methods.tex from %WS1%/chapters/mainmatter.tex . [08:05:02.793][Cacher] Adding %WS1%/chapters/mainmatter/02_material_methods.tex . [08:05:02.793][Cacher][Watcher] Watched %WS1%/chapters/mainmatter/02_material_methods.tex . [08:05:02.793][Event] FILE_WATCHED: "%WS1%/chapters/mainmatter/02_material_methods.tex" [08:05:02.795][Cacher] Caching %WS1%/chapters/mainmatter/02_material_methods.tex . [08:05:02.799][Cacher] Updated inputs of %WS1%/chapters/mainmatter/02_material_methods.tex . [08:05:02.799][Cacher] Parse LaTeX AST: %WS1%/chapters/mainmatter/02_material_methods.tex . [08:05:02.804][Cacher] Input %WS1%/chapters/mainmatter/03_results.tex from %WS1%/chapters/mainmatter.tex . [08:05:02.805][Cacher] Adding %WS1%/chapters/mainmatter/03_results.tex . [08:05:02.805][Cacher][Watcher] Watched %WS1%/chapters/mainmatter/03_results.tex . [08:05:02.805][Event] FILE_WATCHED: "%WS1%/chapters/mainmatter/03_results.tex" [08:05:02.806][Cacher] Caching %WS1%/chapters/mainmatter/03_results.tex . [08:05:02.811][Cacher] Updated inputs of %WS1%/chapters/mainmatter/03_results.tex . [08:05:02.811][Cacher] Parse LaTeX AST: %WS1%/chapters/mainmatter/03_results.tex . [08:05:02.812][Cacher] Updated inputs of %WS1%/chapters/mainmatter.tex . [08:05:02.812][Cacher] Parse LaTeX AST: %WS1%/chapters/mainmatter.tex . [08:05:02.816][Cacher] Input %WS1%/chapters/backmatter.tex from %WS1%/elsarticle-template.tex . [08:05:02.822][Cacher] Adding %WS1%/chapters/backmatter.tex . [08:05:02.822][Cacher][Watcher] Watched %WS1%/chapters/backmatter.tex . [08:05:02.822][Event] FILE_WATCHED: "%WS1%/chapters/backmatter.tex" [08:05:02.823][Cacher] Caching %WS1%/chapters/backmatter.tex . [08:05:02.832][Cacher] Input %WS1%/chapters/backmatter/01_appendix.tex from %WS1%/chapters/backmatter.tex . [08:05:02.833][Cacher] Adding %WS1%/chapters/backmatter/01_appendix.tex . [08:05:02.834][Cacher][Watcher] Watched %WS1%/chapters/backmatter/01_appendix.tex with a new watcher on %WS1%/chapters/backmatter . [08:05:02.834][Event] FILE_WATCHED: "%WS1%/chapters/backmatter/01_appendix.tex" [08:05:02.835][Cacher] Caching %WS1%/chapters/backmatter/01_appendix.tex . [08:05:02.839][Cacher] Updated inputs of %WS1%/chapters/backmatter/01_appendix.tex . [08:05:02.839][Cacher] Parse LaTeX AST: %WS1%/chapters/backmatter/01_appendix.tex . [08:05:02.845][Cacher] Input %WS1%/chapters/backmatter/02_appendix.tex from %WS1%/chapters/backmatter.tex . [08:05:02.846][Cacher] Adding %WS1%/chapters/backmatter/02_appendix.tex . [08:05:02.846][Cacher][Watcher] Watched %WS1%/chapters/backmatter/02_appendix.tex . [08:05:02.847][Event] FILE_WATCHED: "%WS1%/chapters/backmatter/02_appendix.tex" [08:05:02.847][Cacher] Caching %WS1%/chapters/backmatter/02_appendix.tex . [08:05:02.852][Cacher] Updated inputs of %WS1%/chapters/backmatter/02_appendix.tex . [08:05:02.852][Cacher] Parse LaTeX AST: %WS1%/chapters/backmatter/02_appendix.tex . [08:05:02.852][Cacher] Updated inputs of %WS1%/chapters/backmatter.tex . [08:05:02.852][Cacher] Parse LaTeX AST: %WS1%/chapters/backmatter.tex . [08:05:02.853][Cacher] Updated inputs of %WS1%/elsarticle-template.tex . [08:05:02.853][Cacher] Parse LaTeX AST: %WS1%/elsarticle-template.tex . [08:05:02.978][Cacher] Parsed LaTeX AST: %WS1%/chapters/frontmatter.tex . [08:05:02.983][Cacher] Updated elements in 4.42 ms: %WS1%/chapters/frontmatter.tex . [08:05:02.984][Event] FILE_PARSED: "%WS1%/chapters/frontmatter.tex" [08:05:03.012][Cacher] Parsed LaTeX AST: %WS1%/chapters/mainmatter/01_introduction.tex . [08:05:03.015][Cacher] Updated elements in 1.67 ms: %WS1%/chapters/mainmatter/01_introduction.tex . [08:05:03.015][Event] FILE_PARSED: "%WS1%/chapters/mainmatter/01_introduction.tex" [08:05:03.016][Cacher] Parsed LaTeX AST: %WS1%/chapters/mainmatter/02_material_methods.tex . [08:05:03.017][Cacher] Updated elements in 0.36 ms: %WS1%/chapters/mainmatter/02_material_methods.tex . [08:05:03.017][Event] FILE_PARSED: "%WS1%/chapters/mainmatter/02_material_methods.tex" [08:05:03.018][Cacher] Parsed LaTeX AST: %WS1%/chapters/mainmatter/03_results.tex . [08:05:03.019][Cacher] Updated elements in 0.36 ms: %WS1%/chapters/mainmatter/03_results.tex . [08:05:03.019][Event] FILE_PARSED: "%WS1%/chapters/mainmatter/03_results.tex" [08:05:03.048][Cacher] Parsed LaTeX AST: %WS1%/chapters/mainmatter.tex . [08:05:03.049][Cacher] Updated elements in 0.51 ms: %WS1%/chapters/mainmatter.tex . [08:05:03.050][Event] FILE_PARSED: "%WS1%/chapters/mainmatter.tex" [08:05:03.051][Cacher] Parsed LaTeX AST: %WS1%/chapters/backmatter/01_appendix.tex . [08:05:03.052][Cacher] Updated elements in 0.75 ms: %WS1%/chapters/backmatter/01_appendix.tex . [08:05:03.052][Event] FILE_PARSED: "%WS1%/chapters/backmatter/01_appendix.tex" [08:05:03.054][Cacher] Parsed LaTeX AST: %WS1%/chapters/backmatter/02_appendix.tex . [08:05:03.055][Cacher] Updated elements in 0.50 ms: %WS1%/chapters/backmatter/02_appendix.tex . [08:05:03.055][Event] FILE_PARSED: "%WS1%/chapters/backmatter/02_appendix.tex" [08:05:03.104][Cacher] Parsed LaTeX AST: %WS1%/chapters/backmatter.tex . [08:05:03.109][Cacher][Path] Calling kpsewhich to resolve -format=.bib bib/bibliography . [08:05:03.286][Cacher] Bib ./bib/bibliography.bib from %WS1%/chapters/backmatter.tex . [08:05:03.287][Intelli][Citation] Parsing .bib entries from ./bib/bibliography.bib [08:05:03.288][Cacher][Watcher] Watched ./bib/bibliography.bib with a new watcher on ./bib . [08:05:03.288][Event] FILE_WATCHED: "./bib/bibliography.bib" [08:05:03.288][Cacher] Updated elements in 183.96 ms: %WS1%/chapters/backmatter.tex . [08:05:03.289][Event] FILE_PARSED: "%WS1%/chapters/backmatter.tex" [08:05:03.290][Cacher] Parsed LaTeX AST: %WS1%/elsarticle-template.tex . [08:05:03.291][Cacher][Path] Calling kpsewhich to resolve elsarticle.cls . [08:05:03.372][Cacher] Updated elements in 81.81 ms: %WS1%/elsarticle-template.tex . [08:05:03.372][Event] FILE_PARSED: "%WS1%/elsarticle-template.tex" [08:05:03.373][Structure] Structure cleared on undefined root. [08:05:03.373][Event] STRUCTURE_UPDATED [08:05:03.378][Cacher][Path] Non-existent .fls for %WS1%/chapters/backmatter.tex . [08:05:03.384][Cacher][Path] Non-existent .fls for %WS1%/chapters/mainmatter.tex . [08:05:03.389][Cacher][Path] Non-existent .fls for %WS1%/chapters/frontmatter.tex . [08:05:03.395][Cacher][Path] Non-existent .fls for %WS1%/chapters/mainmatter/03_results.tex . [08:05:03.401][Cacher][Path] Non-existent .fls for %WS1%/chapters/mainmatter/02_material_methods.tex . [08:05:03.406][Cacher][Path] Non-existent .fls for %WS1%/chapters/mainmatter/01_introduction.tex . [08:05:03.413][Cacher][Path] Non-existent .fls for %WS1%/chapters/backmatter/02_appendix.tex . [08:05:03.419][Cacher][Path] Non-existent .fls for %WS1%/chapters/backmatter/01_appendix.tex . [08:05:03.422][Manager] Found files that might be root, choose the first one: %WS1%/elsarticle-template.tex . [08:05:03.423][Manager] Root file changed: from undefined to %WS1%/elsarticle-template.tex [08:05:03.423][Manager] Start to find all dependencies. [08:05:03.423][Manager] Root file languageId: latex [08:05:03.423][Event] ROOT_FILE_CHANGED: "%WS1%/elsarticle-template.tex" [08:05:03.424][Cacher][Watcher] Reset. [08:05:03.427][Cacher] Adding %WS1%/elsarticle-template.tex . [08:05:03.428][Cacher][Watcher] Watched %WS1%/elsarticle-template.tex with a new watcher on %WS1% . [08:05:03.428][Event] FILE_WATCHED: "%WS1%/elsarticle-template.tex" [08:05:03.428][Cacher] Caching %WS1%/elsarticle-template.tex . [08:05:03.434][Cacher] Input %WS1%/chapters/frontmatter.tex from %WS1%/elsarticle-template.tex . [08:05:03.435][Cacher] Adding %WS1%/chapters/frontmatter.tex . [08:05:03.435][Cacher][Watcher] Watched %WS1%/chapters/frontmatter.tex with a new watcher on %WS1%/chapters . [08:05:03.436][Event] FILE_WATCHED: "%WS1%/chapters/frontmatter.tex" [08:05:03.436][Cacher] Caching %WS1%/chapters/frontmatter.tex . [08:05:03.439][Cacher] Updated inputs of %WS1%/chapters/frontmatter.tex . [08:05:03.439][Cacher] Parse LaTeX AST: %WS1%/chapters/frontmatter.tex . [08:05:03.443][Cacher] Input %WS1%/chapters/mainmatter.tex from %WS1%/elsarticle-template.tex . [08:05:03.444][Cacher] Adding %WS1%/chapters/mainmatter.tex . [08:05:03.444][Cacher][Watcher] Watched %WS1%/chapters/mainmatter.tex . [08:05:03.445][Event] FILE_WATCHED: "%WS1%/chapters/mainmatter.tex" [08:05:03.445][Cacher] Caching %WS1%/chapters/mainmatter.tex . [08:05:03.452][Cacher] Input %WS1%/chapters/mainmatter/01_introduction.tex from %WS1%/chapters/mainmatter.tex . [08:05:03.452][Cacher] Adding %WS1%/chapters/mainmatter/01_introduction.tex . [08:05:03.453][Cacher][Watcher] Watched %WS1%/chapters/mainmatter/01_introduction.tex with a new watcher on %WS1%/chapters/mainmatter . [08:05:03.453][Event] FILE_WATCHED: "%WS1%/chapters/mainmatter/01_introduction.tex" [08:05:03.453][Cacher] Caching %WS1%/chapters/mainmatter/01_introduction.tex . [08:05:03.456][Cacher] Updated inputs of %WS1%/chapters/mainmatter/01_introduction.tex . [08:05:03.459][Cacher] Parse LaTeX AST: %WS1%/chapters/mainmatter/01_introduction.tex . [08:05:03.463][Cacher] Input %WS1%/chapters/mainmatter/02_material_methods.tex from %WS1%/chapters/mainmatter.tex . [08:05:03.464][Cacher] Adding %WS1%/chapters/mainmatter/02_material_methods.tex . [08:05:03.464][Cacher][Watcher] Watched %WS1%/chapters/mainmatter/02_material_methods.tex . [08:05:03.464][Event] FILE_WATCHED: "%WS1%/chapters/mainmatter/02_material_methods.tex" [08:05:03.465][Cacher] Caching %WS1%/chapters/mainmatter/02_material_methods.tex . [08:05:03.467][Cacher] Updated inputs of %WS1%/chapters/mainmatter/02_material_methods.tex . [08:05:03.468][Cacher] Parse LaTeX AST: %WS1%/chapters/mainmatter/02_material_methods.tex . [08:05:03.471][Cacher] Input %WS1%/chapters/mainmatter/03_results.tex from %WS1%/chapters/mainmatter.tex . [08:05:03.472][Cacher] Adding %WS1%/chapters/mainmatter/03_results.tex . [08:05:03.472][Cacher][Watcher] Watched %WS1%/chapters/mainmatter/03_results.tex . [08:05:03.472][Event] FILE_WATCHED: "%WS1%/chapters/mainmatter/03_results.tex" [08:05:03.473][Cacher] Caching %WS1%/chapters/mainmatter/03_results.tex . [08:05:03.476][Cacher] Updated inputs of %WS1%/chapters/mainmatter/03_results.tex . [08:05:03.476][Cacher] Parse LaTeX AST: %WS1%/chapters/mainmatter/03_results.tex . [08:05:03.476][Cacher] Updated inputs of %WS1%/chapters/mainmatter.tex . [08:05:03.477][Cacher] Parse LaTeX AST: %WS1%/chapters/mainmatter.tex . [08:05:03.480][Cacher] Input %WS1%/chapters/backmatter.tex from %WS1%/elsarticle-template.tex . [08:05:03.481][Cacher] Adding %WS1%/chapters/backmatter.tex . [08:05:03.481][Cacher][Watcher] Watched %WS1%/chapters/backmatter.tex . [08:05:03.481][Event] FILE_WATCHED: "%WS1%/chapters/backmatter.tex" [08:05:03.482][Cacher] Caching %WS1%/chapters/backmatter.tex . [08:05:03.489][Cacher] Input %WS1%/chapters/backmatter/01_appendix.tex from %WS1%/chapters/backmatter.tex . [08:05:03.490][Cacher] Adding %WS1%/chapters/backmatter/01_appendix.tex . [08:05:03.490][Cacher][Watcher] Watched %WS1%/chapters/backmatter/01_appendix.tex with a new watcher on %WS1%/chapters/backmatter . [08:05:03.490][Event] FILE_WATCHED: "%WS1%/chapters/backmatter/01_appendix.tex" [08:05:03.491][Cacher] Caching %WS1%/chapters/backmatter/01_appendix.tex . [08:05:03.495][Cacher] Updated inputs of %WS1%/chapters/backmatter/01_appendix.tex . [08:05:03.495][Cacher] Parse LaTeX AST: %WS1%/chapters/backmatter/01_appendix.tex . [08:05:03.499][Cacher] Input %WS1%/chapters/backmatter/02_appendix.tex from %WS1%/chapters/backmatter.tex . [08:05:03.500][Cacher] Adding %WS1%/chapters/backmatter/02_appendix.tex . [08:05:03.500][Cacher][Watcher] Watched %WS1%/chapters/backmatter/02_appendix.tex . [08:05:03.500][Event] FILE_WATCHED: "%WS1%/chapters/backmatter/02_appendix.tex" [08:05:03.501][Cacher] Caching %WS1%/chapters/backmatter/02_appendix.tex . [08:05:03.503][Cacher] Updated inputs of %WS1%/chapters/backmatter/02_appendix.tex . [08:05:03.503][Cacher] Parse LaTeX AST: %WS1%/chapters/backmatter/02_appendix.tex . [08:05:03.504][Cacher] Updated inputs of %WS1%/chapters/backmatter.tex . [08:05:03.504][Cacher] Parse LaTeX AST: %WS1%/chapters/backmatter.tex . [08:05:03.504][Cacher] Updated inputs of %WS1%/elsarticle-template.tex . [08:05:03.504][Cacher] Parse LaTeX AST: %WS1%/elsarticle-template.tex . [08:05:03.504][Event] ROOT_FILE_SEARCHED [08:05:03.505][Linter] ChkTeX lints root %WS1%/elsarticle-template.tex . [08:05:03.506][Linter][ChkTeX] Linter for ChkTeX command The command is chktex:["-wall","-n22","-n30","-e16","-q","-f%f:%l:%c:%d:%k:%n:%m\n","%WS1%/elsarticle-template.tex"]. [08:05:03.593][Cacher] Parsed LaTeX AST: %WS1%/chapters/frontmatter.tex . [08:05:03.596][Cacher] Updated elements in 1.75 ms: %WS1%/chapters/frontmatter.tex . [08:05:03.596][Event] FILE_PARSED: "%WS1%/chapters/frontmatter.tex" [08:05:03.624][Linter] Linter for root successfully finished in 0s 112ms [08:05:03.626][Linter][ChkTeX] No .chktexrc file is found to determine TabSize. [08:05:03.627][Linter][ChkTeX] Logged 0 messages. [08:05:03.632][Cacher] Parsed LaTeX AST: %WS1%/chapters/mainmatter/01_introduction.tex . [08:05:03.634][Cacher] Updated elements in 1.26 ms: %WS1%/chapters/mainmatter/01_introduction.tex . [08:05:03.635][Event] FILE_PARSED: "%WS1%/chapters/mainmatter/01_introduction.tex" [08:05:03.635][Cacher] Parsed LaTeX AST: %WS1%/chapters/mainmatter/02_material_methods.tex . [08:05:03.636][Cacher] Updated elements in 0.44 ms: %WS1%/chapters/mainmatter/02_material_methods.tex . [08:05:03.636][Event] FILE_PARSED: "%WS1%/chapters/mainmatter/02_material_methods.tex" [08:05:03.637][Cacher] Parsed LaTeX AST: %WS1%/chapters/mainmatter/03_results.tex . [08:05:03.638][Cacher] Updated elements in 0.43 ms: %WS1%/chapters/mainmatter/03_results.tex . [08:05:03.638][Event] FILE_PARSED: "%WS1%/chapters/mainmatter/03_results.tex" [08:05:03.681][Cacher] Parsed LaTeX AST: %WS1%/chapters/mainmatter.tex . [08:05:03.683][Cacher] Updated elements in 0.48 ms: %WS1%/chapters/mainmatter.tex . [08:05:03.683][Event] FILE_PARSED: "%WS1%/chapters/mainmatter.tex" [08:05:03.684][Cacher] Parsed LaTeX AST: %WS1%/chapters/backmatter/01_appendix.tex . [08:05:03.684][Cacher] Updated elements in 0.29 ms: %WS1%/chapters/backmatter/01_appendix.tex . [08:05:03.684][Event] FILE_PARSED: "%WS1%/chapters/backmatter/01_appendix.tex" [08:05:03.685][Cacher] Parsed LaTeX AST: %WS1%/chapters/backmatter/02_appendix.tex . [08:05:03.685][Cacher] Updated elements in 0.30 ms: %WS1%/chapters/backmatter/02_appendix.tex . [08:05:03.686][Event] FILE_PARSED: "%WS1%/chapters/backmatter/02_appendix.tex" [08:05:03.701][Cacher] Parsed LaTeX AST: %WS1%/chapters/backmatter.tex . [08:05:03.706][Cacher] Bib %WS1%/bib/bibliography.bib from %WS1%/chapters/backmatter.tex . [08:05:03.707][Intelli][Citation] Parsing .bib entries from %WS1%/bib/bibliography.bib [08:05:03.715][Intelli][Citation] Parse BibTeX AST from %WS1%/bib/bibliography.bib . [08:05:03.716][Cacher][Watcher] Watched %WS1%/bib/bibliography.bib with a new watcher on %WS1%/bib . [08:05:03.716][Event] FILE_WATCHED: "%WS1%/bib/bibliography.bib" [08:05:03.716][Cacher] Updated elements in 14.64 ms: %WS1%/chapters/backmatter.tex . [08:05:03.717][Event] FILE_PARSED: "%WS1%/chapters/backmatter.tex" [08:05:03.718][Cacher] Parsed LaTeX AST: %WS1%/elsarticle-template.tex . [08:05:03.718][Cacher][Path] Calling kpsewhich to resolve elsarticle.cls . [08:05:03.809][Cacher] Updated elements in 91.25 ms: %WS1%/elsarticle-template.tex . [08:05:03.810][Event] FILE_PARSED: "%WS1%/elsarticle-template.tex" [08:05:03.812][Cacher] Parsing .fls %WS1%/elsarticle-template.fls . [08:05:03.846][Cacher] Adding %WS1%/bib/bibliography.bib . [08:05:03.846][Cacher][Watcher] Watched %WS1%/bib/bibliography.bib with a new watcher on %WS1%/bib . [08:05:03.847][Event] FILE_WATCHED: "%WS1%/bib/bibliography.bib" [08:05:03.865][Cacher] Adding %WS1%/images/vectors/compressor_rotating_stall.svg . [08:05:03.865][Cacher][Watcher] Watched %WS1%/images/vectors/compressor_rotating_stall.svg with a new watcher on %WS1%/images/vectors . [08:05:03.866][Event] FILE_WATCHED: "%WS1%/images/vectors/compressor_rotating_stall.svg" [08:05:03.869][Cacher] Adding %WS1%/images/vectors/svg-inkscape/compressor_rotating_stall_svg-raw.pdf . [08:05:03.870][Cacher][Watcher] Watched %WS1%/images/vectors/svg-inkscape/compressor_rotating_stall_svg-raw.pdf with a new watcher on %WS1%/images/vectors/svg-inkscape . [08:05:03.870][Event] FILE_WATCHED: "%WS1%/images/vectors/svg-inkscape/compressor_rotating_stall_svg-raw.pdf" [08:05:03.874][Cacher] Adding %WS1%/images/bitmaps/field.jpg . [08:05:03.874][Cacher][Watcher] Watched %WS1%/images/bitmaps/field.jpg with a new watcher on %WS1%/images/bitmaps . [08:05:03.875][Event] FILE_WATCHED: "%WS1%/images/bitmaps/field.jpg" [08:05:03.889][Cacher] Found .aux %WS1%/elsarticle-template.tex from .fls %WS1%/elsarticle-template.fls , parsing. [08:05:03.896][Cacher] Found .bib %WS1%/bib/bibliography.bib from .aux %WS1%/elsarticle-template.aux . [08:05:03.897][Cacher] Parsed .aux %WS1%/elsarticle-template.tex . [08:05:03.897][Cacher] Parsed .fls %WS1%/elsarticle-template.fls . [08:05:03.929][Structure] Structure force updated with 0 root sections for %WS1%/elsarticle-template.tex . [08:05:03.929][Event] STRUCTURE_UPDATED [08:05:03.932][Intelli][Citation] Parsed 16 bib entries from %WS1%/bib/bibliography.bib . [08:05:03.932][Event] FILE_PARSED: "%WS1%/bib/bibliography.bib" [08:05:03.957][Structure] Structure force updated with 5 root sections for %WS1%/elsarticle-template.tex . [08:05:03.958][Event] STRUCTURE_UPDATED [08:05:05.587][Server] Preview PDF file: file://%WS1%/elsarticle-template.pdf [08:05:05.887][Viewer] Handle data type: open [08:05:06.163][Viewer] Handle data type: loaded [08:05:06.163][Event] VIEWER_PAGE_LOADED [08:10:34.160][Cacher][Watcher] "delete" emitted on %WS1%/elsarticle-template.pdf . [08:10:34.161][Cacher][Watcher] Unwatched folder %WS1% . [08:10:34.161][Event] FILE_REMOVED: "%WS1%/elsarticle-template.pdf" [08:15:08.493][Manager] Current workspace folders: ["file://%WS1%"] [08:15:08.498][Event] STRUCTURE_UPDATED [08:15:08.499][Manager] Found root file from active editor: %WS1%/elsarticle-template.tex [08:15:08.500][Manager] Keep using the same root file: %WS1%/elsarticle-template.tex [08:15:08.501][Event] ROOT_FILE_SEARCHED [08:15:08.501][Event] STRUCTURE_UPDATED [08:15:08.501][Linter] ChkTeX lints root %WS1%/elsarticle-template.tex . [08:15:08.503][Linter][ChkTeX] Linter for ChkTeX command The command is chktex:["-wall","-n22","-n30","-e16","-q","-f%f:%l:%c:%d:%k:%n:%m\n","%WS1%/elsarticle-template.tex"]. [08:15:08.649][Linter] Linter for root successfully finished in 0s 136ms [08:15:08.651][Linter][ChkTeX] No .chktexrc file is found to determine TabSize. [08:15:08.652][Linter][ChkTeX] Logged 0 messages. [08:15:09.456][Commander] BUILD command invoked. [08:15:09.457][Commander] The document of the active editor: file://%WS1%/elsarticle-template.tex [08:15:09.457][Commander] The languageId of the document: latex [08:15:09.457][Manager] Current workspace folders: ["file://%WS1%"] [08:15:09.458][Manager] Found root file from active editor: %WS1%/elsarticle-template.tex [08:15:09.458][Manager] Keep using the same root file: %WS1%/elsarticle-template.tex [08:15:09.458][Event] ROOT_FILE_SEARCHED [08:15:09.459][Event] STRUCTURE_UPDATED [08:15:09.459][Commander] Building root file: %WS1%/elsarticle-template.tex [08:15:09.459][Builder] Build root file %WS1%/elsarticle-template.tex [08:15:09.467][Builder] outDir: %WS1% . [08:15:09.486][Builder] Found TeX program by magic comment: pdflatex. [08:15:09.487][Builder] Preparing to run recipe: Complete compilation. [08:15:09.487][Builder] Prepared 1 tools. [08:15:09.489][Builder] Recipe step 1 The command is latexmk:["%WS1%/elsarticle-template"]. [08:15:09.489][Builder] env: {} [08:15:09.489][Builder] root: %WS1%/elsarticle-template.tex [08:15:09.489][Builder] cwd: %WS1% [08:15:09.499][Builder] LaTeX build process spawned with PID 24292. [08:15:16.585][Event] STRUCTURE_UPDATED [08:15:27.038][Parser][BibTeXLog] Logged 0 messages. [08:15:27.048][Parser][TexLog] Logged 47 messages. [08:15:27.067][Builder] Finished a step in recipe with PID 24292. [08:15:27.067][Builder] Successfully built %WS1%/elsarticle-template.tex . [08:15:27.068][Event] BUILD_DONE [08:15:27.068][Viewer] Call refreshExistingViewer: "%WS1%/elsarticle-template.pdf" . [08:15:27.068][Viewer] Refresh PDF viewer: %WS1%/elsarticle-template.pdf [08:15:27.075][Cacher] Parsing .fls %WS1%/elsarticle-template.fls . [08:15:27.132][Cacher] Found .aux %WS1%/elsarticle-template.tex from .fls %WS1%/elsarticle-template.fls , parsing. [08:15:27.136][Cacher] Parsed .aux %WS1%/elsarticle-template.tex . [08:15:27.136][Cacher] Parsed .fls %WS1%/elsarticle-template.fls . [08:15:27.489][Server] Preview PDF file: file://%WS1%/elsarticle-template.pdf [08:15:27.796][Viewer] Handle data type: loaded [08:15:27.797][Event] VIEWER_PAGE_LOADED [08:16:34.851][Event] STRUCTURE_UPDATED



## Anything Else?
> _Add any other context about the problem below._
- 
James-Yu commented 11 months ago

This is most likely a latexmk issue. As you may have discovered, this extension does nothing other than invoke latexmk with the arguments provided in the config.

Vasco-Da-Gama-png commented 11 months ago

But why is it then working if invoked by Latex-Workshop and not if by the terminal?

James-Yu commented 11 months ago

I don't know. The tools are determined by latexmk.

Vasco-Da-Gama-png commented 11 months ago

Ok, so there is no other special option with which latexmk is invoked by Latex-Workshop? Because this phenomenon drives me really crazy... Because with my CI/CD job my references don't work.

James-Yu commented 11 months ago

Logics on building a document are in https://github.com/James-Yu/LaTeX-Workshop/blob/master/src/components/builder.ts . Particularly, you may find it useful at https://github.com/James-Yu/LaTeX-Workshop/blob/dac0ee527ce0241f295ae74ebf38b89c7d1b5a41/src/components/builder.ts#L279-L284

Vasco-Da-Gama-png commented 11 months ago

Ok, that lines I've already found but didn't understand them. With what options is latexmk then invoked?

Vasco-Da-Gama-png commented 11 months ago

I gues I found the line making the difference if running with Latex-Workshop. But unfortunately I do not have an idea how to fix this for latexmk at all: https://github.com/James-Yu/LaTeX-Workshop/blob/dac0ee527ce0241f295ae74ebf38b89c7d1b5a41/src/components/cacher.ts#L349-L374 It seems like latexmk isn't detecting the \bibdata command in the auxillary file by itself. Do you know why this command was written for Latex-Workshop?

James-Yu commented 11 months ago

The cacher has nothing to do with latexmk, nor does it provide any info/argument to latexmk.