[texhax] tex filename backtrace utility

Fehd, Ronald J. (CDC/CCHIS/NCPHI) rjf2 at CDC.GOV
Tue Feb 16 17:35:25 CET 2010


> Date: Sun, 14 Feb 2010 01:07:31 GMT
> From: karl at freefriends.org (Karl Berry)
> Subject: [texhax] tex filename backtrace utility
> 
> 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 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

I am glad to see this suggestion as I have occasional problems
identifying from which of my included files the error message is coming
from.

My primary language is SAS; this is an explanation of options used in
SAS to get line numbers from included (TeX:input) files.

SAS has two options that can be reset within the source file:
Source and source2.
Their values are Boolean; default for source is on;
Default for source2 is nosource2: off.

Option source shows all lines in the primary file being processed;
Source2 controls whether lines are shown from included files: secondary,
ternary, however deep you want to go, etc.

TeX has two commands, input and include;
The SAS command is %include for TeX input.
SAS does not have a conditional like TeX include + includeonly.

SAS syntax has two ways of doing the same thing:

1. /* echo all included statements to log */

Options source2; 
%include 'filename1.ext';
%include 'filename2.ext';

2. /* echo only named file */

Options nosource2;/* default value */
%include 'filename1.ext' /source2; 
%include 'filename2.ext';/* not echoed */

Suggestion for TeX implementation:

\input{FileName}

Extension for debugging:
\input[\source2]{FileName}

Where a definition of the TeX system-variable source2 
could be set either in the preamble or in the body.

... yeah, I know 'source2' contains a digit and is not an appropriate
TeX-var-name.


Ron Fehd  the {SAS} macro maven  CDC Atlanta GA USA RJF2 at cdc dot gov









More information about the texhax mailing list