summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-12-08 00:12:55 +0000
committerKarl Berry <karl@freefriends.org>2006-12-08 00:12:55 +0000
commit46b8a6fe6247a9476df0a843a54793d042ac2196 (patch)
treebaf017ba6a634f9f0fa7012a5c4544a1eee062a8 /Master/texmf-dist/source
parent7f549680dc21a5a0b6c80ce7b1252b232d8535ff (diff)
srcltx update (7dec06)
git-svn-id: svn://tug.org/texlive/trunk@2624 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/srcltx/srcltx.dtx191
1 files changed, 138 insertions, 53 deletions
diff --git a/Master/texmf-dist/source/latex/srcltx/srcltx.dtx b/Master/texmf-dist/source/latex/srcltx/srcltx.dtx
index 86f7534725f..83a2d489750 100644
--- a/Master/texmf-dist/source/latex/srcltx/srcltx.dtx
+++ b/Master/texmf-dist/source/latex/srcltx/srcltx.dtx
@@ -10,7 +10,7 @@
% \iffalse
%<*package>
%<latex>\NeedsTeXFormat{LaTeX2e}
-%<latex>\ProvidesPackage{srcltx}[2004/10/05 v1.5 Source specials for inverse search in DVI files]
+%<latex>\ProvidesPackage{srcltx}[2006/11/12 v1.6 Source specials for inverse search in DVI files]
%</package>
%
%<*driver>
@@ -61,7 +61,7 @@ pdfpagemode=None,
% \fi
%
%
-% \CheckSum{336}
+% \CheckSum{394}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -213,12 +213,6 @@ pdfpagemode=None,
% \subsection{Commands}
% \begin{descr}
%
-% \item[\Com{SRCOKtrue}, \Com{SRCOKfalse}] You can use these commands to
-% activate\slash deactivate source specials at any place in your
-% document, e.g. when you experience problems with some special
-% constructions (see also `Bugs and Restrictions' in section
-% \ref{sec:bugs}).
-%
% \item[\Com{Input}\marg{filename}] In order to keep track
% of the current filename, the \LaTeX\ commands
% \Com{include}\marg{filename} and \Com{input}\marg{filename}
@@ -234,22 +228,63 @@ pdfpagemode=None,
% also need to specify the file name extension (e.g.
% \file{.tex}) in the argument of this command.
%
-% \item[\Com{MainFile}] By default, the \TeX\ primitive |\jobname| contains the name of the
+% \item[\Com{MainFile}] Usually the \TeX\ primitive |\jobname| contains the name of the
% ``main'' TeX file, without the filename extension `\file{.tex}'.
% Accordingly, |\MainFile| is defined as |\jobname.tex|.
-% If your implementation does already add the extension
-% to |\jobname|, you should redefine this command as follows:
+% If you have a very awkward \TeX\ implementation that already adds the extension
+% to |\jobname|, you compensate for this by redefining this command as follows
+% (after loading \package{srcltx.sty}):
%
% \noindent\begin{tabular}{@{}l@{}}
% |\def\MainFile{\jobname}|
% \end{tabular}
+%
+% \item[\Com{srcIncludeHook}] This is a hook that is called by the \Com{include}
+% command. It takes the argument of that command and sets \Com{CurrentInput}
+% to that argument (or a modified version thereof); the content of \Com{CurrentInput}
+% is used as file name in the source specials. This hook can be used
+% to write a customized file name into the source specials. For example,
+% if the \file{.tex} source file is automatically generated from some
+% master document, the source specials in the DVI file could point
+% to that master document instead of the generated \file{.tex} file.
+%
+% Its default definition is:
+%
+% \noindent\begin{tabular}{@{}l@{}}
+% |\newcommand*\srcIncludeHook[1]{% |\\
+% | \protected@xdef\CurrentInput{#1.tex}}|
+% \end{tabular}
+%
+% \noindent
+% (for \LaTeX, similar with \Com{def} for \TeX).
+%
+% \item[\Com{srcInputHook}] This is similar to \Com{srcIncludeHook}, but for the \Com{input}
+% command.
+%
+% Its default definition is:
+%
+% \noindent\begin{tabular}{@{}l@{}}
+% |\newcommand*\srcInputHook[1]{\src@getfilename@with@ext{#1}}|
+% \end{tabular}
+%
+% \noindent
+% (for \LaTeX, similar with \Com{def} for \TeX); \Com{src@getfilename@with@ext}
+% will append a `.tex' extension to the filename if it doesn't already end
+% with `.tex'.
+%
+% \item[\Com{SRCOKtrue}, \Com{SRCOKfalse}] You can use these commands to
+% activate\slash deactivate source specials at any place in your
+% document, e.g. when you experience problems with some special
+% constructions (see also `Bugs and Restrictions' in section
+% \ref{sec:bugs}).
+%
% \end{descr}
%
% \section{Bugs and Restrictions}\label{sec:bugs}
%
% Since this macro package overloads some internal \LaTeX\ commands, it
-% is not as robust as one might wish, and may interact badly with other
-% packages. Furthermore, the spacing may be altered by using the
+% is not as robust as one might wish, and might interact badly with other
+% packages. Furthermore, the spacing might be altered by using the
% package; for example, with the \file{amsmath} documentation \file{amsldoc.tex},
% the bibliography is shifted from the bottom of page 31 to page 32.
% Therefore you should comment out the package or disable it with the
@@ -262,7 +297,7 @@ pdfpagemode=None,
% or in te\TeX\ from version beta-20011103 or teTeX-2.0 upwards. See the manual of your
% \TeX\ implementation for details on this.}
% You can still load \package{srcltx.sty} with the `\texttt{inactive}' option to enable
-% the WinEdt error tracking features.
+% the WinEdt error tracking features when needed.
%
% This section lists known incompatibilities with other packages and workarounds for these.
% If you know of any other problems, please send a bug report to
@@ -287,17 +322,23 @@ pdfpagemode=None,
%
% \section{History}
%
-% This package was originally written by A.~Simonic, the WinEdt Shell
-% author, to implement a source file tracking and DVI source specials
+% This package was originally written by A.~Simonic, the author of the WinEdt Shell,
+% to implement source file tracking and DVI source specials
% for \TeX. D.~P.~Carlisle and B.~K.~Horn have contributed bug
% fixes. Further changes and conversion to \file{ltxdoc} format by S.~Ulrich.
% Thanks for patches and suggestions to: A.~Cherepanov, J.~Rawnsley, D.~Kastrup,
-% D.~Arseneau and M.~S.~Gr\o nsleth.
+% D.~Arseneau, M.~S.~Gr\o nsleth and R.~Hemmecke.
%
%
% \StopEventually{}
% \section{Implementation}
%
+% \changes{v1.6}{2006/11/12}{Provide \Com{srcInputHook} and \Com{srcIncludeHook} for changing
+% the input filename on-the-fly,
+% as requested by Ralf Hemmecke for his Axiom and ALLPROSE packages.
+% Also fixed \Com{src@getfilename@with@ext} so that it doesn't append `.tex' any
+% more in cases where the filename had a complex extension (e.g. `foo.bar.tex')
+% with the last element `.tex'.}
% \changes{v1.5}{2004/10/05}{Fixed version number in documentation, and made \Com{input} append .tex
% extension if not yet present (feature requested by Martin Sigurd Gr\o nsleth).}
% \changes{v1.4}{2004/05/15}{Fixed \Com{everypar} hook, as suggested by David Kastrup in comp.text.tex,
@@ -399,6 +440,24 @@ pdfpagemode=None,
%<latex> }{}%
}
% \end{macrocode}
+% \begin{macro}{\srcIncludeHook}
+% Hook to set the name of the current input file (\Com{CurrentInput}) for the \Com{include} command.
+% \begin{macrocode}
+%<latex>\newcommand*\srcIncludeHook[1]{\protected@xdef\CurrentInput{#1.tex}}
+%<tex>\def\srcIncludeHook#1{\xdef\CurrentInput{#1.tex}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\srcInputHook}
+% Hook to set the name of the current input file (\Com{CurrentInput}) for the \Com{Input} command.
+% \begin{macrocode}
+%<latex>\newcommand*\srcInputHook[1]{%
+%<tex>\def\srcInputHook#1{%
+ \src@getfilename@with@ext{#1}%
+}
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\src@spec}
% Macro that actually inserts the special.
% \begin{macrocode}
@@ -422,12 +481,10 @@ pdfpagemode=None,
% \begin{macrocode}
%<latex>\newcommand\src@before@file@hook{}
%<latex>\newcommand\src@after@file@hook{}
-\def\src@before@file@hook#1{%
-%<latex> \protected@xdef\CurrentInput{#1}%
-%<tex> \xdef\CurrentInput{#1}%
+\def\src@before@file@hook{%
\WinEdt{<+ \CurrentInput}%
\global\src@lastline=0
- \ifSRCOK\special{src:1\CurrentInput}\fi
+ \ifSRCOK\special{src:1\src@maybe@space\CurrentInput}\fi
}
\def\src@after@file@hook#1{%
\WinEdt{<-}%
@@ -441,39 +498,63 @@ pdfpagemode=None,
% \end{macro}
%
% \begin{macro}{\src@getfilename@with@ext}
-% Check if \verb+#1+ has the extension \verb+#2+, and if not, append it, saving the
-% result to \Com{src@fname}.
+% Check if \verb+#1+ has the extension `.tex', and if not, append it, saving the
+% result to \Com{CurrentInput}. \emph{Warning:} This does not completely mimick
+% the behaviour of \Com{input}, since it also expands a filename `foo.sty' to
+% `foo.sty.tex' even if `foo.sty' exists. However in the context of this
+% package that doesn't matter much since we assume that files that don't have
+% a `.tex' extension won't create any content in the DVI file.
+%
+% The command \Com{src@extensions@path} is similar to \Com{filename@parse}
+% from \file{latex.ltx}.
% \begin{macrocode}
%<*latex>
-\newcommand*\src@fname{}
-\newcommand*\src@getfilename@with@ext[2]{%
- \src@@getfilename@with@ext#1.\end{#2}%
- \PackageInfo{srcltx}{Expanded filename `#1' to `\src@fname'}%
+\newcommand*\src@fname{}%
+\newcommand*\src@tempa{}%
+\newcommand*\src@extensions@path{}%
+\newcommand*\src@getfilename@with@ext{}%
+%</latex>
+%<*tex>
+\def\src@tempa{}%
+%</tex>
+\def\src@extensions@path#1.#2\end{%
+%<*latex>
+ \ifthenelse{\equal{#2}{}}{%
+ \protected@edef\src@extensions@last{#1}%
+ \let\src@tempa\relax
+ }{%
+ \def\src@tempa{\src@extensions@path#2\end}%
+ }%
+%</latex>
+%<*tex>
+ \ifx\\#2\\
+ \edef\src@extensions@last{#1}%
+ \let\src@tempa\relax
+ \else
+ \def\src@tempa{\src@extensions@path#2\end}%
+ \fi
+%</tex>
+ \src@tempa
}
-\newcommand*\src@@getfilename@with@ext{}
-\def\src@@getfilename@with@ext#1.#2\end#3{%
- \ifthenelse{\equal{#2}{}}{%
-% \end{macrocode}
-% Empty extension: Add \verb+#3+.
-% \begin{macrocode}
- \def\src@fname{#1.#3}%
+\def\src@getfilename@with@ext#1{%
+ \expandafter\src@extensions@path#1.\end
+%<*latex>
+ \ifthenelse{\equal{\src@extensions@last}{tex}}{%
+ \protected@xdef\CurrentInput{#1}%
}{%
- \ifthenelse{\equal{#2}{#3.}}{%
-% \end{macrocode}
-% \verb+#2+ is the correct extension, but now contains a trailing dot:
-% replace with \verb+#3+.
-% \begin{macrocode}
- \def\src@fname{#1.#3}%
- }{%
-% \end{macrocode}
-% \verb+#2+ is a wrong extension and contains a trailing dot:
-% append \verb+#3+.
-% \begin{macrocode}
- \def\src@fname{#1.#2#3}%
- }%
+ \protected@xdef\CurrentInput{#1.tex}%
}%
-}
+ \PackageInfo{srcltx}{Expanded filename `#1' to `\CurrentInput'}%
%</latex>
+%<*tex>
+ \def\src@tempa{tex}%
+ \ifx\src@extensions@last\src@tempa
+ \xdef\CurrentInput{#1}%
+ \else
+ \xdef\CurrentInput{#1.tex}%
+ \fi
+%</tex>
+}
% \end{macrocode}
% \end{macro}
%
@@ -491,7 +572,8 @@ pdfpagemode=None,
\expandafter\src@@include\expandafter{\CurrentInput}{#1}%
}%
\def\src@@include#1#2{%
- \src@before@file@hook{#2.tex}%
+ \srcIncludeHook{#2}%
+ \src@before@file@hook
\src@include{#2}%
\src@after@file@hook{#1}%
}
@@ -523,8 +605,8 @@ pdfpagemode=None,
\expandafter\src@@@input\expandafter{\CurrentInput}{#1}%
}
\def\src@@@input#1#2{%
- \src@getfilename@with@ext{#2}{tex}% this sets \src@fname
- \src@before@file@hook{\src@fname}%
+ \srcInputHook{#2}%
+ \src@before@file@hook
\src@input{#2}%
\src@after@file@hook{#1}%
}
@@ -538,7 +620,8 @@ pdfpagemode=None,
\expandafter\src@Input\expandafter{\CurrentInput}{#1}%
}
\def\src@Input#1#2{%
- \src@before@file@hook{#2}%
+ \srcInputHook{#2}%
+ \src@before@file@hook
\src@input #2
\src@after@file@hook{#1}%
}
@@ -596,7 +679,9 @@ pdfpagemode=None,
\expandafter\src@@bibliography\expandafter{\CurrentInput}{#1}%
}
\def\src@@bibliography#1#2{%
- \src@before@file@hook{\jobname.bbl}%
+%<latex> \protected@xdef\CurrentInput{\jobname.bbl}%
+%<tex> \xdef\CurrentInput{\jobname.bbl}%
+ \src@before@file@hook
\src@bibliography{#2}%
\src@after@file@hook{#1}%
}