summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/inputtrc/inputtrc.sty
blob: ccc48d177b2779e5d8f92ead89bd25d133330a55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{inputtrc}[2012/10/10 v0.3 input tracing (UL)]

%% Copyright (C) 2010 2011 2012 Uwe Lueck, 
%% http://www.contact-ednotes.sty.de.vu 
%% -- author-maintained in the sense of LPPL below -- 
%%
%% This file can be redistributed and/or modified under 
%% the terms of the LaTeX Project Public License; either 
%% version 1.3c of the License, or any later version.
%% The latest version of this license is in
%%     http://www.latex-project.org/lppl.txt
%% We did our best to help you, but there is NO WARRANTY. 
%%
%% Please report bugs, problems, and suggestions via 
%% 
%%   http://www.contact-ednotes.sty.de.vu 
%%
%% === Core Definitions ===
%% Initializations of indent, current filename, and filename stack: 
\gdef\IT@indent{\IT@indent@unit}
\xdef\IT@currfile{\jobname\space}
%% ... TODO: add `.tex' unless ...
\xdef\IT@filestack{\relax} 
%% ... `\relax' saves braces around job file name 
%% when the file stack is unbuilt. 
%%
%% |\IT@prim@input{<file>}| will replace \LaTeX's \cs{@@input}
%% (at certain places, see below).
\newcommand*{\IT@prim@input}[1]{%
  \typeout{\IT@indent\IT@currfile INPUTTING #1}%
%% ... TODO: option to write to `.log' only.
  \xdef\IT@filestack{{\IT@currfile}\IT@filestack}%
  \xdef\IT@currfile{#1}%
  \expandafter \gdef\expandafter \IT@indent\expandafter{%
    \IT@indent \IT@indent@unit}
  \@@input#1
  \expandafter\IT@pop@indent\IT@indent   \@nil
  \expandafter\IT@pop@file  \IT@filestack\@nil
  \IT@maybe@returnmessage                           %% v0.2
} 
\def\IT@pop@indent#1#2\@nil{\gdef\IT@indent{#2}}
\def\IT@pop@file  #1#2\@nil{%
  \gdef\IT@currfile{#1}\gdef\IT@filestack{#2}}
%% ... cf. LaTeX's `\@pushfilename'/`\@popfilename'.
\newcommand*{\IT@the@returnmessage}{%               %% v0.2
    \typeout{\IT@indent RETURNING TO \IT@currfile}}
%% ... the ``active" version of `\IT@maybe@returnmessage', 
%%     see below ...
%%
%% === Changing \LaTeX\ (Preparations) ===
%%
%% Changing \LaTeX's `\@@input' 
%% (that stores \TeX's primitive `\input')
%% is not easy 
%% (cf. Didier Verna on his 'fink' 
%%  package,\footnote{\url{http://ctan.org/pkg/fink}} 
%%  also 'inputfile'); 
%% but it should suffice to change two of the three
%% %% <- `the two' was wrong 2010/10/08b ->
%% \LaTeX\ commands that use `\@@input':
\newcommand\IT@InputIfFileExists[2]{%
  \IfFileExists{#1}%
    {#2\@addtofilelist{#1}\IT@prim@input\@filef@und}}
%% ... \LaTeX's version is `\long', as opposed to `\@input':
\newcommand*{\IT@input}[1]{%
  \IfFileExists{#1}{\IT@prim@input\@filef@und}%
                   {\typeout{No file #1.}}}
%% ... the third macro using `\@@input' is `\input'---too 
%% difficult for now. 
%%
%% Storing original \LaTeX:
\let\IT@ltx@InputIfFileExists\InputIfFileExists
\let\IT@ltx@input\@input
%%
%% === The User Commands ===
%% |\dotracinginputs| globally activates input tracing: 
\newcommand*{\dotracinginputs}{%
    \global \let \InputIfFileExists \IT@InputIfFileExists
    \global \let \@input            \IT@input}
%% |\notracinginputs| globally turns input tracing off: 
\newcommand*{\notracinginputs}{%
    \global \let \InputIfFileExists \IT@ltx@InputIfFileExists
    \global \let \@input            \IT@ltx@input}
%% |\setinputindentunit{<cmds>}| globally sets the ``indent unit"---the 
%% default setting is <cmds>~= `\space\space':
\newcommand*{\setinputindentunit}{\gdef\IT@indent@unit}
\setinputindentunit{\space\space}
%% |\dotracingreturns| activates the \texttt{RETURNING~TO} message--- 
\newcommand*{\dotracingreturns}{%
    \global \let \IT@maybe@returnmessage \IT@the@returnmessage} 
%% ---|\notracingreturns| turns it off---
\newcommand*{\notracingreturns}{%
    \global \let \IT@maybe@returnmessage \relax} 
%% %% <- was like \dotracingreturns 2012/10/03
%% ---\emph{not} activated is the default:
\notracingreturns
%% |\dotracinginputsreturns| activates \emph{both} `INPUTTING' and 
%% `RETURNING' messages:
\newcommand*{\dotracinginputsreturns}{%
    \dotracinginputs \dotracingreturns}
%% |\notracinginputsreturns| turns off \emph{both} `INPUTTING' and 
%% `RETURNING' messages:
\newcommand*{\notracinginputsreturns}{%
    \notracinginputs \notracingreturns}
%%
%% === Package Options ===
%% \label{sec:opt}
%% Package Option |[i]| issues |\dotracinginputs|
%% immediately after loading the package:
\DeclareOption{i}{\dotracinginputs}
%% Package Option |[r]| issues |\dotracingreturns|
%% immediately after loading the package:
\DeclareOption{r}{\dotracingreturns}
%% Package Option |[ir]| \emph{combines} the functionality 
%% of options `[i]' and `[r]':
\DeclareOption{ir}{\dotracinginputs\dotracingreturns}
\ProcessOptions
%%
\endinput
%%
%% == Coda ==
%% You can't overestimate my pride! 
%% \emph{That's one small step for a man---one giant leap for \TeX kind.}
%%
%% On the other hand, I probably exhausted the set of possible 
%% trials and errors (becoming euphoric when it suddenly worked).
%%
%% \bigskip \noindent \itshape
%% Dedicated to Koppa Aleph Rio Lord.
%% 
%% \bigskip \raggedleft 
%% Worms-Pfeddersheim~2010/10/08,~U.~L.

HISTORY

v0.1   2010/10/08   very first, installed on CTAN same day
v0.1a  2010/10/08   doc corrected: LaTeX commands using \@@input; 
                    manual page breaks -- installed on CTAN 2010/10/09 
v0.2   2010/10/09   \IT@maybe@returnmessage etc.
v0.2a  2010/11/11   updated LPPL version
v0.3   2012/10/03   \dotracingreturns corrected, [i], [r]; 
                    updated (C)
       2012/10/10   correcting doc. on options, three of them, 
                    \notracinginputsreturns