# 10  Recovery from errors

If TeX2page reports an error on your document, you may be able to deduce the cause from the diagnostic information that TeX2page displays on standard output. If you failed to look at this information as it was being displayed, you can always retrieve it from the log file jobname.hlog. This is exactly analogous to TeX generating diagnostic information on standard output and keeping a copy thereof in the file jobname.log.

This diagnostic information may not be enough to track down the error. TeX provides various commands for generating more diagnostics -- TeX2page recognizes the same syntax to provide its own diagnostics. For instance, the tracing directives `\tracingcommands` and `\tracingmacros` produce more log information. Setting `\tracingcommands=1` tells TeX2page to log all calls to atomic commands. Setting `\tracingmacros=1` tells TeX2page to log all macro expansions. You may turn on these traces at any point in your document. You may subsequently turn them off by setting `\tracingcommands=0` and `\tracingmacros=0` respectively.

The command `\tracingall` turns on both `\tracingcommands` and `\tracingmacros`.

The TeX command `\errmessage` can be used to generate meaningful error messages. TeX2page, like TeX, ceases processing the document on encountering `\errmessage`.

The TeX command `\message` can be used to print helpful information at selected break points in the document. LaTeX users may prefer `\typeout`, which does the same thing.

All of these commands display their information on both standard output and in the log file. Judicious use of these commands should pinpoint any error.