[texhax] tex filename backtrace utility

Uwe Lück uwe.lueck at web.de
Mon Feb 15 18:59:02 CET 2010

```At 02:07 14.02.10, Karl Berry wrote:
>Sometimes it would be helpful for tex debugging to get a "backtrace" of
>the files that tex is executing.  It could be something static, that
>reads a .log file (or maybe .fls file from -recorder) and reports on
>which files were opened and closed in some way that is readable for deep
>nesting.

I know this very well, had the problem twice recently. I would be happy
enough if file names were indented in the .log according to their nesting
level.

For this, it would suffice to reimplement the primitive \input, such that,
e.g., tracing mode could be switched on by a new primitive parameter
\tracinginputs.

More easily available: \input (LaTeX: \@@input) could be redefined by a
package. (I think I should do this within half an hour of hard thinking,
the main issue is reading the entire rest of the line, but of course,
releasing a package would need several hours.) Alternatively, a LaTeX
package could redefine LaTeX's input commands in some consistent way (pass
this to the LaTeX Project Team?).

In tracing mode, I would just issue an extra line like "TRACING INPUTS:
[file name]" with an indent according to the nesting level. The new \input
would do this, then step the nesting counter globally before issuing the
original primitive \input and re-step it afterwards.

Cheers,

Uwe.

>I seem to recall that auctex and presumably front ends have dealt with
>extracting the filenames, at least, out of the mess of garbage printed
>to the terminal on a typical run, parsing all the open/close parens, but
>I've been unable to find anything that works as a separate utility.
>
>Does anyone know of something to do this?
>
>Failing anything else, I wonder about adding a new primitive to pdftex
>to dump the input stack at any point.  Then we could get line numbers
>too, I expect.
>
>Thanks,
>Karl
>_______________________________________________
>TeX FAQ: http://www.tex.ac.uk/faq
>Mailing list archives: http://tug.org/pipermail/texhax/