The -file-line-error
command line flag for tex
, latex
, etc., is very effective. When you have a large project with plenty of files, the error message indicates very clearly not only the line number, but also the name of the file in which it occurred.
Unfortunately, this flag does nothing for warnings. What's the most effective way to find the name of the file in which under- or over- full warnings occur? Ideally, this could be done without resorting to an IDE.
The answers provided to the following questions are neat and related:
- How to find the error line in a multi file document
- Warnings and errors highlighting when compiling in Bash environment
- How to easily determine the full name of the latex file when a build error occurs?
- Adjust line numbers in error messages
Clarification
The problem becomes difficult when you have several levels of nesting and large log files (mine range between 5,000 and 30,000 lines, with lots of mostly useless information.)
A file open in indicated in the log by (filename
, while a file close is
indicated by )
. Now, suppose you have a main file which inputs section files, each of which inputs several subsection files, each of which inputs tables and figures.
Suppose that you see an overfull message in line 17,432 in your log file, which says that the error occurred at input line 182. You have two options:
- search for line 182 in all files that make your project
- do a backward search in your log file, carefully balancing open and close parenthesis until you find which of the input files was active at line 17,432
of the log file.
Here is an actual excerpt from my .log
file. Note that there are many open and close parenthesis in it which are not related to file inclusion. Also observe that input line numbers are missing from the last message in this excerpt.
21983 LaTeX Font Info: Font shape `T1/ptm/bx/n' in size not available 21984 (Font) Font shape `T1/ptm/b/n' tried instead on input line 21. 21985 21986 Overfull \hbox (9.91599pt too wide) in paragraph at lines 14--22 21987 \T1/ptm/m/n/10 (\T1/ptm/b/n/10 N\T1/ptm/m/n/10 umber of \T1/ptm/b/n/10 I\T1/ptm 21988 /m/n/10 nstance \T1/ptm/b/n/10 V\T1/ptm/m/n/10 ariables), \T1/ptm/b/n/10 MTE \ 21989 T1/ptm/m/n/10 (\T1/ptm/b/n/10 M\T1/ptm/m/n/10 u\T1/ptm/b/n/10 t\T1/ptm/m/n/10 a 21990 bility (\T1/ptm/b/n/10 E\T1/ptm/m/n/10 xplicit)), 21991 [] 21992 21993 21994 Underfull \vbox (badness 10000) has occurred while \output is active []
Best Answer
Search the
.log
file for the stringerfull
(either in text editor or command-line tool). This will give you all the overfull and underfull box warnings. The warnings will tell you which lines in the source file the error came from, and the log file will also indicate which PDF page the error occurred on.As you read through the log file you can see each inputted subfile as it is opened. The warnings that occur after each filename pertain to the line numbers in that file.
I have concocted a example to demonstrate this, which I hope will not be too confusing. The file below is structured like so:
Main file includes
section.tex
section.tex
inputstable1.tex
section.tex
inputssubsection.tex
subsection.tex
inputstable2.tex
Both of the table files create egregious box overflows.
The first
erfull
warning in the main.log
file is this:Looking at the generated subfiles
section.tex
andtable1.tex
, we can see that the overfulltabular
environment intable1.tex
starts on line 12 oftable1.tex
. This is the source of the12
at the beginning of the page range in the warning.table1
is input intosection.tex
, on line 11 ofsection.tex
. This is the source of the11
in the warning page range.So the log message may be translated as follows:
So to answer your question, how to find the name of the file in which the under- or overfull box occurs, it is in the file most recently referenced in the log file before the warning.
Here is the example: