summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/showlabels
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-07-25 16:26:12 +0000
committerKarl Berry <karl@freefriends.org>2008-07-25 16:26:12 +0000
commit25612c1391544e85c6b86500f806a1c52847f2db (patch)
tree02703e57f9997aed3539f826dbb1096be28308a5 /Master/texmf-dist/source/latex/showlabels
parentaa9ff27acad9d2877bb37d19d028b30a62ffcff3 (diff)
showlabels 1.6.3 (24jul08)
git-svn-id: svn://tug.org/texlive/trunk@9772 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/showlabels')
-rw-r--r--Master/texmf-dist/source/latex/showlabels/showlabels.dtx50
1 files changed, 31 insertions, 19 deletions
diff --git a/Master/texmf-dist/source/latex/showlabels/showlabels.dtx b/Master/texmf-dist/source/latex/showlabels/showlabels.dtx
index a094b911b61..c6f2c2dfe3d 100644
--- a/Master/texmf-dist/source/latex/showlabels/showlabels.dtx
+++ b/Master/texmf-dist/source/latex/showlabels/showlabels.dtx
@@ -2,7 +2,7 @@
%
%% This is the showlabels package
%%
-%% This software is copyright, 1999, 2001--2007, Norman Gray.
+%% This software is copyright, 1999, 2001--2008, Norman Gray.
%%
%% This program is free software; you can redistribute it and/or
%% modify it under the terms of the GNU General Public License
@@ -24,13 +24,13 @@
%% See the file LICENCE for a copy of the GPL.
%% You can also find an online copy at http://www.gnu.org/copyleft/gpl.html .
%%
-%% $Id: showlabels.dtx,v 1.32 2008/06/27 15:18:43 norman Exp $
+%% $Id: showlabels.dtx,v 1.34 2008/07/24 10:59:31 norman Exp $
%%
%
\def\filename{showlabels}
-\def\fileversion{1.6.2}
-\def\filedate{2008/06/27}
-\def\docdate{2008 June 27}
+\def\fileversion{1.6.3}
+\def\filedate{2008/07/24}
+\def\docdate{2008 July 24}
\def\filemaintainer{norman@astro.gla.ac.uk}
% \changes{v1.4}{2001/07/23}{Avoided defining RCSDate}
%<+package>\NeedsTeXFormat{LaTeX2e}
@@ -47,6 +47,7 @@
\newcommand\Lopt[1]{\textsf{#1}} % package options
\newcommand\file[1]{\texttt{#1}} % filename
%\newcommand\Lcount[1]{\textsl{\small#1}}
+\newcommand\Lenv[1]{\textsl{\{#1\}}}
\newcommand\pstyle[1]{\textsf{\{#1\}}} % packages
%% \url macro (url.sty does this better, but we don't want extra dependencies)
\def\setpathdots{\discretionary{.}{}{.}}
@@ -222,7 +223,7 @@
% The package might still work with \LaTeX2.09, but that's neither
% supported, nor even still tested.
%
-% This software is copyright, 1999, 2001--2007, Norman Gray.
+% This software is copyright, 1999, 2001--2008, Norman Gray.
% It is released under
% the terms of the GNU General Public Licence. See the copyright
% declaration at the top of file \texttt{showlabels.dtx}, and the file
@@ -236,9 +237,8 @@
%
% \subsection*{Other packages}
%
-% I know of, but have not yet played with, the package \pstyle{showkeys},
-% by David Carlisle. As far as I know, both packages do roughly the
-% same thing.
+% David Carlisle's \pstyle{showkeys} does roughly the same thing, but
+% it will only handle |\label| and |\cite| keys.
%
% \subsection*{History and Credits}
%
@@ -321,15 +321,23 @@
% \pstyle{amsmath} uses |\maketag@@@|, to form tags in equations.
% All we have to do is
% hook into the |\maketag@@@| macro, and use |\df@label|, which is
-% pre-defined with the current label name.
+% pre-defined with the current label name. If the |\df@label| is
+% empty (almost certainly because the user has used the
+% \Lenv{eqnarray} environment within \pstyle{amsmath}), then fall back
+% on the |\SL@labelname| contents instead.
+% \iffalse See tests t2 and t11\fi
% \begin{macrocode}
\let\SL@maketag@@@=\maketag@@@
\def\maketag@@@#1{%
\SL@maketag@@@{#1}%
- \ifx\SL@labelname\@empty
-% \SL@eqnlrtext{???}% it's not clear to me when this would happen
+ \ifx\df@label\@empty
+ \ifx\SL@labelname\relax
+ \SL@eqnlrtext{???}% it's not clear to me when this would happen
+ \else
+ \SL@eqnlrtext{\SL@labelname}%
+ \fi
\else
- \SL@eqnlrtext{\SL@labelname}%
+ \SL@eqnlrtext{\df@label}%
\fi
}
\else
@@ -356,13 +364,13 @@
\global\let\SL@labelname\relax
\fi
}
+\fi
% \end{macrocode}
% \end{macro}
% And initialise the value of |\SL@labelname| to |\relax|, so that
% |\@eqnnum| starts off behaving the right way.
% \begin{macrocode}
- \global\let\SL@labelname\relax
-\fi
+\global\let\SL@labelname\relax
% \end{macrocode}
%
% Labels are printed with the font specified by |\showlabelfont|, which
@@ -472,9 +480,13 @@
% itself invisible, too. Command sequence |\SL@setlabel| is what does
% the work -- this is |\let| equal to either |\SL@margtext| or
% |\SL@inlinetext| below.
+%
+% We must declare |\SL@showlabels| to be a robust command, or else we
+% get confusing expansion problems when, for example, we do
+% |\showlabels{ref}| and use |\ref| in a caption (see test case t3).
% \begin{macrocode}
-\def\SL@showlabels#1{%
- \def\@tempa{\csname SL@orig#1\endcsname}
+\DeclareRobustCommand\SL@showlabels[1]{%
+ \def\@tempa{\csname SL@orig#1\endcsname}%
\@ifnextchar[\SL@showlabelsopt\SL@showlabelsplain
}
\def\SL@showlabelsopt[#1]#2{%
@@ -524,8 +536,8 @@
% Save the label name in |\SL@labelname|, so we can use it later
% (this is redundant in most \pstyle{amsmath} contexts, because that
% style generally saves this in |\df@label|, but sometimes -- for
-% example when using eqnarray within \pstyle{amsart} -- it seems not
-% to be; in any case, it's simpler just to use |\SL@labelname| all the time).
+% example when using the traditional \Lenv{eqnarray} environment
+% within \pstyle{amsart} -- |\df@label| can end up unset).
% \begin{macrocode}
\ifmmode
\xdef\SL@labelname{\SL@prlabelname{#1}}%