[texhax] tex filename backtrace utility

Uwe Lueck uwe.lueck at web.de
Mon Oct 11 20:23:31 CEST 2010

Hi Karl, hi Ron,

would you consider 


such a "filename backtrace utility"?

I just was about to do such a "backtracing" job and took one and a half day to implement such a thing as LaTeX macros ...

-----Ursprüngliche Nachricht-----
Von: "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2 at CDC.GOV>
Gesendet: 16.02.2010 17:35:25
An: texhax at tug.org
Betreff: Re: [texhax] tex filename backtrace utility

>> 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.

The internal filename stack (\IT at filestack) could be made publicly available, 
but I didn't have a clear idea about relevant practical use. 

And I cannot follow all of this (Ron):

>I am glad to see this suggestion as I have occasional problems
>identifying from which of my included files the error message is coming
>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;

Sure? TeX has a command \input. LaTeX has a command 
\input (different from TeX's \input) and a command \include. 
LaTeX has additional input commands: \documentclass, 
\LoadClass, ... \RequirePackage, \usepackage, ... 
\InputIfFileExists ...



>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:
>Extension for debugging:
>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
>Ron Fehd  the {SAS} macro maven  CDC Atlanta GA USA RJF2 at cdc dot gov

More information about the texhax mailing list