Department of Engineering

IT Services

Debugging LaTeX

Here I'll mention just a few ways to debug LaTeX.

Enabling info

LaTeX has boxes (which have height, depth, width and a reference point) and glue (which has space, stretch and shrink). It has 6 modes (vertical, etc) which affect the behaviour of commands. To find out more about how the processing of your file is affected by these, you can add


to your file, which will slightly increase the output to the screen, and greatly increase the size of the log file. Though the file isn't very easy to read, if may supply vital clues.


Latex and associated programs make use of the same facility to search for files. You can run the facility independently to determine configuration details -

  • kpsewhich --show-path=ls-R - shows where ls-R files are sought.
  • kpsewhich --show-path=tex - shows where .tex files are sought.
  • kpsewhich -debug=32 packagename.sty - shows which packagename.sty file is used - and why.
  • kpsewhich --progname=latex packagename.sty - shows which packagename.sty file will be used by latex (different latex-related programs may use different paths)


Several packages offer debug options. For example, the geometry package (that lets you set margins, etc) offers showframe (which draws boxes around significant regions) and verbose.