diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/tools/showkeys.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/tools/showkeys.dtx | 207 |
1 files changed, 148 insertions, 59 deletions
diff --git a/Master/texmf-dist/source/latex/tools/showkeys.dtx b/Master/texmf-dist/source/latex/tools/showkeys.dtx index e64dbda0956..9a3c1fcc5c8 100644 --- a/Master/texmf-dist/source/latex/tools/showkeys.dtx +++ b/Master/texmf-dist/source/latex/tools/showkeys.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 +% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -8,12 +8,12 @@ % ------------------------------------------------------- % % It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3 +% conditions of the LaTeX Project Public License, either version 1.3c % of this license or (at your option) any later version. % The latest version of this license is in % http://www.latex-project.org/lppl.txt -% and version 1.3 or later is part of all distributions of LaTeX -% version 2003/12/01 or later. +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. % % The list of all files belonging to the LaTeX `Tools Bundle' is % given in the file `manifest.txt'. @@ -21,6 +21,7 @@ % \fi % \iffalse %% File: showkeys.dtx Copyright (C) 1992-1997 David Carlisle +%% File: showkeys.dtx Copyright (C) 2006 David Carlisle, LaTeX3 Project % %<*dtx> \ProvidesFile{showkeys.dtx} @@ -30,7 +31,7 @@ %<driver> \ProvidesFile{showkeys.drv} % \fi % \ProvidesFile{showkeys.dtx} - [1997/06/12 v3.12 Show cite and label keys (DPC)] + [2006/01/09 v3.13 Show cite and label keys (DPC)] % % \iffalse %<*driver> @@ -56,7 +57,7 @@ % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% \CheckSum{516} +% \CheckSum{592} % % % \changes{v1.01}{1992/08/25}{Initial version} @@ -134,6 +135,17 @@ % to honour an informal convention that packages have these options in % pairs. % +% You can also control the appearance of the typeset label with the +% command |\showkeyslabelformat|, which takes one argument. The default is +% \begin{verbatim} +% \providecommand*\showkeyslabelformat[1]{% +% \fbox{\normalfont\small\ttfamily#1}} +% \end{verbatim} +% The command is called inside a group so you can put in local +% modifications of |\fboxsep|, for instance, without them leaking to +% the rest of the document. +% +% % \section{More Examples}\label{examples} % The only other similar package that I could find in the macro index, % \cite{DMJ:mi}, was |showlabels.sty|, \cite{GN:sl}. After the first @@ -361,7 +373,17 @@ % \end{macrocode} % \end{macro} % +% +% +% \begin{macro}{\showkeyslabelformat} +% \changes{v3.13}{2006/01/09}{Added command} +% \begin{macrocode} +\providecommand*\showkeyslabelformat[1]{% + \fbox{\normalfont\small\ttfamily#1}} +% \end{macrocode} +% \end{macro} % \begin{macro}{\SK@@label} +% \changes{v3.13}{2006/01/09}{Do not hardwire label format} % Strip off the initial segment of the |\meaning| output, and then put % the rest either in a |\marginpar| or in a box of size 0pt, % hopefully not disturbing the surrounding text. @@ -372,8 +394,7 @@ % the counter will be printed in a different group to the |\label| % command. % \begin{macrocode} - \gdef\SK@lab{\smash{\SK@labelcolor\fbox{% - \normalfont\small\ttfamily#2}}}% + \gdef\SK@lab{\smash{\SK@labelcolor\showkeyslabelformat{#2}}}% \ifvmode \if@inlabel % \end{macrocode} @@ -495,59 +516,99 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\iftagsleft@} -% Make sure that this AMS\LaTeX\ command really is an |\if..| +% \begin{macro}{\tagform@} % \changes{v2.00}{1992/01/31} % {Defer tests to begin document} +% \changes{v3.02}{1995/03/17} +% {Support new AMS files} +% \begin{macro}{\@eqnnum} +% \changes{v3.13}{2006/01/09} +% {Change to also work correctly for \texttt{leqno} option.} +% \begin{macro}{\maketag@@@} +% \changes{v3.13}{2006/01/09} +% {Support for \cs{tag*} tools/3693.} +% Firstly we grab |\@eqnnum|. % \begin{macrocode} \AtBeginDocument{% \let\SK@eqnnum\@eqnnum - \def\@tempa{\let\iftagsleft@\iffalse}% - \ifx\iftagsleft@\undefined\@tempa\fi% % \end{macrocode} -% \end{macro} -% -% \begin{macro}{\tag@form@} -% \changes{v3.02}{1995/03/17} -% {Support new AMS files} -% \begin{macro}{\eqnnum} -% Perhaps if |leqno| is operative, I should define |\@eqnnum| with the -% `left' version, but it does not really matter. -% \begin{macrocode} - \let\SK@tagform@\tagform@ - \iftagsleft@ - \def\tagform@#1{% - \ifx\df@label\@empty - \SK@lab@relax - \else - \expandafter\SK@@label\meaning\df@label\SK@ - \fi - \llap{\SK@lab\kern\marginparsep}% - \SK@lab@relax\SK@tagform@{#1}}% - \def\@eqnnum{% - \llap{\SK@lab\kern\displaywidth\kern\marginparsep}% - \SK@lab@relax\SK@eqnnum}% +% Then check for \textsf{amsmath} where we grab the internal commands +% |\tagform@| and |\maketag@@@|. Redefine them and redefine |\@eqnnum| +% as well. +% \begin{macrocode} + \@ifpackageloaded{amsmath}{% + \let\SK@tagform@\tagform@ + \let\SK@maketag@@@\maketag@@@ + \iftagsleft@ + \def\tagform@#1{% + \ifx\df@label\@empty + \SK@lab@relax + \else + \expandafter\SK@@label\meaning\df@label\SK@ + \fi + \llap{\SK@lab\kern\marginparsep}% + \SK@lab@relax\SK@tagform@{#1}}% + \def\maketag@@@#1{% + \ifx\df@label\@empty + \SK@lab@relax + \else + \expandafter\SK@@label\meaning\df@label\SK@ + \fi + \llap{\SK@lab\kern\marginparsep}\SK@lab@relax + \SK@maketag@@@{#1}% + }% + \def\@eqnnum{% + \llap{\SK@lab\kern\displaywidth\kern\marginparsep}% + \SK@lab@relax\SK@eqnnum}% + \else % \end{macrocode} -% +% Almost the same for tags on the right, except we use |\rlap| and +% typeset it after the tag. % \begin{macrocode} - \else - \def\tagform@#1{% - \ifx\df@label\@empty - \SK@lab@relax - \else - \expandafter\SK@@label\meaning\df@label\SK@ - \fi + \def\tagform@#1{% + \ifx\df@label\@empty + \SK@lab@relax + \else + \expandafter\SK@@label\meaning\df@label\SK@ + \fi % \end{macrocode} % \changes{v3.08}{1996/07/10}{Missing percent added. /2215} % \begin{macrocode} - \SK@tagform@{#1}% - \rlap{\kern\marginparsep\SK@lab}\SK@lab@relax}% - \def\@eqnnum{\SK@eqnnum\rlap{\kern\marginparsep\SK@lab}% - \SK@lab@relax}% - \fi} + \SK@tagform@{#1}% + \rlap{\kern\marginparsep\SK@lab}\SK@lab@relax}% + \def\maketag@@@#1{% + \ifx\df@label\@empty + \SK@lab@relax + \else + \expandafter\SK@@label\meaning\df@label\SK@ + \fi + \SK@maketag@@@{#1}% + \rlap{\kern\marginparsep\SK@lab}\SK@lab@relax + }% + \def\@eqnnum{\SK@eqnnum\rlap{\kern\marginparsep\SK@lab}% + \SK@lab@relax}% + \fi + }% +% \end{macrocode} +% If \textsf{amsmath} wasn't loaded we check explicitly if the +% \texttt{leqno} option was used in |\documentclass| and redefine +% accordingly. +% \begin{macrocode} + {% + \@ifundefined{ver@leqno.clo}{% + \def\@eqnnum{\SK@eqnnum\rlap{\kern\marginparsep\SK@lab}% + \SK@lab@relax}% + }{% + \def\@eqnnum{% + \llap{\SK@lab\kern\displaywidth\kern\marginparsep}% + \SK@lab@relax\SK@eqnnum}% + }% + }% +} % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\SK@labx} % Print the label, and then globally reset the print command to @@ -620,6 +681,30 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\SK@align*} +% \begin{macro}{\SK@alignat*} +% \begin{macro}{\SK@flalign*} +% \begin{macro}{\SK@gather*} +% \begin{macro}{\SK@multline*} +% \begin{macro}{\SK@equation*} +% \changes{v3.13}{2006/01/09} +% {Add the starred AMS environments for tools/3697.} +% Starred versions of the AMS environments. +% \begin{macrocode} +\expandafter\let\csname SK@align*\endcsname\SK@equationtrue +\expandafter\let\csname SK@alignat*\endcsname\SK@equationtrue +\expandafter\let\csname SK@flalign*\endcsname\SK@equationtrue +\expandafter\let\csname SK@gather*\endcsname\SK@equationtrue +\expandafter\let\csname SK@multline*\endcsname\SK@equationtrue +\expandafter\let\csname SK@equation*\endcsname\SK@equationtrue +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}{\SK@def} % \changes{v3.05}{1995/11/09} % {Macro added} @@ -652,18 +737,21 @@ % Even if \texttt{notref} option is used, need to fudge the % \textsf{varioref} commands as they use |\label| internally. % \changes{v3.04}{1995/10/30} -% {improve varioref support in notref option case, for tools/1744} +% {improve varioref support in notref option case, for +% tools/1744} +% \changes{v3.13}{2006/01/09}{Updated varioref support, for latex/3373} % \begin{macrocode} \AtBeginDocument{% - \ifx\vpageref\@undefined\else + \@ifpackageloaded{varioref}{% \SK@def\@@vpageref#1[#2]#3{{% \let\label\SK@label \SK@@@vpageref#1[#2]{#3}}}% - \DeclareRobustCommand\vref[1]{% - \unskip~\ref{#1}% + \def\vr@f#1{% + \leavevmode\unskip\vref@space + \ref{#1}% {\let\label\SK@label - \SK@@@vpageref\unskip[\unskip\space]{#1}}}% - \fi} + \vpageref[\unskip]{#1}}}% + }{}} \else % \end{macrocode} % @@ -680,18 +768,19 @@ \AtBeginDocument{% \SK@def\ref#1{\SK@\SK@@ref{#1}\SK@ref{#1}}% \SK@def\pageref#1{\SK@\SK@@ref{#1}\SK@pageref{#1}}% - \ifx\vpageref\@undefined\else % \end{macrocode} % varioref support. % \begin{macrocode} + \@ifpackageloaded{varioref}{% \SK@def\@@vpageref#1[#2]#3{{% \let\label\SK@label\let\ref\SK@ref\let\pageref\SK@pageref \leavevmode\unskip\SK@\SK@@ref{#3}\SK@@@vpageref#1[#2]{#3}}}% - \DeclareRobustCommand\vref[1]{% - \unskip~\ref{#1}% - {\let\label\SK@label\let\ref\SK@ref\let\pageref\SK@pageref - \SK@@@vpageref\unskip[\unskip\space]{#1}}}% - \fi} + \def\vr@f#1{% + \leavevmode\unskip\vref@space + \ref{#1}% + \let\label\SK@label\let\ref\SK@ref\let\pageref\SK@pageref + \vpageref[\unskip]{#1}}% + }{}} % \end{macrocode} % % \begin{macrocode} |