summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/showtags/showtags.sty
blob: c26e487a574161eed262049ad251e351667756ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
%%% -*-LaTeX-*-
%%% /u/sy/beebe/tex/bib/showtags.sty, Mon Sep 12 09:25:01 1994
%%% Edit by Nelson H. F. Beebe <beebe@plot79.math.utah.edu>
%%%
%%% ====================================================================
%%%  @LaTeX-style-file{
%%%     author          = "Nelson H. F. Beebe",
%%%     version         = "1.05",
%%%     date            = "06 September 1995",
%%%     time            = "16:46:14 MDT",
%%%     filename        = "showtags.sty",
%%%     address         = "Department of Mathematics
%%%                        University of Utah
%%%                        Salt Lake City, UT 84112
%%%                        USA",
%%%     telephone       = "+1 801 581 5254",
%%%     FAX             = "+1 801 581 4148",
%%%     checksum        = "08345 99 459 4338",
%%%     email           = "beebe@math.utah.edu (Internet)",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "bibliography, citation label, citation tag",
%%%     license         = "public domain",
%%%     supported       = "yes",
%%%     docstring       = "This style file causes the bibliography
%%%                        citation tags to be displayed in boldface
%%%                        text in a right-adjusted framed box over
%%%                        each entry in a bibliography.  This serves
%%%                        as a handy reference when the tags are
%%%                        needed for a \cite{} macro.
%%%
%%%                        For flexibility, the user may redefine
%%%                        \thecitetag to change the format. E.g.
%%%
%%%                        \renewcommand{\thecitetag}[1]{\fbox{\small\tt #1}}
%%%
%%%                        would typeset the tag in small typewriter
%%%                        text in a box.
%%%
%%%                        The checksum field above contains a CRC-16
%%%                        checksum as the first value, followed by the
%%%                        equivalent of the standard UNIX wc (word
%%%                        count) utility output of lines, words, and
%%%                        characters.  This is produced by Robert
%%%                        Solovay's checksum utility."
%%%      }
%%% ====================================================================
%
%%% Revision history:
%%%
%%% 1.05 [04-Nov-2010]  add license statement in comment header, but
%%%                     preserve release date and time of 1.04
%%% 1.04 [06-Sep-1995]	update for LaTeX 2e support
%%% 1.03 [12-Sep-1994]	update file header, and add \strut to label box
%%% 1.02 [10-Sep-1991]	update file header, trim trailing space
%%% 1.01 [11-Jul-1990]	almost original version
\ifx \DeclareRobustCommand \undefined% then assume LaTeX 2.09
% \@bibitem and \@lbibitem definitions extracted from latex.tex
% labelled ``LATEX VERSION 2.09 <24 May 1989>''.  We add only the
% \@showtag invocations.
%
    \def\@bibitem#1{\item\if@filesw \immediate\write\@auxout
        {\string\bibcite{#1}{\the\c@enumi}}\fi\ignorespaces
         \@showtag{#1}}
%
    \def\@lbibitem[#1]#2{\item[\@biblabel{#1}]\if@filesw
          { \def\protect##1{\string ##1\space}\immediate
            \write\@auxout{\string\bibcite{#2}{#1}}}\fi\ignorespaces
         \@showtag{#2}}
\else                           % must be LaTeX 2e
% From latex.ltx <1994/12/18>:
    \def\@bibitem#1{\item\if@filesw \immediate\write\@auxout
           {\string\bibcite{#1}{\the\value{\@listctr}}}\fi\ignorespaces
           \@showtag{#1}}
%
    \def\@lbibitem[#1]#2{\item[\@biblabel{#1}\hfill]\if@filesw
          {\let\protect\noexpand
           \immediate
           \write\@auxout{\string\bibcite{#2}{#1}}}\fi\ignorespaces
            \@showtag{#2}}
\fi
%
% Here are the macros that actually set the tag.  By default, we put it
% in boldface type in a framed box that is right-adjusted in exactly the
% width of the current line (and we handle both the one- and two-column
% cases), and we ensure that a page break does not occur between the
% tag-in-the-box and its bibliographic entry.  For flexibility, the user
% may redefine \thecitetag to change the format.
%
\newcommand{\thecitetag}[1]{\fbox{\bf #1}}
%
\def\@showtag#1{
    \@tempdima=\textwidth
    \if@twocolumn
        \advance\@tempdima by -\columnsep
        \divide\@tempdima by 2
    \fi
    \hbox to \@tempdima{\hfill\thecitetag{\strut#1}}\nobreak}
%
\endinput