diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/ltxcmds.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/oberdiek/ltxcmds.dtx | 325 |
1 files changed, 314 insertions, 11 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/ltxcmds.dtx b/Master/texmf-dist/source/latex/oberdiek/ltxcmds.dtx index 9fca42f980f..505a8f99320 100644 --- a/Master/texmf-dist/source/latex/oberdiek/ltxcmds.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/ltxcmds.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2009 by Heiko Oberdiek <oberdiek@uni-freiburg.de> +% Copyright (C) 2009, 2010 by Heiko Oberdiek <oberdiek@uni-freiburg.de> % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -73,7 +73,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: ltxcmds 2009/12/12 v1.1 LaTeX kernel commands for general use (HO)} +\Msg{* Package: ltxcmds 2010/01/28 v1.2 LaTeX kernel commands for general use (HO)} \Msg{************************************************************************} \keepsilent @@ -84,7 +84,7 @@ This is a generated file. -Copyright (C) 2009 by Heiko Oberdiek <oberdiek@uni-freiburg.de> +Copyright (C) 2009, 2010 by Heiko Oberdiek <oberdiek@uni-freiburg.de> This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either @@ -147,7 +147,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{ltxcmds.drv}% - [2009/12/12 v1.1 LaTeX kernel commands for general use (HO)]% + [2010/01/28 v1.2 LaTeX kernel commands for general use (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc}[2008/08/11] \usepackage{zref-savepos} @@ -157,7 +157,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{409} +% \CheckSum{569} % % \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 @@ -178,7 +178,7 @@ and the derived files % \GetFileInfo{ltxcmds.drv} % % \title{The \xpackage{ltxcmds} package} -% \date{2009/12/12 v1.1} +% \date{2010/01/28 v1.2} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -288,6 +288,91 @@ and the derived files % The local context discards the side effect of \cs{csname} % and let the command undefined after the expansion step. % +% \subsection{Stripping} +% +% \begin{declcs}{ltx@RemovePrefix}\\ +% \cs{ltx@StripPrefix} +% \end{declcs} +% All tokens up to and including the next available character +% `\textgreater' are thrown away. Usually it is used to strip +% the first part of the output of the commands \cs{meaning} +% or \cs{pdflastmatch}. Macro \cs{ltx@RemovePrefix} +% has the same meaning as \LaTeX's \cs{strip@prefix}, whereas +% macro \cs{ltx@StripPrefix} expands the next token +% once before stripping the prefix. +% +% \subsection{File management} +% +% All macros in this section are expandable like +% the counterparts of the \LaTeX\ kernel. Also they +% can be used after the preamble. +% +% \subsubsection{File extensions} +% +% \begin{declcs}{ltx@clsextension}\\ +% \cs{ltx@pkgextension} +% \end{declcs} +% If \cs{@clsextension}\slash\cs{@pkgextension} exists then +% \cs{ltx@clsextension}\slash\cs{ltx@pkgextension} +% returns this macro, otherwise the result is |cls|\slash|sty|. +% +% \subsubsection{Load check} +% +% \begin{declcs}{ltx@ifclassloaded} \M{class} \M{yes} \M{no}\\ +% \cs{ltx@ifpackageloaded} \M{package} \M{yes} \M{no} +% \end{declcs} +% If the \meta{class}\slash\meta{package} are loaded the +% macros \cs{ltx@ifclassloaded}\slash\cs{ltx@ifpackageloaded} +% call the \meta{yes} argument. Otherwise \meta{no} is executed. +% Both \meta{class} and \meta{package} are specified without +% extension. +% +% \begin{declcs}{ltx@iffileloaded} \M{file} \M{yes} \M{no} +% \end{declcs} +% If \LaTeX's \cs{ProvidesFile} macro was called before +% using \meta{file} as argument, then \cs{ltx@iffileloaded} +% calls \meta{yes}, otherwise \meta{no}. +% Therefore it is possible +% that the \meta{file} is loaded, but \meta{no} is executed because +% of a missing \cs{ProvidesFile}. The \LaTeX\ kernel does not have +% a counterpart of \cs{ltx@iffileloaded}. +% +% Note that the file name used in \cs{ProvidesFile} and +% \cs{ltx@iffileloaded} must match. For example, if \TeX's +% default extension \xext{.tex} was given in the first command, +% then it must also specified in the latter command and vice versa. +% +% \subsubsection{Version date check} +% +% \begin{declcs}{ltx@ifclasslater} \M{class} \M{date} \M{yes} \M{no}\\ +% \cs{ltx@ifpackagelater} \M{package} \M{date} \M{yes} \M{no}\\ +% \cs{ltx@iffilelater} \M{file} \M{date} \M{yes} \M{no} +% \end{declcs} +% If a \cs{ProvidesClass}\slash\cs{ProvidesPackage}\slash +% \cs{ProvidesFile} command with exact the same class\slash package\slash +% file was executed before with an optional +% argument that starts with a \LaTeX\ version date, then +% this version date is compared with the argument \meta{date}. +% If they are equal or if the version date is the later date, +% then \meta{yes} is called. In all other cases \meta{no} is executed. +% +% A \LaTeX\ date has the format |YYYY/MM/DD| with |YYYY| as year +% with four digits, |MM| as month with two digits and |DD| as day +% with two digits. If \pdfTeX's \cs{pdfmatch} is available, then +% it is used to detect the version date, to reject invalid +% date formats and to reject some invalid dates. +% Dates before 1994/01/01 are always invalid, because version +% dates are introduced with \LaTeXe\ in 1994. +% +% \subsection{Macro additions} +% +% \begin{declcs}{ltx@GlobalAppendToMacro} \M{cmd} \M{addition}\\ +% \cs{ltx@LocalAppendToMacro} \M{cmd} \M{addition} +% \end{declcs} +% The \meta{addition} is appended to the parameterless macro \meta{cmd}. +% If \meta{cmd} is undefined or has the meaning \cs{relax}, then +% it will be initialized as empty macro before. +% % \StopEventually{ % } % @@ -363,7 +448,7 @@ and the derived files \fi \expandafter\x\csname ver@ltxcmds.sty\endcsname \ProvidesPackage{ltxcmds}% - [2009/12/12 v1.1 LaTeX kernel commands for general use (HO)] + [2010/01/28 v1.2 LaTeX kernel commands for general use (HO)] % \end{macrocode} % % \begin{macrocode} @@ -371,7 +456,7 @@ and the derived files \catcode123 1 % { \catcode125 2 % } \def\x{\endgroup - \expandafter\edef\csname ltx@AtEnd\endcsname{% + \expandafter\edef\csname LTXcmds@AtEnd\endcsname{% \catcode35 \the\catcode35\relax \catcode64 \the\catcode64\relax \catcode123 \the\catcode123\relax @@ -384,14 +469,25 @@ and the derived files \catcode123 1 % { \catcode125 2 % } \def\TMP@EnsureCode#1#2{% - \edef\ltx@AtEnd{% - \ltx@AtEnd + \edef\LTXcmds@AtEnd{% + \LTXcmds@AtEnd \catcode#1 \the\catcode#1\relax }% \catcode#1 #2\relax } +\TMP@EnsureCode{40}{12}% ( +\TMP@EnsureCode{41}{12}% ) +\TMP@EnsureCode{45}{12}% - +\TMP@EnsureCode{46}{12}% . +\TMP@EnsureCode{47}{12}% / +\TMP@EnsureCode{60}{12}% < \TMP@EnsureCode{61}{12}% = +\TMP@EnsureCode{62}{12}% > +\TMP@EnsureCode{91}{12}% [ \TMP@EnsureCode{96}{12}% ` +\TMP@EnsureCode{93}{12}% ] +\TMP@EnsureCode{94}{12}% ^ (superscript) (!) +\TMP@EnsureCode{124}{12}% | % \end{macrocode} % % \subsection{Argument killers} @@ -566,8 +662,203 @@ and the derived files } % \end{macrocode} % +% \subsection{Stripping} +% +% \begin{macro}{\ltx@RemovePrefix} +% \begin{macrocode} +\def\ltx@RemovePrefix#1>{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ltx@StripPrefix} % \begin{macrocode} -\ltx@AtEnd +\def\ltx@StripPrefix{% + \expandafter\ltx@RemovePrefix +} +% \end{macrocode} +% \end{macro} +% +% \subsection{File management} +% +% \subsubsection{File extensions} +% +% \begin{macro}{\ltx@clsextension} +% \begin{macrocode} +\def\ltx@clsextension{% + \ltx@ifundefined{@clsextension}{cls}\@clsextension +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ltx@pkgextension} +% \begin{macrocode} +\def\ltx@pkgextension{% + \ltx@ifundefined{@pkgextension}{sty}\@pkgextension +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Load check} +% +% \begin{macro}{\ltx@iffileloaded} +% \begin{macrocode} +\def\ltx@iffileloaded#1{% + \ltx@ifundefined{ver@#1}\ltx@secondoftwo\ltx@firstoftwo +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ltx@ifclassloaded} +% \begin{macrocode} +\def\ltx@ifclassloaded#1{% + \ltx@iffileloaded{#1.\ltx@clsextension}% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ltx@ifpackageloaded} +% \begin{macrocode} +\def\ltx@ifpackageloaded#1{% + \ltx@iffileloaded{#1.\ltx@pkgextension}% +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Version date check} +% +% \begin{macro}{\ltx@iffilelater} +% \begin{macrocode} +\def\ltx@iffilelater#1#2{% + \ltx@iffileloaded{#1}{% + \expandafter\LTXcmds@IfLater\expandafter{% + \number + \expandafter\expandafter\expandafter\LTXcmds@ParseVersion + \expandafter\expandafter\expandafter{% + \csname ver@#1\endcsname + }% + \expandafter}\expandafter{% + \number + \expandafter\LTXcmds@ParseVersion\expandafter{#2}% + }% + }\ltx@secondoftwo +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\LTXcmds@IfLater} +% \begin{macrocode} +\def\LTXcmds@IfLater#1#2{% + \ifcase 0% + \ifnum#1<19940101 % + \else + \ifnum#2<19940101 % + \else + \ifnum#2>#1 % + \else + 1% + \fi + \fi + \fi + \ltx@space + \expandafter\ltx@secondoftwo + \else + \expandafter\ltx@firstoftwo + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ltx@ifclasslater} +% \begin{macrocode} +\def\ltx@ifclasslater#1{% + \ltx@ifclasslater{#1.\ltx@clsextension}% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ltx@ifpackagelater} +% \begin{macrocode} +\def\ltx@ifpackagelater#1{% + \ltx@iffilelater{#1.\ltx@pkgextension}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\ltx@IfUndefined{pdfmatch}{% +% \end{macrocode} +% \begin{macro}{\LTXcmds@ParseVersion} +% \begin{macrocode} + \def\LTXcmds@ParseVersion#1{% + \LTXcmds@@ParseVersion#10000/00/00\@nil + }% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\LTXcmds@@ParseVersion} +% \begin{macrocode} + \def\LTXcmds@@ParseVersion#1#2#3#4/#5#6/#7#8#9\@nil{% + #1#2#3#4#5#6#7#8% + }% +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +}{% +% \end{macrocode} +% \begin{macro}{\LTXcmds@ParseVersion} +% \begin{macrocode} + \def\LTXcmds@ParseVersion#1{% + \ifnum\pdfmatch{% + ^% + (199[4-9]|[2-9][0-9][0-9][0-9])/% + (0[1-9]|1[0-2])/% + (0[1-9]|[1-2][0-9]|3[0-1])% + }{#1}=1 % + \ltx@StripPrefix\pdflastmatch1 % + \ltx@StripPrefix\pdflastmatch2 % + \ltx@StripPrefix\pdflastmatch3 % + \else + 0% + \fi + }% +} +% \end{macrocode} +% \end{macro} +% +% \subsection{Macro additions} +% +% \begin{macro}{\ltx@GlobalAppendToMacro} +% \begin{macrocode} +\def\ltx@GlobalAppendToMacro#1#2{% + \ifx\ltx@undefined#1% + \let#1\ltx@empty + \else + \ifx\relax#1% + \let#1\ltx@empty + \fi + \fi + \begingroup + \toks0\expandafter{#1#2}% + \xdef#1{\the\toks0}% + \endgroup +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ltx@LocalAppendToMacro} +% \begin{macrocode} +\def\ltx@LocalAppendToMacro#1#2{% + \global\let\LTXcmds@gtemp#1% + \ifx\ltx@undefined\LTXcmds@gtemp + \global\let\LTXcmds@gtemp\ltx@empty + \else + \ifx\relax\LTXcmds@gtemp + \global\letLTXcmds@gtemp\ltx@empty + \fi + \fi + \begingroup + \toks0\expandafter{\LTXcmds@gtemp#2}% + \xdef\LTXcmds@gtemp{\the\toks0}% + \endgroup + \let#1\LTXcmds@gtemp +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\LTXcmds@AtEnd %</package> % \end{macrocode} % @@ -854,6 +1145,18 @@ and the derived files % \item % \cs{ltx@IfUndefined} added. % \end{Version} +% \begin{Version}{2010/01/28 v1.2} +% \item +% \cs{ltx@RemovePrefix} and \cs{ltx@StripPrefix} added. +% \item +% \cs{ltx@ifclassloaded}, \cs{ltx@ifpackageloaded}, +% \cs{ltx@iffileloaded}, +% \cs{ltx@ifclasslater}, \cs{ltx@ifpackagelater}, +% \cs{ltx@iffilelater}, +% \cs{ltx@clsextension}, \cs{ltx@pkgextension} added. +% \item +% \cs{ltx@GlobalAppendMacro}, \cs{ltx@LocalAppendMacro} added. +% \end{Version} % \end{History} % % \PrintIndex |