I've a large document partitioned into several files and glued together with \input and \include. To improve detecting errors it would be quite helpful if everytime a new file is entered pdflatex would write an identification text. Is that possible and how? Thanks

  • 1
    The \includeonly command should help to filter the faulty \include ones...
    – user31729
    Commented Aug 29, 2016 at 20:41
  • Solved: It turns out the error was stored in and old *.toc or *.out and it was related to the use of an accented letter inside a \label, even though all my document is utf8. I had noticed the problem before, but using \label{Efusión} was a recent addition. Fran: I've implemented your suggestion. @David Carlisle: I love your suggestion, I'll modify my compile bash to use that!!! Thanks Commented Aug 30, 2016 at 2:57

2 Answers 2


The log marks the opening of each file with (/path/to/file and the closing of each file by ) so by matching () pairs in the log you can see which file is being read as any any error or message is output.

To avoid matching () pairs for error messages you can use (with web2c based tex implementations) the -file-line-error commandline option in which error messages are prefixed with filename:linenumber instead of the traditional l.linenumber

  • Your suggestion was included in my compile bash: <code> #! /bin/bash # compile.sh - script to compile the indicated *.tex file. # Usage: compile.sh input .... wil compile input.tex in=$1 #echo "${in}" if [ -f "${in}.tex" ]; then texclean texfot pdflatex -file-line-error ${in}.tex #grep 'LaTeX Warning' ${in}.log bibtex ${in} texfot pdflatex -file-line-error ${in}.tex texfot pdflatex -file-line-error ${in}.tex else echo "${in}.tex NO existe!!!" echo "Use: $0 foo to compile foo.tex!" fi Commented Aug 30, 2016 at 5:11

There are already in your log file some indications as (./subfile.tex) when \input{subfile} is loaded, but if you want to see some more explicit in the log file, use \typeout.

\typeout{--- here come my first subfile ---}
\typeout{--- here come my second subfile ---}
  • It worked fine! Thanks. I edited my *.tex files to reflect starting and ending with your suggestion. Commented Aug 30, 2016 at 5:08
  • @samcarter Thanks. I didn't know that step. I had voted up the useful answers. In fact both suggestions have worked and I'm using them, but I cannot check both. Commented Aug 31, 2016 at 11:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .