summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/showlabels
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/showlabels
Initial commit
Diffstat (limited to 'macros/latex/contrib/showlabels')
-rw-r--r--macros/latex/contrib/showlabels/README38
-rw-r--r--macros/latex/contrib/showlabels/VERSION1
-rw-r--r--macros/latex/contrib/showlabels/lppl.txt416
-rw-r--r--macros/latex/contrib/showlabels/showlabels.dtx1070
-rw-r--r--macros/latex/contrib/showlabels/showlabels.html544
-rw-r--r--macros/latex/contrib/showlabels/showlabels.ins14
-rw-r--r--macros/latex/contrib/showlabels/showlabels.pdfbin0 -> 156657 bytes
-rw-r--r--macros/latex/contrib/showlabels/style.css260
8 files changed, 2343 insertions, 0 deletions
diff --git a/macros/latex/contrib/showlabels/README b/macros/latex/contrib/showlabels/README
new file mode 100644
index 0000000000..73daacd6bb
--- /dev/null
+++ b/macros/latex/contrib/showlabels/README
@@ -0,0 +1,38 @@
+Showlabels
+==========
+
+Put the names of `\labels` and other commands into the margins of a draft
+document.
+
+Version 1.8, 2016 June 9, http://purl.org/nxg/dist/showlabels.
+
+This class option helps you keep track of all the labels in your
+documents, by putting the name of the new label into the margin
+whenever either the `\label` command is used, or an equation is
+automatically numbered. It is compatible with the amsmath and hyperref
+packages.
+
+It is similar to, but does a little more than, the showkeys package.
+
+You invoke this package with the command `\usepackage{showlabels}` in the
+preamble. You can control where the labels appear -- in the margins or
+in the interline gaps -- and you can change the appearance of the
+formatted labels to some extent.
+
+As well, you can have the arguments to other commands besides `\label`
+displayed. This is fairly obviously useful for the `\cite` command, but
+it can be useful for `\ref` or `\begin` as well.
+
+The source code for the package is maintained at
+[bitbucket.org](https://bitbucket.org/nxg/showlabels). This site
+includes an issue tracker, where you can report bugs (or just mail me).
+
+This work is Copyright 1999, 2001-09, 2013-16, Norman Gray, and may be
+distributed and/or modified under the conditions of the LaTeX Project
+Public Licence, either version 1.3 of this licence or (at your option)
+any later version. See the distributed file lppl.txt for details.
+
+For more information, see showlabels.html in the distribution.
+
+Norman Gray
+http://nxg.me.uk
diff --git a/macros/latex/contrib/showlabels/VERSION b/macros/latex/contrib/showlabels/VERSION
new file mode 100644
index 0000000000..6259340971
--- /dev/null
+++ b/macros/latex/contrib/showlabels/VERSION
@@ -0,0 +1 @@
+1.8
diff --git a/macros/latex/contrib/showlabels/lppl.txt b/macros/latex/contrib/showlabels/lppl.txt
new file mode 100644
index 0000000000..2244313901
--- /dev/null
+++ b/macros/latex/contrib/showlabels/lppl.txt
@@ -0,0 +1,416 @@
+The LaTeX Project Public License
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+LPPL Version 1.3c 2008-05-04
+
+Copyright 1999 2002-2008 LaTeX3 Project
+ Everyone is allowed to distribute verbatim copies of this
+ license document, but modification of it is not allowed.
+
+
+PREAMBLE
+========
+
+The LaTeX Project Public License (LPPL) is the primary license under
+which the LaTeX kernel and the base LaTeX packages are distributed.
+
+You may use this license for any work of which you hold the copyright
+and which you wish to distribute. This license may be particularly
+suitable if your work is TeX-related (such as a LaTeX package), but
+it is written in such a way that you can use it even if your work is
+unrelated to TeX.
+
+The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE',
+below, gives instructions, examples, and recommendations for authors
+who are considering distributing their works under this license.
+
+This license gives conditions under which a work may be distributed
+and modified, as well as conditions under which modified versions of
+that work may be distributed.
+
+We, the LaTeX3 Project, believe that the conditions below give you
+the freedom to make and distribute modified versions of your work
+that conform with whatever technical specifications you wish while
+maintaining the availability, integrity, and reliability of
+that work. If you do not see how to achieve your goal while
+meeting these conditions, then read the document `cfgguide.tex'
+and `modguide.tex' in the base LaTeX distribution for suggestions.
+
+
+DEFINITIONS
+===========
+
+In this license document the following terms are used:
+
+ `Work'
+ Any work being distributed under this License.
+
+ `Derived Work'
+ Any work that under any applicable law is derived from the Work.
+
+ `Modification'
+ Any procedure that produces a Derived Work under any applicable
+ law -- for example, the production of a file containing an
+ original file associated with the Work or a significant portion of
+ such a file, either verbatim or with modifications and/or
+ translated into another language.
+
+ `Modify'
+ To apply any procedure that produces a Derived Work under any
+ applicable law.
+
+ `Distribution'
+ Making copies of the Work available from one person to another, in
+ whole or in part. Distribution includes (but is not limited to)
+ making any electronic components of the Work accessible by
+ file transfer protocols such as FTP or HTTP or by shared file
+ systems such as Sun's Network File System (NFS).
+
+ `Compiled Work'
+ A version of the Work that has been processed into a form where it
+ is directly usable on a computer system. This processing may
+ include using installation facilities provided by the Work,
+ transformations of the Work, copying of components of the Work, or
+ other activities. Note that modification of any installation
+ facilities provided by the Work constitutes modification of the Work.
+
+ `Current Maintainer'
+ A person or persons nominated as such within the Work. If there is
+ no such explicit nomination then it is the `Copyright Holder' under
+ any applicable law.
+
+ `Base Interpreter'
+ A program or process that is normally needed for running or
+ interpreting a part or the whole of the Work.
+
+ A Base Interpreter may depend on external components but these
+ are not considered part of the Base Interpreter provided that each
+ external component clearly identifies itself whenever it is used
+ interactively. Unless explicitly specified when applying the
+ license to the Work, the only applicable Base Interpreter is a
+ `LaTeX-Format' or in the case of files belonging to the
+ `LaTeX-format' a program implementing the `TeX language'.
+
+
+
+CONDITIONS ON DISTRIBUTION AND MODIFICATION
+===========================================
+
+1. Activities other than distribution and/or modification of the Work
+are not covered by this license; they are outside its scope. In
+particular, the act of running the Work is not restricted and no
+requirements are made concerning any offers of support for the Work.
+
+2. You may distribute a complete, unmodified copy of the Work as you
+received it. Distribution of only part of the Work is considered
+modification of the Work, and no right to distribute such a Derived
+Work may be assumed under the terms of this clause.
+
+3. You may distribute a Compiled Work that has been generated from a
+complete, unmodified copy of the Work as distributed under Clause 2
+above, as long as that Compiled Work is distributed in such a way that
+the recipients may install the Compiled Work on their system exactly
+as it would have been installed if they generated a Compiled Work
+directly from the Work.
+
+4. If you are the Current Maintainer of the Work, you may, without
+restriction, modify the Work, thus creating a Derived Work. You may
+also distribute the Derived Work without restriction, including
+Compiled Works generated from the Derived Work. Derived Works
+distributed in this manner by the Current Maintainer are considered to
+be updated versions of the Work.
+
+5. If you are not the Current Maintainer of the Work, you may modify
+your copy of the Work, thus creating a Derived Work based on the Work,
+and compile this Derived Work, thus creating a Compiled Work based on
+the Derived Work.
+
+6. If you are not the Current Maintainer of the Work, you may
+distribute a Derived Work provided the following conditions are met
+for every component of the Work unless that component clearly states
+in the copyright notice that it is exempt from that condition. Only
+the Current Maintainer is allowed to add such statements of exemption
+to a component of the Work.
+
+ a. If a component of this Derived Work can be a direct replacement
+ for a component of the Work when that component is used with the
+ Base Interpreter, then, wherever this component of the Work
+ identifies itself to the user when used interactively with that
+ Base Interpreter, the replacement component of this Derived Work
+ clearly and unambiguously identifies itself as a modified version
+ of this component to the user when used interactively with that
+ Base Interpreter.
+
+ b. Every component of the Derived Work contains prominent notices
+ detailing the nature of the changes to that component, or a
+ prominent reference to another file that is distributed as part
+ of the Derived Work and that contains a complete and accurate log
+ of the changes.
+
+ c. No information in the Derived Work implies that any persons,
+ including (but not limited to) the authors of the original version
+ of the Work, provide any support, including (but not limited to)
+ the reporting and handling of errors, to recipients of the
+ Derived Work unless those persons have stated explicitly that
+ they do provide such support for the Derived Work.
+
+ d. You distribute at least one of the following with the Derived Work:
+
+ 1. A complete, unmodified copy of the Work;
+ if your distribution of a modified component is made by
+ offering access to copy the modified component from a
+ designated place, then offering equivalent access to copy
+ the Work from the same or some similar place meets this
+ condition, even though third parties are not compelled to
+ copy the Work along with the modified component;
+
+ 2. Information that is sufficient to obtain a complete,
+ unmodified copy of the Work.
+
+7. If you are not the Current Maintainer of the Work, you may
+distribute a Compiled Work generated from a Derived Work, as long as
+the Derived Work is distributed to all recipients of the Compiled
+Work, and as long as the conditions of Clause 6, above, are met with
+regard to the Derived Work.
+
+8. The conditions above are not intended to prohibit, and hence do not
+apply to, the modification, by any method, of any component so that it
+becomes identical to an updated version of that component of the Work as
+it is distributed by the Current Maintainer under Clause 4, above.
+
+9. Distribution of the Work or any Derived Work in an alternative
+format, where the Work or that Derived Work (in whole or in part) is
+then produced by applying some process to that format, does not relax or
+nullify any sections of this license as they pertain to the results of
+applying that process.
+
+10. a. A Derived Work may be distributed under a different license
+ provided that license itself honors the conditions listed in
+ Clause 6 above, in regard to the Work, though it does not have
+ to honor the rest of the conditions in this license.
+
+ b. If a Derived Work is distributed under a different license, that
+ Derived Work must provide sufficient documentation as part of
+ itself to allow each recipient of that Derived Work to honor the
+ restrictions in Clause 6 above, concerning changes from the Work.
+
+11. This license places no restrictions on works that are unrelated to
+the Work, nor does this license place any restrictions on aggregating
+such works with the Work by any means.
+
+12. Nothing in this license is intended to, or may be used to, prevent
+complete compliance by all parties with all applicable laws.
+
+
+NO WARRANTY
+===========
+
+There is no warranty for the Work. Except when otherwise stated in
+writing, the Copyright Holder provides the Work `as is', without
+warranty of any kind, either expressed or implied, including, but not
+limited to, the implied warranties of merchantability and fitness for a
+particular purpose. The entire risk as to the quality and performance
+of the Work is with you. Should the Work prove defective, you assume
+the cost of all necessary servicing, repair, or correction.
+
+In no event unless required by applicable law or agreed to in writing
+will The Copyright Holder, or any author named in the components of the
+Work, or any other party who may distribute and/or modify the Work as
+permitted above, be liable to you for damages, including any general,
+special, incidental or consequential damages arising out of any use of
+the Work or out of inability to use the Work (including, but not limited
+to, loss of data, data being rendered inaccurate, or losses sustained by
+anyone as a result of any failure of the Work to operate with any other
+programs), even if the Copyright Holder or said author or said other
+party has been advised of the possibility of such damages.
+
+
+MAINTENANCE OF THE WORK
+=======================
+
+The Work has the status `author-maintained' if the Copyright Holder
+explicitly and prominently states near the primary copyright notice in
+the Work that the Work can only be maintained by the Copyright Holder
+or simply that it is `author-maintained'.
+
+The Work has the status `maintained' if there is a Current Maintainer
+who has indicated in the Work that they are willing to receive error
+reports for the Work (for example, by supplying a valid e-mail
+address). It is not required for the Current Maintainer to acknowledge
+or act upon these error reports.
+
+The Work changes from status `maintained' to `unmaintained' if there
+is no Current Maintainer, or the person stated to be Current
+Maintainer of the work cannot be reached through the indicated means
+of communication for a period of six months, and there are no other
+significant signs of active maintenance.
+
+You can become the Current Maintainer of the Work by agreement with
+any existing Current Maintainer to take over this role.
+
+If the Work is unmaintained, you can become the Current Maintainer of
+the Work through the following steps:
+
+ 1. Make a reasonable attempt to trace the Current Maintainer (and
+ the Copyright Holder, if the two differ) through the means of
+ an Internet or similar search.
+
+ 2. If this search is successful, then enquire whether the Work
+ is still maintained.
+
+ a. If it is being maintained, then ask the Current Maintainer
+ to update their communication data within one month.
+
+ b. If the search is unsuccessful or no action to resume active
+ maintenance is taken by the Current Maintainer, then announce
+ within the pertinent community your intention to take over
+ maintenance. (If the Work is a LaTeX work, this could be
+ done, for example, by posting to comp.text.tex.)
+
+ 3a. If the Current Maintainer is reachable and agrees to pass
+ maintenance of the Work to you, then this takes effect
+ immediately upon announcement.
+
+ b. If the Current Maintainer is not reachable and the Copyright
+ Holder agrees that maintenance of the Work be passed to you,
+ then this takes effect immediately upon announcement.
+
+ 4. If you make an `intention announcement' as described in 2b. above
+ and after three months your intention is challenged neither by
+ the Current Maintainer nor by the Copyright Holder nor by other
+ people, then you may arrange for the Work to be changed so as
+ to name you as the (new) Current Maintainer.
+
+ 5. If the previously unreachable Current Maintainer becomes
+ reachable once more within three months of a change completed
+ under the terms of 3b) or 4), then that Current Maintainer must
+ become or remain the Current Maintainer upon request provided
+ they then update their communication data within one month.
+
+A change in the Current Maintainer does not, of itself, alter the fact
+that the Work is distributed under the LPPL license.
+
+If you become the Current Maintainer of the Work, you should
+immediately provide, within the Work, a prominent and unambiguous
+statement of your status as Current Maintainer. You should also
+announce your new status to the same pertinent community as
+in 2b) above.
+
+
+WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE
+======================================================
+
+This section contains important instructions, examples, and
+recommendations for authors who are considering distributing their
+works under this license. These authors are addressed as `you' in
+this section.
+
+Choosing This License or Another License
+----------------------------------------
+
+If for any part of your work you want or need to use *distribution*
+conditions that differ significantly from those in this license, then
+do not refer to this license anywhere in your work but, instead,
+distribute your work under a different license. You may use the text
+of this license as a model for your own license, but your license
+should not refer to the LPPL or otherwise give the impression that
+your work is distributed under the LPPL.
+
+The document `modguide.tex' in the base LaTeX distribution explains
+the motivation behind the conditions of this license. It explains,
+for example, why distributing LaTeX under the GNU General Public
+License (GPL) was considered inappropriate. Even if your work is
+unrelated to LaTeX, the discussion in `modguide.tex' may still be
+relevant, and authors intending to distribute their works under any
+license are encouraged to read it.
+
+A Recommendation on Modification Without Distribution
+-----------------------------------------------------
+
+It is wise never to modify a component of the Work, even for your own
+personal use, without also meeting the above conditions for
+distributing the modified component. While you might intend that such
+modifications will never be distributed, often this will happen by
+accident -- you may forget that you have modified that component; or
+it may not occur to you when allowing others to access the modified
+version that you are thus distributing it and violating the conditions
+of this license in ways that could have legal implications and, worse,
+cause problems for the community. It is therefore usually in your
+best interest to keep your copy of the Work identical with the public
+one. Many works provide ways to control the behavior of that work
+without altering any of its licensed components.
+
+How to Use This License
+-----------------------
+
+To use this license, place in each of the components of your work both
+an explicit copyright notice including your name and the year the work
+was authored and/or last substantially modified. Include also a
+statement that the distribution and/or modification of that
+component is constrained by the conditions in this license.
+
+Here is an example of such a notice and statement:
+
+ %% pig.dtx
+ %% Copyright 2005 M. Y. Name
+ %
+ % This work may be distributed and/or modified under the
+ % conditions of the LaTeX Project Public License, either version 1.3
+ % 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 2005/12/01 or later.
+ %
+ % This work has the LPPL maintenance status `maintained'.
+ %
+ % The Current Maintainer of this work is M. Y. Name.
+ %
+ % This work consists of the files pig.dtx and pig.ins
+ % and the derived file pig.sty.
+
+Given such a notice and statement in a file, the conditions
+given in this license document would apply, with the `Work' referring
+to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being
+generated from `pig.dtx' using `pig.ins'), the `Base Interpreter'
+referring to any `LaTeX-Format', and both `Copyright Holder' and
+`Current Maintainer' referring to the person `M. Y. Name'.
+
+If you do not want the Maintenance section of LPPL to apply to your
+Work, change `maintained' above into `author-maintained'.
+However, we recommend that you use `maintained', as the Maintenance
+section was added in order to ensure that your Work remains useful to
+the community even when you can no longer maintain and support it
+yourself.
+
+Derived Works That Are Not Replacements
+---------------------------------------
+
+Several clauses of the LPPL specify means to provide reliability and
+stability for the user community. They therefore concern themselves
+with the case that a Derived Work is intended to be used as a
+(compatible or incompatible) replacement of the original Work. If
+this is not the case (e.g., if a few lines of code are reused for a
+completely different task), then clauses 6b and 6d shall not apply.
+
+
+Important Recommendations
+-------------------------
+
+ Defining What Constitutes the Work
+
+ The LPPL requires that distributions of the Work contain all the
+ files of the Work. It is therefore important that you provide a
+ way for the licensee to determine which files constitute the Work.
+ This could, for example, be achieved by explicitly listing all the
+ files of the Work near the copyright notice of each file or by
+ using a line such as:
+
+ % This work consists of all files listed in manifest.txt.
+
+ in that place. In the absence of an unequivocal list it might be
+ impossible for the licensee to determine what is considered by you
+ to comprise the Work and, in such a case, the licensee would be
+ entitled to make reasonable conjectures as to which files comprise
+ the Work.
+
diff --git a/macros/latex/contrib/showlabels/showlabels.dtx b/macros/latex/contrib/showlabels/showlabels.dtx
new file mode 100644
index 0000000000..3a2c457965
--- /dev/null
+++ b/macros/latex/contrib/showlabels/showlabels.dtx
@@ -0,0 +1,1070 @@
+% \iffalse % meta-comment
+%
+%% This is the showlabels package
+%%
+%%%% Copyright 1999, 2001-09, 2013-16, Norman Gray
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public Licence, either version 1.3
+%% of this licence or (at your option) any later version.
+%% The latest version of this licence is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Norman Gray <http://nxg.me.uk>
+%%
+%% This work consists of the files showlabels.dtx and showlabels.ins,
+%% and the derived file showlabels.sty.
+
+%%%% File: showlabels.dtx
+%%%% Source: 95a544e6b41b, 2016-06-09T16:51:03+01:00
+
+\def\filename{showlabels}
+\def\fileversion{1.8}
+\def\filedate{2016/06/09}
+\def\docdate{2016 June 9}
+\def\filemaintainer{norman@astro.gla.ac.uk}
+% This is revision 95a544e6b41b, 2016-06-09T16:51:03+01:00.
+%<+package>\NeedsTeXFormat{LaTeX2e}
+%<+package>\ProvidesPackage{showlabels}[\filedate\space v\fileversion]
+%<+package>\typeout{Package: `showlabels' v\fileversion\space<\filedate>}
+%
+%<*driver>
+\documentclass{ltxdoc}
+\EnableCrossrefs
+% \end{macrocode}
+% Some commonly used abbreviations for option names, filenames,
+% counters and packages.
+% \begin{macrocode}
+\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\Lpackage[1]{\textsf{\{#1\}}} % packages
+%% \url macro (url.sty does this better, but we don't want extra dependencies)
+\def\setpathdots{\discretionary{.}{}{.}}
+\def\setpathslash{\discretionary{/}{}{/}}
+{\catcode`\.=\active
+ \catcode`\/=\active
+ \gdef\pathcats{%
+ \catcode`\%=12 \catcode`\~=12
+ \catcode`\.=\active \let.\setpathdots
+ \catcode`\/=\active \let/\setpathslash
+ \catcode`\#=12 \catcode`\_=12}%
+ }
+\def\setpath#1{\ttfamily <\nobreak #1\nobreak>\endgroup}
+\def\url{\begingroup\pathcats\setpath}
+\begin{document}
+% \OnlyDescription
+\DocInput{showlabels.dtx}
+\PrintIndex
+\end{document}
+%</driver>
+%
+% \fi
+%
+%
+% \title{The \texttt{\filename} package}
+% \author{Norman Gray\\|norman@astro.gla.ac.uk|}
+% \date{Version \fileversion, \docdate}
+%
+% \maketitle
+%
+% This package helps you keep track of all the labels you define, by
+% putting the name of new labels into the margin whenever the
+% |\label| command is used.
+%
+% You can do the same thing for other commands (see below).
+% The only one for which this is \emph{obviously} useful is the
+% |\cite| command, but it is also reasonable to do it with, for example,
+% the |\ref| or |\begin| commands.
+%
+% Invoke this package with the command |\usepackage{showlabels}| in
+% the preamble, and you may give the following options:
+% \begin{quotation}
+% \begin{tabular}{lp{25em}}
+% \Lopt{outer} & [default] all notes are placed in the text's outer
+% margin\\
+% \Lopt{inner} & \dots inner margin\\
+% \Lopt{left} & \dots left margin\\
+% \Lopt{right} & \dots right margin\\
+% \Lopt{marginal} & [default] put notes in the margin\\
+% \Lopt{inline} & put notes inline, as much as possible, and ignore
+% any of the margin-placement options above \\
+% \Lopt{nolabel} & do not insert a marginal note for |\label| commands
+% (see command |\showlabels| below)\\
+% \Lopt{draft} & [default] does nothing, partner of\dots\\
+% \Lopt{final} & turns off all the package's functionality
+% \end{tabular}
+% \end{quotation}
+% If you don't use the \Lopt{twoside} option,
+% then all pages are `right-hand' pages, and the `outer margin' is the
+% right hand one.
+%
+% The package will also work in the presence of the \Lopt{twocolumn}
+% option. In this case, the options \Lopt{inner}, \Lopt{outer},
+% \Lopt{left} and \Lopt{right} will be ignored, and the label will be
+% placed in the nearer margin.
+%
+% Finally, we have the options \Lopt{final} and \Lopt{draft}. The option
+% \Lopt{final} turns off all the functionality of this package. This
+% is included so that if that
+% option is given globally in the |\documentclass| declaration then this
+% package does respect it. The \Lopt{draft} option does nothing, and therefore
+% simply continues the default behaviour of this package; it is here
+% to partner the \Lopt{final} option.
+%
+% \DescribeMacro{\showlabels}
+% If you wish the package to do its magic with the command |\foo|
+% (most typically |\cite|), then give the command |\showlabels{foo}|.
+% The default behaviour of the package is to give the command
+% |\showlabels{label}| internally; if you don't want this to happen --
+% perhaps because you \emph{only} want |\cite| commands highlighted --
+% then give the option \Lopt{nolabel} to the |\usepackage| command:
+% |\usepackage[nolabel]{showlabels}|.
+%
+% By default, the package displays labels in the margin of the
+% document, but as an alternative, labels can be kept inline as much
+% as possible; this is much more legible when there are multiple
+% labels on a single line. To select this, give the option
+% \Lopt{inline}, and to select the default behaviour, use
+% \Lopt{marginal}.
+%
+% \DescribeMacro{\showlabelsinline}
+% It is sometimes convenient (for example when a document encounters a
+% situation which this package mishandles) to force inline labels
+% temporarily, within a block or environment. Use the
+% |\showlabelsinline| macro to do that.
+%
+% \subsection*{Formatting}
+%
+% If you want to change the font the labels appear in, redefine the
+% |\showlabelfont| command, which by default expands to
+% |\small\ttfamily|. For example, to have labels in a slanted font,
+% and green, you could include the definition
+% \begin{quote}
+% |\renewcommand{\showlabelfont}{\small\slshape\color{green}}|
+% \end{quote}
+% in the preamble of your document, as long as you have loaded the
+% \Lpackage{color} package.
+%
+% Alternatively, the |\showlabels| command has an optional argument containing
+% formatting commands, which allows you to format |\cite| labels, for
+% example, differently from |\label|. Thus:
+% \begin{quote}
+% |\showlabels[\color{green}]{cite}|
+% \end{quote}
+%
+% If, finally, you want complete control over the labels, you can
+% instead override |\showlabelsetlabel|, which initially expands to
+% just |\showlabelfont #1|. You can use this mechanism to get a
+% variety of effects. For example, if you say
+% \begin{quote}
+% |\usepackage{showlabels,rotating}|\\
+% |\renewcommand{\showlabelsetlabel}[1]|\\
+% \null\qquad |{\begin{turn}{60}\showlabelfont #1\end{turn}}|\\
+% \end{quote}
+% then you end up with your labels at a jaunty angle in the margin.
+% Finally, you can change the definition of the
+% |\showlabelrefline| rule from its default,
+% in order to change how the inline rule (see below) is displayed.
+% For example, defining this to be
+% |\color{red}\hrule width 0.1em height 1.5ex depth 0pt |
+% produces a fattish red line, and defining it to be
+% |\hrule width 0pt height 1.5ex depth 0pt|
+% suppresses the line but still positions the text between the lines.
+%
+% \subsection*{Compatibility with other packages, and other problems}
+%
+% The \Lpackage{showlabels} package works by redefining the |\label|
+% command, along with a few internal \LaTeX\ commands. All the other commands it
+% defines are `hidden' by prefixing them with `\texttt{SL@}', with
+% the exception of the user commands |\showlabelfont| and
+% |\showlabelsetlabel|. Each of
+% the three redefined commands carefully includes its previous
+% definition. The \Lpackage{showlabels} package should therefore come
+% \emph{last} of the packages you include using |\usepackage|.
+%
+% In version 1.1, the package was modified to conform to the slightly
+% different mechanism that \texttt{amsmath} uses to produce equation
+% numbers. Do note that the
+% |\usepackage{showlabels}| command \emph{must} appear after the
+% |\usepackage{amsmath}| if it is to detect that you are using the
+% \Lpackage{amsmath} package\footnote{Note that AMS-\LaTeX\ and the
+% \texttt{amstex} package have been declared `obsolete' in favour of
+% the \texttt{amsmath} package. This package now claims conformance
+% with the \texttt{amsmath} package alone, though it will probably
+% work with older versions in fact.}.
+%
+% In version 1.3e, the package became compatible with the
+% \Lpackage{hyperref} package in particular, and in general with other
+% packages which themselves modify the |\label| command. This will
+% work, however, only if the \Lpackage{showlabels} package is loaded
+% after other packages which do this. Notwithstanding Sebastian
+% Rahtz's excellent general advice on this, \Lpackage{showlabels} should
+% be loaded after \Lpackage{hyperref}.
+%
+% In version 1.7, the package became compatible with the
+% equation-numbering mechanism of the \Lpackage{IEEEtrantools}
+% package. As with \Lpackage{amsmath}, this involves a certain amount
+% of special-casing.
+%
+% For reasonably obvious reasons, this package will not work at all
+% well with the \Lpackage{multicol} package, and for possibly less obvious
+% reasons, it won't work with the \Lopt{leqno} option either (at some point
+% it should be modified to at least recognise and warn of the conflict in
+% either case, though it's not obvious to me how to do that). The
+% package \emph{should} now work with \Lpackage{wrapfig}, though I'm not
+% sure that I've exhausted that package's various clevernesses, and
+% there might be some spacing and layout bugs which manifest
+% themselves in that context. Please report them; in the mean time,
+% using option \Lopt{inline} should act as a workaround for any that
+% appear.
+%
+% When labels appear in the margins, they sometimes appear on the
+% `wrong' side in \Lopt{twoside} mode. This is a fairly inevitable
+% side-effect of the way that \TeX\ builds pages, and a specific
+% symptom of the general problem described in
+% \url{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=oddpage}.
+% As that answer suggests, there are bear-traps involved in the
+% standard solutions. Now, showlabels is (a)~permanently teetering
+% on the edge of clashing with everything else that messes around with
+% labels, and (b)~a draft-only package rather than anything that
+% would appear in a final document. (a)~means that I'm rather nervous
+% about putting too much cleverness in there, and incidentally shy of
+% putting any dependencies on other packages; (b)~means that I feel it
+% doesn't really matter enough to be worth removing robustness. So
+% I'm afraid I don't plan to change this, and I simply put up with the
+% occasional slip. Again the \Lopt{inline} option is a possible
+% workaround.
+%
+% The package might still work with \LaTeX2.09, but that's neither
+% supported, nor even still tested.
+%
+% This software is copyright, 1999, 2001--09, 2013--16 Norman Gray.
+% It is released under the terms of the LaTeX Project Public Licence.
+% See the copyright declaration at the top of file \texttt{showlabels.dtx},
+% and the file \texttt{lppl.txt}, for the licence conditions.
+%
+% The canonical home page of the package is
+% \url{http://purl.org/nxg/dist/showlabels}, and it is on CTAN at
+% \url{https://www.ctan.org/pkg/showlabels}. The source is in
+% a repository at Bitbucket: \url{https://bitbucket.org/nxg/showlabels/}.
+%
+% \subsection*{Other packages}
+%
+% The \Lpackage{showlabels} package has a large overlap in
+% functionality with David Carlisle's \Lpackage{showkeys}, although
+% the latter will only handle |\label| and |\cite| keys. If
+% \Lpackage{showlabels} fails in some particular situation, you might
+% want to try using \Lpackage{showkeys}, but please do mention the
+% problem, either by email to me, or via the Bitbucket issues list.
+%
+% \subsection*{History and Credits}
+%
+% I've received bug reports, fixes, or implementable suggestions from many
+% people, including
+% Andreas Balser,
+% bartgol (on Stackexchange),
+% Francesco Biccari,
+% Francis M. C. Ching,
+% Sven de Vries,
+% A L Dukeman,
+% Michael Friendly,
+% Guillermo Garza,
+% Tino G\"ortem\"oller,
+% Lester L. Helms,
+% Boris Kheyfets,
+% Hagen Kleinert,
+% David R. Leal Valmana,
+% Olivier Michel,
+% Enno Nagel,
+% Sungmo Park,
+% Ignacy Sawicki,
+% Andrei Shelankov,
+% Patrick Sibille,
+% `Stirling' (on Stackexchange),
+% Mariano Su\'arez-Alvarez,
+% Ji\v ri Vesely,
+% Elmar Walhorn,
+% Alex Watson,
+% Ben William Carabelli,
+% Roland Winkler.
+% Many thanks to all. If I've missed your name out of this list
+% (or indeed if I've alphabetised you incorrectly),
+% please accept my apologies, and do let me know.
+%
+% The package was originally released by me on 1991 September 21, under the name
+% \texttt{labels.sty}.
+% On 1992 January 29, Darrel Hankerson
+% \url{hank@ducvax.auburn.edu}, made the update to NFSS, and
+% changed the name to `showlabel.sty'.
+%
+%
+% \StopEventually{}
+%
+% \section{Implementation}
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}%
+% \iffalse
+% Update history:
+% October 94: Norman Gray (norman@astro.gla.ac.uk). Modified to be a
+% \LaTeX2e package.
+% 29-Jan-92 Darrel Hankerson (hank@ducvax.auburn.edu)
+% Update to NFSS. Change name to `showlabel.sty'. Substitute
+% \nintt -> \small\tt
+% \sevit -> \scriptsize\it
+% 21-Sep-91 Norman Gray no_gray@vax.acs.open.ac.uk
+% Original release of labels.sty
+% \fi
+%
+% Before we do anything else, find out if we're using \Lpackage{amsmath}\dots.
+% Note that, since these additions appeared, AMS-\LaTeX\ and the
+% \texttt{amstex} package seem to have been declared `obsolete'. This
+% package now claims conformance with the \texttt{amsmath} package.
+% \begin{macrocode}
+\newif\ifSL@AMS
+\@ifundefined{maketag@@@}
+ \SL@AMSfalse
+ {\SL@AMStrue\typeout{with amsmath equation tags}}
+% \end{macrocode}
+%
+% The command which sets equation text is |\SL@eqntext|, which tests
+% whether the content should be inline or not.
+% \begin{macrocode}
+\def\SL@eqntext{%
+ \ifSL@labelsinline
+ \let\@tempa\SL@interlinetextleft
+ \else
+ \let\@tempa\SL@eqnlrtext
+ \fi
+ \@tempa
+}
+% \end{macrocode}
+%
+% The |\SL@wrap@labeller| macro wraps the given macro in such a way
+% that we display the label.
+% \begin{macrocode}
+\def\SL@wrap@labeller#1{%
+ \expandafter\let\csname SL@orig@#1\expandafter\endcsname\csname #1\endcsname
+ \expandafter\def\csname #1\endcsname{%
+ \csname SL@orig@#1\endcsname
+ \ifx\SL@labelname\relax
+ % do nothing
+ \else
+ \SL@eqntext{\SL@labelname}%
+ \fi
+ \global\let\SL@labelname\relax}}
+% \end{macrocode}
+%
+% \begin{macro}{\@eqnnum}
+% This replacement for |\@eqnnum| will produce a note, sticking
+% into the margin beside the equation number, showing the equation's label.
+% |\SL@labelname| is initialised to |\relax|, redefined within the
+% |\label| macro, and reset to |\relax| here. If it's already equal
+% to |\relax| here, the equation number hasn't been labelled, and so
+% we avoid putting anything in the margin. In the \Lpackage{amsmath} case
+% we instead redefine |\maketag@@@|.
+%
+% First, deal with the case where the document uses the
+% \Lpackage{amsmath} macros.
+% \begin{macrocode}
+\ifSL@AMS
+% \end{macrocode}
+%
+% \Lpackage{amsmath} redefines |\label| to set the macro |\df@label|,
+% and then uses |\maketag@@@{\df@label}| or |\tagform@| to form tags
+% (ie, equation labels) in equations. So we hook into \emph{both} of
+% these macros. If the |\df@label| is
+% empty (almost certainly because the user has used the
+% \Lenv{eqnarray} environment within \Lpackage{amsmath}), then fall back
+% on the |\SL@labelname| contents instead.
+% \iffalse See tests t2, t11 and t18. \fi
+% We must make sure to leave |\SL@labelname| equal to |\relax| at the
+% end of this macro, otherwise a |{eqnarray}| followed by an (AMSTeX)
+% |\eqref| can end up with the wrong label being referred to by the
+% |\maketag@@@| within |\eqref| (or something like that).
+%
+% The test here must be |\ifx\SL@labelname\relax| with
+% |\global\let\SL@labelname\relax|, not |\expandafter\ifx\SL@...| and
+% |\global\def\SL@labelname{\relax}| (as it once was), since the
+% latter evaluates to true when |\SL@...| is |\relax| \emph{and} when
+% |\SL@...| starts with two identical characters, which is wrong (it
+% took embarrassingly many goes to get this right). The following is
+% similar to the effect of |\SL@wrap@labeller|, but is not quite identical,
+% because (a) |\maketag@@@| and |\tagform@| take an argument,
+% and (b) we also have to check |\df@label|.
+% \begin{macrocode}
+ \def\SL@setlabel@ams{%
+ \ifx\df@label\@empty
+ \ifx\SL@labelname\relax
+ % do nothing
+ \else
+ \SL@eqntext{\SL@labelname}%
+ \fi
+ \else
+ \SL@eqntext{\df@label}%
+ \fi
+ \global\let\SL@labelname\relax
+ }
+ \let\SL@orig@maketag@@@=\maketag@@@
+ \def\SL@maketag@@@#1{%
+ \SL@orig@maketag@@@{#1}%
+ \SL@setlabel@ams
+ }
+ \let\SL@orig@tagform@\tagform@
+ \def\SL@tagform@#1{%
+ \SL@orig@tagform@{#1}%
+ \SL@setlabel@ams
+ }
+\else
+% \end{macrocode}
+%
+% Next, deal with the `normal' case, without \Lpackage{amsmath}.
+% Package \Lpackage{amsmath} redefines |\@eqnnum| in terms of
+% |\maketag@@@|, so we should avoid doing this in the
+% non-\Lpackage{amsmath} case.
+% \begin{macrocode}
+ %% \let\SL@eqnnum=\@eqnnum
+ %% \def\@eqnnum{%
+ %% \SL@eqnnum
+ %% \ifx\SL@labelname\relax
+ %% % do nothing
+ %% \else
+ %% \SL@eqntext{\SL@labelname}%
+ %% \fi
+ %% \global\let\SL@labelname\relax
+ %% }
+ \SL@wrap@labeller{@eqnnum}
+\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
+% \end{macrocode}
+%
+% Labels are printed with the font specified by |\showlabelfont|, which
+% can be overridden within the document:
+% Define this using |\ttfamily|, unless we're still using \LaTeX 2.09
+% (surprising it still works!), in which case stick with |\tt|.
+% \begin{macrocode}
+\@ifundefined{ttfamily}
+ {\providecommand{\showlabelfont}{\small\tt}}
+ {\providecommand{\showlabelfont}{\small\ttfamily}}
+% \end{macrocode}
+%
+% If you want slightly more general control over the labels, you can
+% instead override |\showlabelsetlabel|.
+% \begin{macrocode}
+\providecommand{\showlabelsetlabel}[1]{{\normalfont\showlabelfont\SL@fmt@ #1}}
+% \end{macrocode}
+%
+% For the benefit of |\SL@prlabelname|, define |\SL@gobblethree| to do nothing
+% other than eat three tokens.
+% \begin{macrocode}
+\def\SL@gobblethree#1#2#3{}
+% \end{macrocode}
+%
+% \begin{macro}{\SL@prlabelname}
+% Expansion is label name with all catcodes `other' (Appendix~D trickery
+% abounds!). Use |\r@#1|, rather then just |\#1| to avoid defining any new
+% control sequences.
+% \begin{macrocode}
+\def\SL@prlabelname#1{%
+\expandafter\expandafter\expandafter\SL@gobblethree
+ \expandafter\string\csname r@#1\endcsname}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\showlabels}
+% Define the |\showlabels| command which allows us to redefine
+% commands which are to have their arguments highlighted.
+% That is, |\showlabels{foo}| means that the command |\foo{bar}| will
+% write `bar' in the margin, as well as executing whatever |\foo| does
+% normally.
+%
+% The net result of all this is that a |\showlabels{foo}| command
+% arranges things so that, after |\begin{document}|, |\foo{bar}| expands into
+% |\SL@setlabel{bar}\SL@origfoo{bar}|.
+%
+% First, define a command |\SL@initfoo|, which, when executed, will
+% save the current (at that time) behaviour of the command |\foo| as
+% |\@SL@origfoo|, and then set |\foo| to be equivalent to |\SL@foo|,
+% which does the magic; we will
+% shortly give this command to |\AtBeginDocument|, so that it is
+% switched on at the correct time, when other packages have done
+% \emph{their} redefinitions of |\foo| (this makes it compatible with
+% the \Lpackage{hyperref} package, which does its own wholesale redefinitions of
+% things like |\label|). Below, the locution
+% |\the\@temptokena| causes the token contents of |\@temptokena| to be
+% included unexpanded in the definition, despite the |\edef|.
+%
+% If the optional argument is present, then use this as per-command
+% formatting, so that, for example |\cite| instances may be formatted
+% distinctively from |\label|.
+% \begin{macrocode}
+\def\showlabels{\@ifnextchar[\showlabels@{\showlabels@[]}}
+\def\showlabels@[#1]#2{%
+ \@temptokena=\expandafter{\csname #2\endcsname}
+ \def\@tempa{#1}%
+ \ifx\@tempa\@empty
+ \expandafter\let\csname SL@fmt@#2\endcsname\relax
+ \else
+ \expandafter\def\csname SL@fmt@#2\endcsname{#1}%
+ \fi
+ \expandafter\edef\csname SL@init@#2\endcsname{%
+ \let\csname SL@orig#2\endcsname\the\@temptokena
+ \let\the\@temptokena\csname SL@#2\endcsname}
+ \AtBeginDocument{\csname SL@init@#2\endcsname}%
+% \end{macrocode}
+% \emph{Now} define |\SL@foo| -- it must be undefined when we define
+% |\SL@initfoo| above, so that it isn't expanded in the |\edef|.
+% \begin{macrocode}
+ \expandafter\def\csname SL@#2\endcsname{%
+ \expandafter\let\expandafter\SL@fmt@\csname SL@fmt@#2\endcsname
+ \SL@showlabels{#2}}
+}
+% \end{macrocode}
+%
+% We need a default definition of |\SL@fmt@| for the cases (some
+% equation formatting) where we don't get to the formatting via this
+% mechanism.
+% \begin{macrocode}
+\let\SL@fmt@\relax
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\SL@showlabels}
+% Now we get to the command which does the main processing. The
+% |\SL@showlabels| command calls |\SL@setlabel| to format the label
+% (putting it in the margin, for example), then calls the original
+% |\foo| command (namely |\SL@origfoo|) with the original argument.
+%
+% The command takes a single argument, namely the name of the command
+% being wrapped (for example, `label'). We set |\@tempa| to be the
+% original version of that command (stored in |\SL@orig#1|), and then
+% take one of two similar paths, depending on whether the command has
+% an optional argument or not.
+%
+% We have to be somewhat careful about the positioning of the
+% |\@bsphack| and |\@esphack| commands. The |\@esphack| command should
+% \emph{not} come after the call to |\SL@origfoo|, since that would
+% confuse things terribly if that command took any other arguments, or
+% otherwise messed with the token stream (there's actually no problem
+% in the most common case where we're replacing |\label|, and calling
+% |\SL@origlabel|, but there are problems when we try to replace
+% |\begin| or |\ref| in this way). Instead, adapt the contents
+% of |\@esphack|, but instead of calling |\ignorespaces| when
+% |\@savsk| is positive, add an |\hskip| of 1~scaled point (equal to
+% $1/65536\mathrm{pt}=5.363\times10^{-9}\mathrm{m}$). This will be
+% invisible, but it \emph{is} greater than zero, so that if
+% |\SL@origfoo| itself uses a |\@bsphack|\dots|\@esphack| pair then
+% the saved |\@savsk| will be positive, and that future |\@esphack|
+% will correctly invoke |\ignorespaces|; that pair will also pick up
+% the |\spacefactor| we restore here. The net result is that the
+% |\SL@setlabel| is invisible, and |\SL@origfoo| is able to make
+% 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).
+% We actually handle three distinct cases here, for |\foo{label}|,
+% |\foo[opt]{label}| and |\foo*{label}| (the last is to handle the
+% \Lpackage{hyperref} package's |\ref*{label}| variant; see test case t14).
+% \begin{macrocode}
+\DeclareRobustCommand\SL@showlabels[1]{%
+ \expandafter\let\expandafter\SL@orig@@next\csname SL@orig#1\endcsname
+ \@ifstar
+ {\SL@showlabelsplainstar}
+ {\@ifnextchar[
+ {\SL@showlabelsopt}
+ {\SL@showlabelsplain}}
+}
+\def\SL@showlabelsopt[#1]#2{%
+ \@bsphack
+ \SL@setlabel{#2}\relax
+ \ifhmode \spacefactor\@savsf \ifdim\@savsk>\z@ \hskip1sp \fi\fi
+ \SL@orig@@next[#1]{#2}%
+}
+\def\SL@showlabelsplain#1{%
+ \@bsphack
+ \SL@setlabel{#1}\relax
+ \ifhmode \spacefactor\@savsf \ifdim\@savsk>\z@ \hskip1sp \fi\fi
+ \SL@orig@@next{#1}%
+}
+\def\SL@showlabelsplainstar#1{%
+ \@bsphack
+ \SL@setlabel{#1}\relax
+ \ifhmode \spacefactor\@savsf \ifdim\@savsk>\z@ \hskip1sp \fi\fi
+ \SL@orig@@next*{#1}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@makecaption}
+% The |\@makecaption| command needs special treatment. The
+% |\SL@margtext| command doesn't work in figure captions, so we need
+% to force the layout commands to use |\SL@inlinetext| instead, for
+% all label types, and irrespective of whether we're using the
+% \Lopt{inline} option. The code here is independent of that in
+% |\showlabels|, but imitates it, for consistency.
+% \begin{macrocode}
+\def\SL@initmakecaption{%
+ \let\SL@origmakecaption\@makecaption
+ \def\@makecaption##1##2{{%
+ \let\SL@setlabel\SL@inlinetext
+ \SL@origmakecaption{##1}{##2}}}}
+\AtBeginDocument{\SL@initmakecaption}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\SL@margtext}
+% This is the central bit of this package, used by |\SL@showlabels|.
+% The argument is the argument of the |\foo| command which we're
+% processing (for example, the argument to a |\label| command).
+%
+% Depending on the mode, put the
+% current label name in the margin in one of a variety of ways.
+% \begin{macrocode}
+\def\SL@margtext#1{%
+% \end{macrocode}
+%
+% There are three cases here:
+% \begin{enumerate}
+% \item We are in maths mode, setting an equation.
+% \item We are not in maths mode but we \emph{are} within a display
+% (this can happen in, for example, the \Lenv{cases} environment from
+% the \Lpackage{cases} package).
+% \item We are in text.
+% \end{enumerate}
+%
+% Case 1:
+% In maths mode, produce a label name alongside the equation number.
+% Save the label name in |\SL@labelname|, so we can use it later
+% (this is redundant in most \Lpackage{amsmath} contexts, because that
+% style generally saves this in |\df@label|, but sometimes -- for
+% example when using the traditional \Lenv{eqnarray} environment
+% within \Lpackage{amsart} -- |\df@label| can end up unset).
+% \begin{macrocode}
+ \ifmmode
+ \xdef\SL@labelname{\SL@prlabelname{#1}}%
+% \end{macrocode}
+%
+% Case 2:
+% Check if we're within a display equation,
+% and if so act as if we are in maths mode (ie, as above).
+% Note: most contexts which match case~1 would also be caught by this
+% test, since |\label| is used almost exclusively within displays,
+% but it seems clearer to separate the two cases explicitly, as well
+% as probably dealing better with cases where the package is used for
+% non-|\label| commands.
+% \begin{macrocode}
+ \else\ifdim\displaywidth>0pt
+ \xdef\SL@labelname{\SL@prlabelname{#1}}%
+% \end{macrocode}
+%
+% Case 3:
+% Otherwise, create a box with zero height and depth, and the same width
+% as the page. Put all this in braces, to contain the setting of
+% |\box\@tempboxa| (which probably shouldn't be necessary). The box
+% here we set to be the width of |\hsize|. This is \emph{probably}
+% best, though there's always the worry that |\linewidth| would be the
+% more \LaTeX-ish thing to do -- using |\columnwidth| is almost
+% certainly wrong, since |\linewidth| can sometimes be changed without
+% |\columnwidth| changing with it (for example, in package
+% \Lpackage{wrapfig}), causing \Lpackage{showlabels} to fail badly.
+% \begin{macrocode}
+ \else
+ \setbox\@tempboxa=\vbox to 0pt{%
+ \vss
+ \hbox to \hsize{\SL@lrtext{#1}}}%
+ \dp\@tempboxa\z@
+% \end{macrocode}
+% Attach this box below the last one, using |\nointerlineskip| if we're in
+% vertical mode, or |\vadjust| otherwise. We need to save and restore
+% the value of |\prevdepth| (which has the sentinel value -1000pt if we're
+% adding this box at the beginning of a vertical list, and
+% |\nointerlineskip| sets |\prevdepth| to this same value). If we don't
+% do this, we get extra (`interline') vertical space added in this
+% case (it might be thought smart to use |\marginpar| here, and so
+% avoid some of this nonsense, but that's not possible since this
+% might be called within boxes, which |\marginpar| objects to).
+% \begin{macrocode}
+ \ifvmode
+ \@tempdima=\prevdepth
+ \nointerlineskip\box\@tempboxa\nobreak
+ \prevdepth=\@tempdima
+ \else
+ \vadjust{\box\@tempboxa\nobreak}%
+ \fi
+% \end{macrocode}
+% That's it. Finish off the sequence of cases.
+% \begin{macrocode}
+ \fi\fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\SL@inlinetext}
+% This is an alternative way of formatting the label, which puts it
+% inline as much as possible, and avoids straying into the margins.
+% We just use the same mechanism as for |\SL@margtext|, but do the
+% inline-or-not testing there.
+% \begin{macrocode}
+\def\SL@inlinetext#1{%
+ \SL@interlinetextright{\SL@prlabelname{#1}}%
+}
+% \end{macrocode}
+% In vmode, put the label between lines. Set the box depth to zero to
+% make sure that descenders don't mess up the spacing.
+% \begin{macrocode}
+\def\SL@interlinetextleft{\SL@setlefttrue\SL@interlinetext}
+\def\SL@interlinetextright{\SL@setleftfalse\SL@interlinetext}
+\def\SL@interlinetext#1{%
+ \setbox\@tempboxa=\hbox{\showlabelsetlabel{\SL@prlabelname{#1}}}\dp\@tempboxa\z@
+ \ifvmode
+ \nointerlineskip\vbox to 0pt{\vss
+ \hbox to \columnwidth{\hss \box\@tempboxa}}%
+% \end{macrocode}
+% And in horizontal mode, squeeze it between the lines, at the current point,
+% carefully taking up no space.
+% \begin{macrocode}
+ \else
+ \ifSL@setleft
+ \hbox to 0pt{%
+ \hss
+ \vbox to 0pt{\vss
+ \hbox to 0pt{\hss\box\@tempboxa}%
+ \showlabelrefline
+ }}%
+ \else
+ \hbox to 0pt{%
+ \vbox to 0pt{\vss
+ \box\@tempboxa
+ \showlabelrefline
+ }\hss}%
+ \fi
+ \penalty10000
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\showlabelrefline}
+% Set a short line which indicates the point where a label is
+% attached, when producing inline labels. This additionally positions
+% the label up above the line.
+% \begin{macrocode}
+\def\showlabelrefline{\hrule width 0.05em height 1.5ex depth 0pt }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\SL@margintext}
+% Set the actual text of the label. Use |\SL@prlabelname| here: without
+% this, a label command given outside of an equation or a |\caption|
+% will appear wrongly if the label has things like underscores within it.
+% \begin{macrocode}
+\def\SL@margintext#1{{\showlabelsetlabel{\{\SL@prlabelname{#1}\}}}}
+% \end{macrocode}
+% \end{macro}
+%
+% But where is the marginal text actually set? It can be in the left
+% margin, the right one, or can alternate. |\SL@lrtext|, used in the
+% |\vbox| above, is set, under the control of |\SL@labelposition| below, to
+% one of |\SL@lefttext|, |\SL@righttext| or |\SL@alternatetext|.
+% \begin{macro}{\SL@righttext}
+% \begin{macro}{\SL@lefttext}
+% \begin{macrocode}
+\def\SL@righttext#1{\hfill\rlap{\quad\SL@margintext{#1}}}
+\def\SL@lefttext #1{\llap{\SL@margintext{#1}\quad}\hfill}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\SL@setLR}
+% Define a switch which allows us to state whether we've decided to
+% set a particular label to the left or the right, and a macro
+% |\SL@setLR| to set it. After |\SL@setLR|, |\ifSL@setleft| is true
+% if a label should be set to the left, and is false if it should go
+% to the right.
+% \begin{macrocode}
+\newif\ifSL@setleft
+\def\SL@setLR{%
+ \ifcase\SL@labelposition
+ % 0=outer margin
+ \ifodd\c@page
+ \SL@setleftfalse
+ \else
+ \SL@setlefttrue
+ \fi
+ \or
+ % 1=inner margin
+ \ifodd\c@page
+ \SL@setlefttrue
+ \else
+ \SL@setleftfalse
+ \fi
+ \or
+ % 2=left margin
+ \SL@setlefttrue
+ \or
+ % 3=right margin
+ \SL@setleftfalse
+ \else
+ \SL@canthappen{Impossible labelposition \the\SL@labelposition}
+ \SL@labelposition=3 % put everything in the right-margin for now
+ \SL@setleftfalse
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% The code for |\SL@alternatetext| doesn't work perfectly, as it
+% sometimes manages to get things on the wrong side of the text near the
+% top of a new page. This is a venial slip, however, as this package
+% should never be used in a final version.
+% \begin{macro}{\SL@alternatetext}
+% \begin{macrocode}
+\def\SL@alternatetext{%
+ \SL@setLR
+ \ifSL@setleft
+ \let\SL@next\SL@lefttext
+ \else
+ \let\SL@next\SL@righttext
+ \fi
+ \SL@next
+}
+% \end{macrocode}
+% \end{macro}
+% The case where the \Lopt{twocolumn} option is set is slightly different.
+% There we have to switch between placing the note in the left and right
+% margins, depending on whether we're setting the first or second column.
+% This macro, and |\SL@eqntwocoltext| below, uses the switch
+% |\if@firstcolumn| to decide whether it's in the first or the second
+% column of the text (I suppose it'll get terribly confused if we use
+% \file{multicol.sty} along with this). This is defined and maintained in
+% the base file \file{ltoutput.dtx}. It's not part of the defined
+% interface, however (there doesn't seem to be one, grump), so I don't
+% suppose we should really rely on it. There isn't an option, however.
+% \begin{macro}{\SL@twocoltext}
+% \begin{macrocode}
+\def\SL@twocoltext{%
+ \if@firstcolumn
+ \let\SL@next\SL@lefttext
+ \else
+ \let\SL@next\SL@righttext
+ \fi
+ \SL@next}
+% \end{macrocode}
+% \end{macro}
+%
+% We have very similar things for equations, except that they are set in
+% place, rather than within a zero depth box. This code \emph{assumes} that
+% equation numbers are going to be on the right hand side of the page. It
+% should probably check for the existence of the \Lopt{leqno} option (how?).
+% \begin{macro}{\SL@eqnrighttext}
+% \begin{macro}{\SL@eqnlefttext}
+% \begin{macrocode}
+\def\SL@eqnrighttext#1{\rlap{\quad\SL@margintext{#1}}}
+\def\SL@eqnlefttext #1{\hbox to 0pt{\kern -\columnwidth
+ \llap{\SL@margintext{#1}\quad}\hss}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% Now do the analogues for the equation numbers, in the case of the
+% alternate page selection\dots
+% \begin{macro}{\SL@eqnalternatetext}
+% \begin{macrocode}
+\def\SL@eqnalternatetext{%
+ \SL@setLR
+ \ifSL@setleft
+ \let\SL@next\SL@eqnlefttext
+ \else
+ \let\SL@next\SL@eqnrighttext
+ \fi
+ \SL@next
+}
+% \end{macrocode}
+% \end{macro}
+% \dots and the twocolumn option
+% \begin{macro}{\SL@eqntwocoltext}
+% \begin{macrocode}
+\def\SL@eqntwocoltext{%
+ \if@firstcolumn
+ \let\SL@next\SL@eqnlefttext
+ \else
+ \let\SL@next\SL@eqnrighttext
+ \fi
+ \SL@next}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\SL@canthappen}
+% Issues a |\PackageError| command, and solicits bug reports.
+% \begin{macrocode}
+\def\SL@canthappen#1{%
+ \PackageError{showlabels}{#1}
+ {This shouldn't happen -- the package showlabels has a bug.
+ \MessageBreak
+ Please report this, if possible with a sample document which
+ \MessageBreak
+ demonstrates the problem, to \filemaintainer. Thanks.}}
+% \end{macrocode}
+% \end{macro}
+%
+% To control the positioning of labels, set the |\SL@labelposition|
+% switch, which can take values 0, 1, 2, 3, meaning outer, inner,
+% left, right margin respectively.
+% \begin{macrocode}
+\newcount\SL@labelposition
+\SL@labelposition=0
+% \end{macrocode}
+%
+% We select between the various possibilities using the \Lopt{outer} and
+% \Lopt{inner} options and, implicitly, the \Lopt{twoside} option.
+% \begin{macrocode}
+\DeclareOption{outer}{\SL@labelposition=0}
+\DeclareOption{inner}{\SL@labelposition=1}
+\DeclareOption{left}{\SL@labelposition=2}
+\DeclareOption{right}{\SL@labelposition=3}
+% \end{macrocode}
+%
+% Labels can be set either in the margins or inline, by switching
+% between definitions of |\SL@setlabel|.
+% \begin{macrocode}
+\newif\ifSL@labelsinline
+\SL@labelsinlinefalse
+\DeclareOption{marginal}{\SL@labelsinlinefalse}
+\DeclareOption{inline}{\SL@labelsinlinetrue}
+% \end{macrocode}
+% \begin{macro}{\SL@setlabel}
+%
+% Macro |\SL@setlabel| is where we switch between inline and marginal labels.
+% \begin{macrocode}
+\def\SL@setlabel{%
+ \ifSL@labelsinline
+ \let\@tempa\SL@inlinetext
+ \else
+ \let\@tempa\SL@margtext
+ \fi
+ \@tempa
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\showlabelsinline}
+% It is sometimes convenient (for example when a document encounters a
+% situation which this package mishandles) to force inline labels
+% temporarily, within a block or environment. Use this macro to do
+% that.
+% \begin{macrocode}
+\def\showlabelsinline{\SL@labelsinlinetrue}
+% \end{macrocode}
+% \end{macro}
+% By default, we run |\showlabels{label}|. The option \Lopt{nolabel}
+% turns this off.
+% \begin{macrocode}
+\newif\ifSL@labellabel
+\SL@labellabeltrue
+\DeclareOption{nolabel}{\SL@labellabelfalse}
+% \end{macrocode}
+%
+% Define the options \Lopt{final} and \Lopt{draft}. The option
+% \Lopt{final} turns off all the functionality of this package by
+% disabling the command |\showlabels|, including the implicit
+% |\showlabels| command which the package issues as long as the
+% \Lopt{nolabel} option has not been given. This is included so that if that
+% option is given in the |\documentclass| declaration then this
+% package does respect it. \Lopt{draft} does nothing, and therefore
+% simply continues the default behaviour of this package; it is here
+% purely to partner the \Lopt{final} option.
+% \begin{macrocode}
+\DeclareOption{final}{\let\showlabels\@gobble}
+\DeclareOption{draft}{}
+% \end{macrocode}
+%
+% Process any options that have been set.
+% \begin{macrocode}
+\ProcessOptions
+% \end{macrocode}
+% and use the values of |\SL@labelposition| and |if@twoside| which may have
+% been set by those options, to set |\SL@lrtext| to be the
+% appropriate control sequence. The presence of the \Lopt{twocolumn} option
+% means that we ignore the \Lopt{inner} and \Lopt{outer} options.
+% \begin{macrocode}
+\if@twocolumn
+ \let\SL@lrtext\SL@twocoltext
+ \let\SL@eqnlrtext\SL@eqntwocoltext
+\else
+ \ifcase\SL@labelposition
+ % 0=outer margin
+ \if@twoside
+ \let\SL@lrtext\SL@alternatetext
+ \let\SL@eqnlrtext\SL@eqnalternatetext
+ \else
+ \let\SL@lrtext\SL@righttext
+ \let\SL@eqnlrtext\SL@eqnrighttext
+ \fi
+ \or
+ % 1=inner margin
+ \if@twoside
+ \let\SL@lrtext\SL@alternatetext
+ \let\SL@eqnlrtext\SL@eqnalternatetext
+ \else
+ \let\SL@lrtext\SL@lefttext
+ \let\SL@eqnlrtext\SL@eqnlefttext
+ \fi
+ \or
+ % 2=left margin
+ \let\SL@lrtext\SL@lefttext
+ \let\SL@eqnlrtext\SL@eqnlefttext
+ \or
+ % 3=right margin
+ \let\SL@lrtext\SL@righttext
+ \let\SL@eqnlrtext\SL@eqnrighttext
+ \else
+ \SL@canthappen{Impossible labelposition \the\SL@labelposition}
+ \SL@labelposition=3 % put everything in the right-margin for now
+ \let\SL@lrtext\SL@righttext
+ \let\SL@eqnlrtext\SL@eqnrighttext
+ \fi
+\fi
+% \end{macrocode}
+%
+% Finally, label all the |\label| commands
+% (default behaviour),
+% unless this has been suppressed through the \Lopt{nolabel} option.
+% \begin{macrocode}
+\ifSL@labellabel
+ \showlabels{label}
+ \ifSL@AMS
+ \ifx\showlabels\@gobble
+ % do nothing -- we're in [final] mode (see test case t13)
+ \else
+ \AtBeginDocument{%
+ \let\maketag@@@\SL@maketag@@@
+ \let\tagform@\SL@tagform@}
+ \fi
+ \fi
+ \@ifundefined{theIEEEsubequationdis}\relax % and \theequationdis
+ {\SL@wrap@labeller{theIEEEsubequationdis}
+ \SL@wrap@labeller{theequationdis}}
+\fi
+% \end{macrocode}
+%
+% That's us.
+%
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%
+% \Finale
+\endinput
diff --git a/macros/latex/contrib/showlabels/showlabels.html b/macros/latex/contrib/showlabels/showlabels.html
new file mode 100644
index 0000000000..f809112b5a
--- /dev/null
+++ b/macros/latex/contrib/showlabels/showlabels.html
@@ -0,0 +1,544 @@
+<?xml version="1.0"?>
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Showlabels</title>
+<link href="http://nxg.me.uk" rev="author"/>
+<!-- content of style file, to make this document standalone... -->
+<style type='text/css'>
+body {
+ color: #333;
+ background: white;
+ margin-left: +30%;
+ width: 50%; /* body is 50% of screen width */
+ padding: 0.5em; /* this will make a difference if I decide to
+ have the background a different colour */
+ /* I can't decide on font: Optima's always nice, but Gill looks
+ agreeably intense. Helvetica's a decent fallback. */
+ font-family: "Helvetica Neue", Helvetica, "Gill Sans", gill, sans-serif;
+ /* font-family: Optima, "Gill Sans", gill, Helvetica, sans-serif; */
+ /* font-family: "Gill Sans", gill, Helvetica, sans-serif; */
+ /* I seem to have used 11pt at some point in the past, but this
+ is far too big -- did I ever have a reason for that, or is it
+ just due to browser changes? */
+ font-size: 10pt;
+ line-height: 150%;
+}
+
+/* adapt to wider screens */
+@media screen and (min-width: 700pt) {
+ body {
+ margin-left: 210pt;
+ width: 350pt;
+ }
+}
+
+/* The following appears not to work in Safari or Chrome
+ -- don't know why, yet.
+@media print {
+ @page :right {
+ size: auto;
+ body {
+ margin-top: 2cm;
+ margin-bottom: 3cm;
+ margin-left: 10%;
+ width: 60%;
+ margin-right: 30%;
+ color: #d33;
+ }
+ }
+ @page :left {
+ size: auto;
+ body {
+ margin-top: 2cm;
+ margin-bottom: 3cm;
+ margin-left: 30%;
+ width: 60%;
+ margin-right: 10%;
+ color: #33d;
+ }
+ }
+}
+*/
+
+div.topsidebar {
+ float: right;
+ width: 50%; /* ...of the body width (ie, 50% x 50% of screen) */
+ font-size: smaller;
+ margin-left: 1em;
+ padding-left: 1em;
+ border-left: solid thin #AAA;
+}
+
+/* On wider screens, move the sidebar out to the right hand side */
+/* This uses CSS3 media queries: http://www.w3.org/TR/css3-mediaqueries/ */
+@media screen and (min-width: 700pt) and (max-width: 850pt) {
+ body {
+ margin-left: 210pt;
+ width: 350pt; /* 50% of 700pt */
+ margin-right: auto;
+ }
+ div.topsidebar {
+ position: absolute;
+ /* I feel this size should be 595pt (350 + 210 + 0.05*700),
+ but that's clearly not right -- I don't think I understand what the -5%
+ in the h1 spec below is actually 5% of! */
+ left: 570pt;
+ width: auto;
+ margin-left: 0pt;
+ padding-left: 0pt;
+ border: none;
+ }
+}
+/* On still-wider screens, expand the left-margin, keeping the sidebar attached to the right-hand edge.
+ When the screen is 850pt wide (expanding from the @media case above),
+ the left margin will be 210pt, the width 350pt, and the right margin therefore 290pt.*/
+@media screen and (min-width: 850pt) {
+ body {
+ margin-right: 290pt; /* 290 = 850-(210+350) */
+ width: 350pt;
+ margin-left: auto; /* ...takes up the slack */
+ }
+ div.topsidebar {
+ position: absolute;
+ width: 290pt; /* same 290pt as above */
+ left: auto;
+ right: 0%;
+ padding-left: 0pt;
+ border: none;
+ }
+}
+
+
+code, pre {
+ font-family: Monaco, fixed;
+ font-size: 9pt;
+}
+
+a { text-decoration: none; }
+a:link { color: #66C; }
+a:visited { color: #669; }
+a[href]:hover { background: #EEE; }
+
+div.abstract {
+ font-style: oblique;
+ text-align: left;
+}
+div.abstract em { font-style: normal; }
+div.abstract code {
+ font-style: normal;
+ font-size: 80%;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ color: #822;
+ font-weight: 100; /* few fonts have ultra-light weights */
+ line-height: 100%; /* no need to spread out titles */
+}
+h1 {
+ margin-left: -40%;
+ margin-right: -5%;
+ padding: 0.5em;
+ border: solid thin #666;
+ text-align: right;
+}
+h2 {
+ margin-left: -40%;
+ margin-right: -5%;
+ padding: 0.2em;
+ border-top: solid thin #666;
+ clear: both;
+}
+
+h2.appendices {
+ margin-top: 10ex;
+ border-top: double medium #666;
+}
+h3 {
+ margin-left: -30%;
+ float: left;
+ width: 25%;
+ display: block;
+ text-align: right;
+ vertical-align: bottom;
+ padding-top: 0pt;
+ padding-right: 0.5em;
+ margin-top: 0pt;
+ line-height: 120%;
+}
+
+/*
+h4 {
+ color: #C66;
+}
+*/
+
+pre, table { background: #dde; }
+
+pre {
+ padding: 1em;
+ line-height: 130%;
+}
+
+table {
+ font-size: smaller;
+}
+td {
+ padding: 0.5ex;
+}
+
+Q:before { content: "“"; }
+Q:after { content: "”"; }
+
+img.smallimage {
+ float: right;
+ margin: 24pt;
+ margin-right: -30%;
+}
+
+div.signature {
+ margin-left: -40%;
+ margin-right: -5%;
+ margin-top: 4ex;
+ text-align: right;
+ border: solid thin #666;
+ padding: 0.3em;
+ clear: both;
+}
+
+/* ============================================================
+ * Some other curiosities of my one-time formatting for web pages
+ */
+.doc-history {
+ font-size: xx-small;
+ background: #eee;
+ line-height: 100%;
+}
+
+div.subtoc, div.subsubtoc { display: none; }
+
+/* ============================================================
+ * Special formatting for ToC
+ */
+
+/*
+ If there's significant amount of text in front of the first subsection,
+ then the following are good to put in the per-document stylesheet:
+ width: 25%;
+ float: right;
+*/
+div#toc {
+ color: #888;
+ padding: 0;
+ font-size: smaller;
+ text-align: right;
+}
+div#toc a:link { color: #888; }
+div#toc > ul {
+ padding: 0pt;
+ margin: 0pt;
+ list-style: none;
+}
+div#toc li {
+ padding: 0pt;
+ display: inline-block;
+}
+div#toc li:before {
+ content: "§ ";
+ margin-left: 1em;
+}
+/* the following elements aren't currently generated by structure.lx */
+div#toc li ul {
+ padding-left: 1em;
+ margin-left: 0;
+ font-style: italic;
+ display: inline;
+}
+div#toc li ul:before {
+ content: "( ";
+}
+div#toc li ul:after {
+ content: " ) ";
+}
+div#toc li li {
+ padding-left: 0pt;
+}
+div#toc li li:after {
+ content: "; ";
+}
+</style>
+<style type='text/css'>
+/* a span/div style for attracting attention */
+.attention {
+ color: #822;
+}
+</style>
+</head>
+
+<body>
+<h1>Showlabels</h1>
+<div class="abstract">
+<p>Put the names of <code>\label</code>s and other commands into
+the margins of a draft document.</p>
+<!-- This is revision 95a544e6b41b, 2016-06-09T16:51:03+01:00 -->
+<p>Version 1.8, 2016 June 9,
+ <a href='http://purl.org/nxg/dist/showlabels'
+ ><code>http://purl.org/nxg/dist/showlabels</code></a>.</p>
+</div>
+
+<p>This class option helps you keep track of all the labels in your
+documents, by putting the name of the new label into the margin
+whenever either the <code>\label</code> command is used, or an
+equation is automatically numbered. It is compatible with the
+<code>amsmath</code> and <code>hyperref</code> packages.</p>
+
+<p>It is similar to, but does a little more than, the showkeys package.</p>
+
+<p>You invoke this package with the command
+<code>\usepackage{showlabels}</code> in the preamble. You can control
+where the labels appear &#x2013; in the margins or in the interline gaps &#x2013;
+and you can change the appearance of the formatted labels to some
+extent.</p>
+
+<p>As well, you can have the arguments to other commands besides
+<code>\label</code> displayed. This is fairly obviously useful for
+the <code>\cite</code> command, but it can be useful for
+<code>\ref</code> or <code>\begin</code> as well.</p>
+
+<p>The package will also work in the presence of the
+<code>[twocolumn]</code> option. In this case, the options
+<code>[inner]</code> and <code>[outer]</code> will be ignored, and the
+label will be placed in the nearer margin.</p>
+
+<h3>Compatibility and problems</h3>
+
+<p>For reasonably obvious reasons, this package will <em>not</em> work at
+all well with the multicol package, and for possibly less obvious
+reasons, it won't work with the <code>[leqno]</code> option either (at
+some point it should be modified to at least recognise and warn of the
+conflict in either case). The package can occasionally place labels
+in the wrong margins, near the top of a page &#x2013; see the documentation
+for a discussion of this.</p>
+
+<h3>Download and installation</h3>
+
+<ol>
+<li>Download the file
+<a href="showlabels-1.8.tar.gz" >showlabels-1.8.tar.gz</a>
+or
+<a href="showlabels-1.8.zip" >showlabels-1.8.zip</a>
+and unpack it.</li>
+
+<li>Run LaTeX on the file <code>showlabels.ins</code> &#x2013; this will
+unpack the style file <code>showlabels.sty</code> amongst other files.
+Place this somewhere where TeX can find it. </li>
+
+<li>Run LaTeX on the file <code>showlabels.dtx</code> to obtain the
+documentation.</li>
+</ol>
+
+<p>Links:</p>
+<ul>
+<li>Canonical package home page:
+<a href="http://purl.org/nxg/dist/showlabels"
+ ><code>http://purl.org/nxg/dist/showlabels</code></a></li>
+
+<li>On CTAN:
+<a href='https://www.ctan.org/pkg/showlabels'
+ >macros/latex/contrib/showlabels</a></li>
+
+<li>The source code for the package is maintained at
+<a href='http://bitbucket.org/nxg/showlabels/'>bitbucket.org</a>,
+which also includes an
+<a href='https://bitbucket.org/nxg/showlabels/issues' >issue tracker</a>,
+where you can report bugs (or you can just mail me).</li>
+
+</ul>
+
+<p>This work is Copyright 1999, 2001-09, 2013-16, Norman Gray, and may be distributed and/or modified under the
+conditions of the <a href='http://www.latex-project.org/lppl.txt'>LaTeX Project Public Licence</a>,
+either version 1.3 of this licence or (at your option) any later version.</p>
+
+<h3>History</h3>
+<dl>
+<dt><span class='attention'><strong>1.8, 2016 June 9</strong></span></dt>
+<dd>The <code>ntheorem</code> package exposed an apparently
+long-standing incompleteness in the handling of <code>amsmath</code>
+documents.
+Fixes <a href='https://bitbucket.org/nxg/showlabels/issues/9/'>issue 9</a>.</dd>
+
+<dt><strong>1.7, 2015 December 8</strong></dt>
+<dd>Release v1.7.</dd>
+
+<dt>1.7b2, 2015 December 7</dt>
+<dd>Make the combination of amsmath and [inline] mode work
+(fixes <a href='https://bitbucket.org/nxg/showlabels/issue/8/'>issue 8</a>
+&#x2013; thanks to A L Dukeman for the report;
+what is it about showlabels and 6 December?!).</dd>
+
+<dt>1.7b1, 2014 December 6</dt>
+<dd>This is a much-delayed bugfix release (by coincidence
+<em>exactly</em> a year after the previous release!).
+<ul>
+<li>Give <code>\showlabels</code> an optional formatting argument
+(implements <a href='https://bitbucket.org/nxg/showlabels/issue/1/'>issue 1</a>
+&#x2013; thanks to Francesco Biccari for the suggestion).</li>
+<li>Special-case the IEEEtrantools package
+(fixes <a href='https://bitbucket.org/nxg/showlabels/issue/2/'>issue 2</a>
+&#x2013; thanks to Boris Kheyfets for the report and test case, and to
+Ben William Carabelli for additional analysis and a draft fix).</li>
+<li>The <code>[final]</code> option now works with the
+<code>{amsmath}</code> package
+(fixes <a href='https://bitbucket.org/nxg/showlabels/issue/3/'>issue 3</a>
+&#x2013; thanks to Guillermo Garza and Enno Nagel for the report, and to
+Guillermo for the test case).</li>
+<li>Handle the hyperref package's <code>\ref*{label}</code> variant
+(fixes <a href='https://bitbucket.org/nxg/showlabels/issue/4/'>issue 4</a>
+&#x2013; thanks to Alex Watson for the report and test case).</li>
+<li>Handle the case where a label is in a display, but not in maths mode
+(fixes <a href='https://bitbucket.org/nxg/showlabels/issue/5/'>issue 5</a>
+&#x2013; thanks to &#x2018;bartgol&#x2019; on Stackexchange for the report and test case).</li>
+</ul></dd>
+
+<dt>1.6.6, 2013 December 6</dt>
+<dd><ul>
+<li>Add configuration interface <code>\showlabelrefline</code> and
+ensure that <code>\color</code> works in
+<code>\showlabelfont</code>.</li>
+<li>Various documentation tweaks</li>
+<li>Change licence from GPL to LPPL</li>
+<li>Fix link to repository</li>
+</ul>
+</dd>
+
+<dt>1.6.5, 2009 May 27</dt>
+<dd>Fixed a bug in the way that labels including underscores (and
+other &#x2018;exotic&#x2019; characters) were displayed.</dd>
+
+<dt>1.6.4, 2008 October 10</dt>
+<dd>Fixed another poor interaction between eqnarray and amsart. Now
+we get equation labels in eqnarray, and we don't get marginal notes
+about <code>\eqref</code> (which is good; might this finally be fixed?).</dd>
+
+<dt>1.6.3, 2008 July 24</dt>
+<dd>Release 1.6.2 broke compatibility with the <em>rest</em> of
+amsmath (<code>eqnarray</code> became the only thing that worked
+within amsmath)! Fixed. Doh!</dd>
+
+<dt>1.6.2, 2008 June 27</dt>
+<dd>The reimplementation of eqnarray within amsart was such that
+equation labels disappeared in that case. Fixed.</dd>
+
+<dt>1.6.1, 2007 June 17</dt>
+<dd>Fix an errant test, which mangled equation labels starting
+with two identical letters.</dd>
+
+<dt><strong>1.6, 2006 May 26</strong></dt>
+<dd>The <code>\showlabels</code> command will now work with commands
+ (such as <code>\cite</code> or <code>\includegraphics</code>) which
+ take an optional argument.</dd>
+
+<dt>1.5a, 2005 March 17</dt>
+<dd>Defined <code>\showlabelfont</code> using
+<code>\ttfamily</code> rather than <code>\tt</code> (I'd
+avoided doing this before to avoid a seemingly pointless
+incompatibility with LaTeX 2.09, but (a) I imagine the
+package is incompatible with that for other reasons, and (b)
+it's really not worth the hassle...).</dd>
+
+<dt><strong>1.5, 2004 October 8</strong></dt>
+<dd>Added <code>\showlabelfont</code> and
+<code>\showlabelsetlabel</code> commands, allowing
+customisation of the printed labels. Added and documented
+options [final], [draft] (the former makes this package do
+nothing; the latter is the default behaviour).
+</dd>
+
+<dt>1.4a, 2003 January 28</dt>
+<dd>Acquired the <code>[left]</code> and
+<code>[right]</code> options, and fixed a bug which affected
+<code>\label</code> commands in captions.</dd>
+
+<dt><strong>1.4, 2001 July 24</strong></dt>
+<dd>Became (more) compatible with the
+wrapfig package. Also, I added the
+<code>\showlabels</code> command, to have the package display
+references to commands other than <code>\label</code>
+(<code>\cite</code> and <code>\ref</code> are obvious ones),
+and an <code>[inline]</code> option to have labels (etc.)
+displayed inline where possible, rather than always in the
+margin.</dd>
+
+<dt>1.3e, 2001 May 30</dt>
+<dd>Became compatible with the hyperref package in
+particular, and in general with other packages which
+themselves modify the <code>\label</code> command. This will
+work, however, only if the showlabels package is loaded after
+other packages which do this. Notwithstanding Sebastian
+Rahtz's excellent general advice on this, showlabels should
+indeed be loaded after hyperref.</dd>
+
+<dt><strong>1.3</strong></dt>
+<dd><p>After a long delay, here is an updated version of my showlabels
+package. It corrects all the reported bugs which I could reproduce,
+namely:</p>
+<ul>
+<li>The package now formats labels correctly when the
+<code>\label</code> command appears outside either an equation or a
+<code>\caption</code> (silly of me).</li>
+
+<li>A couple of people reported problems in the interaction with the
+amsmath package. Either these were confined to that package's earlier
+incarnations as AMS-LaTeX or the amstex package, or else there's some
+arcane circumstance I can't reproduce, so I haven't found anything to
+fix on this matter. Note that the
+<code>\usepackage{showlabels}</code> command must come <em>after</em>
+the <code>\usepackage{amsmath}</code> command. Bug-sightings here
+will be warmly appreciated.</li>
+
+<li>I haven't worried too much about the precise formatting of the
+labels &#x2013; this is, after all, supposed to be a draft-only
+package.</li>
+</ul>
+</dd>
+
+<dt><strong>1.1, 2001?</strong></dt>
+<dd>Modified to conform to the slightly
+different mechanism that <code>amsmath</code> uses to produce equation
+numbers. I don't habitually use <code>amsmath</code>, so I won't
+discover any bugs or weaknesses with its support here, and I'd
+consequently be glad to be informed of any that appear. Do note that
+the <code>\usepackage{showlabels}</code> command <em>must</em> appear
+after the <code>\usepackage{amsmath}</code> if it is to detect that
+you are using the amsmath package. Note also that, since these
+additions appeared, AMS-LaTeX and the <code>amstex</code> package seem
+to have been declared &#x2018;obsolete&#x2019; in favour of the <code>amsmath</code>
+package. This package now claims conformance with the
+<code>amsmath</code> package alone, though it will probably work with
+older versions in fact.
+</dd>
+
+<dt>Original release</dt>
+<dd>The package was originally released by me on 1991 September 21, under the name
+<code>labels.sty</code>.
+On 1992 January 29, Darrel Hankerson
+(<code>hank@ducvax.auburn.edu</code>), made the update to NFSS, and
+changed the name to <code>showlabel.sty</code>.</dd>
+
+</dl>
+
+<div class="signature">
+<a href="http://www.astro.gla.ac.uk/users/norman/"
+ >Norman Gray</a><br/>
+2016 June 9
+</div>
+
+</body>
+</html>
+
+
+
+
+<!-- Local Variables: -->
+<!-- mode: nxml -->
+<!-- End: -->
diff --git a/macros/latex/contrib/showlabels/showlabels.ins b/macros/latex/contrib/showlabels/showlabels.ins
new file mode 100644
index 0000000000..739ad5571f
--- /dev/null
+++ b/macros/latex/contrib/showlabels/showlabels.ins
@@ -0,0 +1,14 @@
+\input docstrip
+\preamble
+ Showlabels: Style to display labels in the margin
+\endpreamble
+\keepsilent
+\askforoverwritefalse
+
+\generate{\file{showlabels.drv}{\from{showlabels.dtx}{driver}}
+ \file{showlabels.sty}{\from{showlabels.dtx}{package}}
+ }
+
+\endbatchfile
+
+%% $Id$
diff --git a/macros/latex/contrib/showlabels/showlabels.pdf b/macros/latex/contrib/showlabels/showlabels.pdf
new file mode 100644
index 0000000000..71be316ed3
--- /dev/null
+++ b/macros/latex/contrib/showlabels/showlabels.pdf
Binary files differ
diff --git a/macros/latex/contrib/showlabels/style.css b/macros/latex/contrib/showlabels/style.css
new file mode 100644
index 0000000000..946d11a6a5
--- /dev/null
+++ b/macros/latex/contrib/showlabels/style.css
@@ -0,0 +1,260 @@
+body {
+ color: #333;
+ background: white;
+ margin-left: +30%;
+ width: 50%; /* body is 50% of screen width */
+ padding: 0.5em; /* this will make a difference if I decide to
+ have the background a different colour */
+ /* I can't decide on font: Optima's always nice, but Gill looks
+ agreeably intense. Helvetica's a decent fallback. */
+ font-family: "Helvetica Neue", Helvetica, "Gill Sans", gill, sans-serif;
+ /* font-family: Optima, "Gill Sans", gill, Helvetica, sans-serif; */
+ /* font-family: "Gill Sans", gill, Helvetica, sans-serif; */
+ /* I seem to have used 11pt at some point in the past, but this
+ is far too big -- did I ever have a reason for that, or is it
+ just due to browser changes? */
+ font-size: 10pt;
+ line-height: 150%;
+}
+
+/* adapt to wider screens */
+@media screen and (min-width: 700pt) {
+ body {
+ margin-left: 210pt;
+ width: 350pt;
+ }
+}
+
+/* The following appears not to work in Safari or Chrome
+ -- don't know why, yet.
+@media print {
+ @page :right {
+ size: auto;
+ body {
+ margin-top: 2cm;
+ margin-bottom: 3cm;
+ margin-left: 10%;
+ width: 60%;
+ margin-right: 30%;
+ color: #d33;
+ }
+ }
+ @page :left {
+ size: auto;
+ body {
+ margin-top: 2cm;
+ margin-bottom: 3cm;
+ margin-left: 30%;
+ width: 60%;
+ margin-right: 10%;
+ color: #33d;
+ }
+ }
+}
+*/
+
+div.topsidebar {
+ float: right;
+ width: 50%; /* ...of the body width (ie, 50% x 50% of screen) */
+ font-size: smaller;
+ margin-left: 1em;
+ padding-left: 1em;
+ border-left: solid thin #AAA;
+}
+
+/* On wider screens, move the sidebar out to the right hand side */
+/* This uses CSS3 media queries: http://www.w3.org/TR/css3-mediaqueries/ */
+@media screen and (min-width: 700pt) and (max-width: 850pt) {
+ body {
+ margin-left: 210pt;
+ width: 350pt; /* 50% of 700pt */
+ margin-right: auto;
+ }
+ div.topsidebar {
+ position: absolute;
+ /* I feel this size should be 595pt (350 + 210 + 0.05*700),
+ but that's clearly not right -- I don't think I understand what the -5%
+ in the h1 spec below is actually 5% of! */
+ left: 570pt;
+ width: auto;
+ margin-left: 0pt;
+ padding-left: 0pt;
+ border: none;
+ }
+}
+/* On still-wider screens, expand the left-margin, keeping the sidebar attached to the right-hand edge.
+ When the screen is 850pt wide (expanding from the @media case above),
+ the left margin will be 210pt, the width 350pt, and the right margin therefore 290pt.*/
+@media screen and (min-width: 850pt) {
+ body {
+ margin-right: 290pt; /* 290 = 850-(210+350) */
+ width: 350pt;
+ margin-left: auto; /* ...takes up the slack */
+ }
+ div.topsidebar {
+ position: absolute;
+ width: 290pt; /* same 290pt as above */
+ left: auto;
+ right: 0%;
+ padding-left: 0pt;
+ border: none;
+ }
+}
+
+
+code, pre {
+ font-family: Monaco, fixed;
+ font-size: 9pt;
+}
+
+a { text-decoration: none; }
+a:link { color: #66C; }
+a:visited { color: #669; }
+a[href]:hover { background: #EEE; }
+
+div.abstract {
+ font-style: oblique;
+ text-align: left;
+}
+div.abstract em { font-style: normal; }
+div.abstract code {
+ font-style: normal;
+ font-size: 80%;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ color: #822;
+ font-weight: 100; /* few fonts have ultra-light weights */
+ line-height: 100%; /* no need to spread out titles */
+}
+h1 {
+ margin-left: -40%;
+ margin-right: -5%;
+ padding: 0.5em;
+ border: solid thin #666;
+ text-align: right;
+}
+h2 {
+ margin-left: -40%;
+ margin-right: -5%;
+ padding: 0.2em;
+ border-top: solid thin #666;
+ clear: both;
+}
+
+h2.appendices {
+ margin-top: 10ex;
+ border-top: double medium #666;
+}
+h3 {
+ margin-left: -30%;
+ float: left;
+ width: 25%;
+ display: block;
+ text-align: right;
+ vertical-align: bottom;
+ padding-top: 0pt;
+ padding-right: 0.5em;
+ margin-top: 0pt;
+ line-height: 120%;
+}
+
+/*
+h4 {
+ color: #C66;
+}
+*/
+
+pre, table { background: #dde; }
+
+pre {
+ padding: 1em;
+ line-height: 130%;
+}
+
+table {
+ font-size: smaller;
+}
+td {
+ padding: 0.5ex;
+}
+
+Q:before { content: "“"; }
+Q:after { content: "”"; }
+
+img.smallimage {
+ float: right;
+ margin: 24pt;
+ margin-right: -30%;
+}
+
+div.signature {
+ margin-left: -40%;
+ margin-right: -5%;
+ margin-top: 4ex;
+ text-align: right;
+ border: solid thin #666;
+ padding: 0.3em;
+ clear: both;
+}
+
+/* ============================================================
+ * Some other curiosities of my one-time formatting for web pages
+ */
+.doc-history {
+ font-size: xx-small;
+ background: #eee;
+ line-height: 100%;
+}
+
+div.subtoc, div.subsubtoc { display: none; }
+
+/* ============================================================
+ * Special formatting for ToC
+ */
+
+/*
+ If there's significant amount of text in front of the first subsection,
+ then the following are good to put in the per-document stylesheet:
+ width: 25%;
+ float: right;
+*/
+div#toc {
+ color: #888;
+ padding: 0;
+ font-size: smaller;
+ text-align: right;
+}
+div#toc a:link { color: #888; }
+div#toc > ul {
+ padding: 0pt;
+ margin: 0pt;
+ list-style: none;
+}
+div#toc li {
+ padding: 0pt;
+ display: inline-block;
+}
+div#toc li:before {
+ content: "§ ";
+ margin-left: 1em;
+}
+/* the following elements aren't currently generated by structure.lx */
+div#toc li ul {
+ padding-left: 1em;
+ margin-left: 0;
+ font-style: italic;
+ display: inline;
+}
+div#toc li ul:before {
+ content: "( ";
+}
+div#toc li ul:after {
+ content: " ) ";
+}
+div#toc li li {
+ padding-left: 0pt;
+}
+div#toc li li:after {
+ content: "; ";
+}