Latex-workshop: Wrong File Name When Parsing The LaTeX Log File

Created on 1 Aug 2019  路  10Comments  路  Source: James-Yu/LaTeX-Workshop

Describe the bug

The extension reports the problem with a wrong file name.

Condition

Input a file which needs >=2 pages and has a warning.

Desktop

  • OS: Windows 10
  • VS Code version: 1.36.1
  • Extension version: 7.3.0

Example

% This is main file
\documentclass{article}

\newcommand{\reportwarning}{\noindent \\} % Just a trick to report info

\usepackage{lipsum}

\begin{document}

\input{1.tex}

\end{document}
% This is 1.tex
\lipsum % Print many pages

\reportwarning

And then compile it.

It will report a problem.

Here is some related log info in log file

(./1.tex [1

] [2]
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <7> on input line 6.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <5> on input line 6.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <8> on input line 6.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <6> on input line 6.

Underfull \hbox (badness 10000) in paragraph at lines 6--7

 []

)

And the bug:

The file name is 1.tex [1] [2].


P.S. It is quite annoying when debugging a huge document because I cannot directly goto that line in the file.

Thanks a lot.

bug

All 10 comments

Please show us log messages of the extension.

2018-11-07 20 34 24

Show us your using LaTeX recipes also.

Thank you for your cooperation.

Compile command is

latexmk -synctex=1 -interaction=nonstopmode -file-line-error -xelatex main.tex

The log of extension looks pretty normal.

Here is some related message in the LaTeX Workshop Log:

LaTeX log parsed with 1 messages.

The problem pops when parsing the log of LaTeX, the *.log file.

Here is some info in the main.log file:

 (./1.tex [1

]
Underfull \hbox (badness 10000) in paragraph at lines 4--5

 []

) 

And then the extension parsing it as (the VSCode problem message)

{
    "resource": "1.tex [1]",
    "owner": "LaTeX",
    "severity": 2,
    "message": "Underfull \\hbox (badness 10000)",
    "source": "LaTeX",
    "startLineNumber": 4,
    "startColumn": 1,
    "endLineNumber": 4,
    "endColumn": 65536
}

You can see the resource file name 1.tex [1] is wrong.

issue-latexworkshop-parse

That's the problem.


BTW, when I use xelatex (latexmk -synctex=1 -interaction=nonstopmode -file-line-error -xelatex main.tex) to compile, there is no effect of page output animation, while latexmk -synctex=1 -interaction=nonstopmode -file-line-error main.tex has.

The animation:

issue-latexworkshop-page-outputp-animate

Please show us log messages even if you think it's normal.

I'm facing this issue too.

OK, here is the log:

[01:00:15] Initializing LaTeX Workshop.
[01:00:15] Creating LaTeX Workshop http and websocket server.
[01:00:15] LaTeX Workshop initialized.
[01:00:15] Found root file from active editor: f:\test\main.tex
[01:00:17] Root file changed from: undefined. Find all dependencies.
[01:00:17] Instantiating a new file watcher for f:\test\main.tex
[01:00:17] Parsing f:\test\main.tex
[01:00:17] Adding f:\test\1.tex to file watcher.
[01:00:17] Parsing f:\test\1.tex
[01:00:17] Cannot find file f:\test\main.fls
[01:00:17] Server created on 127.0.0.1:50647
[01:00:17] BUILD command invoked.
[01:00:17] Found root file from active editor: f:\test\main.tex
[01:00:17] Root file remains unchanged from: f:\test\main.tex.
[01:00:17] Building root file: f:\test\main.tex
[01:00:17] Build root file f:\test\main.tex
[01:00:17] Recipe step 1: latexmk, -synctex=1,-interaction=nonstopmode,-file-line-error,-xelatex,f:/test/main
[01:00:17] LaTeX build process spawned. PID: 10836.
[01:00:17] Snippet data loaded.
[01:00:17] LaTeX Workshop version: 7.3.0
[01:00:21] LaTeX log parsed with 1 messages.
[01:00:21] Recipe of length 1 finished. PID: 10836.
[01:00:21] Successfully built f:\test\main.tex.
[01:00:21] No PDF viewer connected for f:\test\main.pdf
[01:00:21] Parsing f:\test\main.fls to compute dependencies
[01:00:21] Auto Clean invoked.
[01:00:21] File cleaned: f:\test\main.aux
[01:00:21] File cleaned: f:\test\main.fls
[01:00:21] File cleaned: f:\test\main.xdv
[01:00:21] File cleaned: f:\test\main.log
[01:00:21] File cleaned: f:\test\main.fdb_latexmk

Hi,

I'm having the same problem in a larger project so I tried to reproduce the example published by @uninyhart. However, the error is reported in main.tex and not in 1.tex, as it is appears in the LaTex Compiler log. It may be related.

I hope it helps to find the problem.

Thanks a lot.

Edit:
The line number changes because I used magic comments.

Error message

{
    "resource": "/d:/sdhde/Projects/test-latex/main.tex",
    "owner": "LaTeX",
    "severity": 2,
    "message": "Underfull \\hbox (badness 10000)",
    "source": "LaTeX",
    "startLineNumber": 5,
    "startColumn": 1,
    "endLineNumber": 5,
    "endColumn": 65536
}

LaTex Compiler log

(./1.tex [1])
Underfull \hbox (badness 10000) in paragraph at lines 5--13

Desktop
OS: Windows 10
VS Code version: 1.36.1
Extension version: 7.3.0

Full logs

This is XeTeX, Version 3.14159265-2.6-0.999991 (TeX Live 2019/W32TeX) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(./main.tex
LaTeX2e <2018-12-01>
(d:/install/texlive/2019/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(d:/install/texlive/2019/texmf-dist/tex/latex/base/size10.clo)) (d:/install/texlive/2019/texmf-dist/tex/latex/lipsum/lipsum.sty (d:/install/texlive/2019/texmf-dist/tex/latex/l3kernel/expl3.sty (d:/install/texlive/2019/texmf-dist/tex/latex/l3kernel/expl3-code.tex) (d:/install/texlive/2019/texmf-dist/tex/latex/l3backend/l3backend-xdvipdfmx.def)) (d:/install/texlive/2019/texmf-dist/tex/latex/l3packages/xparse/xparse.sty) (d:/install/texlive/2019/texmf-dist/tex/latex/lipsum/lipsum.ltd.tex))
No file main.aux.
(./1.tex [1])
Underfull \hbox (badness 10000) in paragraph at lines 5--13

[2] (./main.aux) )
(see the transcript file for additional information)
Output written on main.pdf (2 pages).
SyncTeX written on main.synctex.gz.

Transcript written on main.log.
xelatex: unrecognized option `-outdir=./'
[08:53:51] Parsing d:\sdhde\Projects\test-latex\main.tex
[08:53:51] Parsing d:\sdhde\Projects\test-latex\1.tex
[08:53:51] Cannot find file d:\sdhde\Projects\test-latex\main.fls
[08:53:51] File watcher: responding to change in d:\sdhde\Projects\test-latex\main.tex
[08:53:51] d:\sdhde\Projects\test-latex\main.tex changed. Auto build project.
[08:53:51] BUILD command invoked.
[08:53:51] Building root file: d:\sdhde\Projects\test-latex\main.tex
[08:53:51] Build root file d:\sdhde\Projects\test-latex\main.tex
[08:53:51] Found TeX program by magic comment: xelatex
[08:53:51] Found TeX options by magic comment: -synctex=1 -interaction=nonstopmode -file-line-error -outdir=./ main.tex
[08:53:51] Recipe step 1: xelatex, -synctex=1 -interaction=nonstopmode -file-line-error -outdir=./ main.tex
[08:53:51] LaTeX build process spawned. PID: 11716.
[08:53:57] LaTeX log parsed with 1 messages.
[08:53:57] Recipe of length 1 finished. PID: 11716.
[08:53:57] Successfully built d:\sdhde\Projects\test-latex\main.tex.
[08:53:57] No PDF viewer connected for d:\sdhde\Projects\test-latex\main.pdf
[08:53:57] Cannot find file d:\sdhde\Projects\test-latex\main.fls

The problem was in the regular expression. I've made a pull request with the solution.

_Sorry for the redundancy, the following is in the comments of the pull request, but I think they are needed for context_

I had the same behavior reported in the example of @uninyhart.

(./document/appendix/01-pos-tags.tex [114]
Appendix A.
(.//_minted-main/9112A9BF21A48D909F76BD18F78A00A9E28C4E0EE84402557236237A6F710C4A.pygtex)
Underfull \hbox (badness 10000) in paragraph at lines 43--43
[]|\TU/lmr/m/n/10 closing quotation

Underfull \hbox (badness 10000) in paragraph at lines 49--49
[]|\TU/lmr/m/n/10 conjunction, coordi-

latex-workshop -error-019-08-08 142620

So, I started looking at this again and I'm just perplexed. Pull request #1652 should resolve this specific version of the problem (with xelatex) so @James-Yu if you want to close this issue, I will open a new one with the pdflatex version of the problem.

Right, so here's what I've figured out. With pdflatex (Texlive/Linux or Miktex/Windows), the error log looks like

(./main.tex
LaTeX2e <2018-12-01>
(/usr/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texmf-dist/tex/latex/lipsum/lipsum.sty
(/usr/share/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/share/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(/usr/share/texmf-dist/tex/latex/l3kernel/l3pdfmode.def))
(/usr/share/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(/usr/share/texmf-dist/tex/latex/lipsum/lipsum.ltd.tex)) (./main.aux)
(./inputfile.tex [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}])
Underfull \hbox (badness 10000) in paragraph at lines 4--11

[2] (./main.aux) )

Notice that the line Underfull \hbox (badness 10000) in paragraph at lines 4--11 occurs in the main.tex group and the inputfile.tex group closes just before it.

For comparison, with an unknown command instead of an underfull box, we see

(./main.tex
LaTeX2e <2018-12-01>
(/usr/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texmf-dist/tex/latex/lipsum/lipsum.sty
(/usr/share/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/share/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(/usr/share/texmf-dist/tex/latex/l3kernel/l3pdfmode.def))
(/usr/share/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(/usr/share/texmf-dist/tex/latex/lipsum/lipsum.ltd.tex)) (./main.aux)
(./inputfile.tex [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]
./inputfile.tex:4: Undefined control sequence.
l.4 \badcommand

) [2] (./main.aux) )

which puts the undefined control sequence error in the correct spot.

So with under- (and I assume over-) full boxes on pdflatex, we have a problem because the error is in the wrong group.

Interestingly, if you have the box error in a second input file where main.tex includes input1.tex includes input2.tex, the error is reported in the correct group.

MWE:

% main.tex
\documentclass{article}

\begin{document}

\input{inputfile.tex}

\end{document}

%inputfile.tex
\noindent \\

Full latexmk output:

Latexmk: applying rule 'pdflatex'...
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Arch Linux) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./main.tex
LaTeX2e <2018-12-01>
(/usr/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size10.clo)) (./main.aux)
(./inputfile.tex)
Underfull \hbox (badness 10000) in paragraph at lines 1--7

[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./main.aux) )
(see the transcript file for additional information)</usr/share/texmf-dist/font
s/type1/public/amsfonts/cm/cmr10.pfb>
Output written on main.pdf (1 page, 8186 bytes).
Transcript written on main.log.
=== TeX engine is 'pdfTeX'
Latexmk: All targets () are up-to-date

The only solution I can think of right now is to remember the last .tex file added to the filestack and use that if the next error is a box warning and otherwise forget about it.

I welcome alternative ideas because I don't have many. @jlelong you've worked on a lot of file tree parsing for this project, can you look at this a bit?

Yes, I will have a look at the problem. As you request, I close this issue and you open a new one with the MWE.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jose-a-sa picture jose-a-sa  路  4Comments

mdrozdo picture mdrozdo  路  4Comments

seanmcbreen picture seanmcbreen  路  4Comments

fsonntag picture fsonntag  路  4Comments

TiemenSch picture TiemenSch  路  6Comments