summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/inputtrc/inputtrc.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/inputtrc/inputtrc.sty
Initial commit
Diffstat (limited to 'macros/latex/contrib/inputtrc/inputtrc.sty')
-rw-r--r--macros/latex/contrib/inputtrc/inputtrc.sty145
1 files changed, 145 insertions, 0 deletions
diff --git a/macros/latex/contrib/inputtrc/inputtrc.sty b/macros/latex/contrib/inputtrc/inputtrc.sty
new file mode 100644
index 0000000000..ccc48d177b
--- /dev/null
+++ b/macros/latex/contrib/inputtrc/inputtrc.sty
@@ -0,0 +1,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