Debian Codegraph @

texmf-dist/doc/latex/refcheck/refdemo.tex

raw
1 \documentclass[11pt]{article}
2 \usepackage{refcheck}
3 \textwidth=360pt
4 \begin{document}
5 \baselineskip=4.5mm
6 \textheight=40\baselineskip
7 \pagestyle{myheadings}
8
9 \parindent=1em\parskip=0.75ex
10 \makeatletter
11
12 \thispagestyle{empty}
13
14 \enlargethispage{-8mm}
15
16 \def\RefCheck{\textsl{Refcheck\/}}
17 \def\AmS{\mbox{$\mathcal{A}$\kern-0.17em\raise-2.1pt\hbox{$\mathcal{M}$}%
18 \kern-0.115em$\mathcal{S}$}}
19 \renewcommand{\refname}{{\normalsize References}}
20 \def\curversion{1.9.2}
21 \def\curvertime{2025/06/20}
22
23 \section*{\RefCheck{\tiny${}^{\mathrm{\ \ ver.
24 \curversion}}_{\mathrm{\curvertime}}$} for \LaTeXe}
25 \markboth{\hfill\bfseries\RefCheck\ for \LaTeXe\hfill}%
26 {\hfill\bfseries\RefCheck\ for \LaTeXe\hfill}
27 This short demo file describes usage of \RefCheck\ package
28 with \LaTeXe. The package looks for useless labels,
29 unlabelled equations, unused bibliography references
30 and puts `keys' of labels on margins.
31
32 To start checking, one should just write
33 \begin{verbatim}
34 \documentclass{article}
35 \usepackage{refcheck}
36 \end{verbatim}
37 at the beginning of document and compile the file twice.
38 Then, comments on references could be found in \texttt{.log} file and
39 in the margins.
40
41 Consider the set of equations
42 \begin{eqnarray}
43 &&a=b\label{eq.1}\\
44 &&b=c\label{eq.2}\\
45 &&c=d,
46 \end{eqnarray}
47 written as
48 \begin{verbatim}
49 \begin{eqnarray}
50 &&a=b\label{eq.1}\\
51 &&b=c\label{eq.2}\\
52 &&c=d,
53 \end{eqnarray}
54 \end{verbatim}
55 Then the \texttt{.log} file will contains the following messages:
56 {\small
57 \begin{verbatim}
58 Package refcheck Warning: Unused label `eq.2' on input line 44.
59 Package refcheck Warning: Unlabelled equation (3) on input line 46.
60 \end{verbatim}
61 }
62 \noindent
63 because the equation (\ref{eq.1}) is
64 referenced here by \verb#(\ref{eq.1})#, the label {\tt eq.2} of the second
65 equation is not used and the last equation is numbered but it is not
66 labelled.
67
68 Keys of labels are written in the marginal notes when the option
69 \textit{showrefs\/} (default) or the command \verb#\showrefnames# are
70 invoked. This regime can be set off by the option \textit{norefs} or (at
71 any point of text) by the command \verb#\norefnames#.
72
73 These marks include some information on labels. Namely, useless
74 labels are underlined and bounded by `\texttt{?}', the mark `\unl@bld@mark'
75 means that the equation is unlabelled. Marks are framed for
76 the labels which are used in text.
77
78 \newpage
79
80 The package is working in the same way with bibliography.
81 Consider the following short list of books:
82
83 \vspace{-1\baselineskip}
84
85 \begin{thebibliography}{9}
86 \bibitem{book1}A book.
87 \bibitem{book2}Another book.
88 \bibitem{book3}Third book.
89 \end{thebibliography}
90 defined as follows
91 \begin{verbatim}
92 \begin{thebibliography}{9}
93 \bibitem{book1}A book.
94 \bibitem{book2}Another book.
95 \bibitem{book3}Third book.
96 \end{thebibliography}
97 \end{verbatim}
98 Further, we use the labels of \cite{book1,book2} with the
99 command \verb#\cite{book1,book2}# and do not use the label
100 `book3'. Then, the \texttt{.log} file will contain the following message
101 {\small
102 \begin{verbatim}
103 Package refcheck Warning: Unused bibitem `book3' on input line 88.
104 \end{verbatim}}
105
106 Commands \verb#\showcitenames# and \verb#\nocitenames# for
107 bibliography are analogous to the commands \verb#\showrefnames# and
108 \verb#\norefnames#. They set on and off \RefCheck\ to write keys of
109 bibitems to output. The same function is for the options
110 \textit{showcites\/} (default) and \textit{nocites}.
111
112 Options \textit{msgs\/} (default) and \textit{nomsgs\/} state whether
113 \RefCheck\ writes its messages to \texttt{.log} file or not.
114
115 The check of unlabelled equations can be switched off by the option
116 \mbox{\textit{ignoreunlbld\/}} and on (default) by the option
117 \textit{chkunlbld\/}.
118
119 \medskip
120
121 \RefCheck\ generally works with \AmS-\LaTeX\ and \textbf{hyperref},
122 but the packages must be loaded \underline{before} the \RefCheck\ package.
123
124 \medskip
125
126 \RefCheck\ can be used with the \textbf{xr} package. Suppose one invokes\\
127 \verb#\usepackage{xr}# \verb#\externaldocument[A:]{apps}#\\ in document foo1.tex and\\
128 \verb#\usepackage{xr}# \verb#\externaldocument[B:]{apps}#\\ in document foo2.tex.
129 Then the commands \verb#\refcheckxrdoc[A:]{foo1}# and \verb#\refcheckxrdoc[B:]{foo2}#
130 used in apps.tex allows to check usage of labels from apps.tex in the
131 external files foo1.tex and foo2.tex.
132
133 \medskip
134
135 Note the problem with implicitly cited labels. For
136 example, if there is a set of equations which are labelled with
137 $\,$\texttt{a1,a2,...an}$\,$ and referred in document by
138 \verb#(\ref{a1})--(\ref{an})#, then the labels
139 $\,$\texttt{a2,a3,...an-1}$\,$ cannot be recognized as `used'.
140
141 \medskip
142 \bigskip
143
144 \textbf{Summary of options and commands:}
145 \medskip
146
147 \noindent
148 \verb#\refcheckxrdoc[prefix]{foo}# to check usage of labels
149 of the current document in the file foo.tex where they are used
150 via \verb#\usepackage{xr}# and
151 \verb#\externaldocument[prefix]{thisdocument}#
152
153 \medskip
154
155 \begin{raggedright}
156 \begin{tabular}{|l|l|c|l|}
157 \hline
158 Option & Command & Switch & Function\\
159 \hline
160 showrefs$^{*}$ & \verb#\showrefnames# & on & to put keys of labels\\
161 \cline{1-3}
162 norefs & \verb#\norefnames# & off & in the marginal notes\\
163 \hline
164 showcites$^{*}$ & \verb#\showcitenames# & on & to put bibitem keys\\
165 \cline{1-3}
166 nocites & \verb#\nocitenames# & off & in the marginal notes\\
167 \hline
168 msgs$^{*}$ & \verb#\setonmsgs# & on & to write \RefCheck's\\
169 \cline{1-3}
170 nomsgs & \verb#\setoffmsgs# & off & messages to \texttt{.log}\\
171 \hline
172 chkunlbld$^{*}$ & \verb#\checkunlbld# & on & to check unlabelled\\
173 \cline{1-3}
174 ignoreunlbld & \verb#\ignoreunlbld# & off & equations\\
175 \hline
176 \end{tabular}
177 \end{raggedright}
178 \par\noindent
179 \mbox{\qquad}$*$ default
180
181 \bigskip
182
183 \def\item{\noindent\mbox{\kern0.5em$\bullet$\kern0.5em}}
184
185 \textbf{Versions of \RefCheck, acknowledgments and bugs:}
186
187 \item
188 Versions \textbf{1.0--1.3} worked with \LaTeX2.09. Many
189 thanks to Antonio Loria for his useful comments on those versions.
190 Version \textbf{1.2} of \RefCheck\ can be found in
191 \texttt{/tex-archive/obsolete/macros/latex209/contrib/} in CTAN.
192
193 \item
194 \textbf{1.4} was the first version of \RefCheck\ for \LaTeXe, it had a
195 few bugs in its functionality for \AmS-\LaTeXe's \verb#\eqref#,
196 \verb#\tag#, \verb#split# and \verb#multline#. Many thanks to
197 Cornelius C. Noack and Mikhail Zotov for finding the problem.
198
199 \item
200 In the version~\textbf{1.5} the bugs were removed, but it was found
201 (thanks to Mikhail Zotov) that the version marks \AmS-\LaTeXe's
202 \verb#equation*# and \verb#gather*# as unlabelled. The versions
203 \textbf{1.6} solved the problem.
204
205 \item The version \textbf{1.7} (optimized code of \textbf{1.6}) was
206 found by Adriano Pascoletti to work incorrectly in \verb#\caption# (more
207 generally, when \verb#\ref#, \verb#\pageref# occur in a material
208 processed to \verb#\write#, in particular, to be put into \texttt{.toc},
209 \texttt{.lot}, \texttt{.lof} files).
210
211 \item The version \textbf{1.8} was intended to solve the
212 problem. Besides, some more work was done to provide compatibility with
213 \AmS-\LaTeX\ and \textbf{hyperref}.
214
215 \item The version \textbf{1.9} added possibility to check usage of labels in external
216 files. More compatibility with \textbf{cite} package was achieved.
217
218 \item The minor version \textbf{1.9.1} was intended to fix the bug discussed
219 at \\
220 {\small\texttt{http://tex.stackexchange.com/questions/88046/problem-with-refcheck}}.\\
221 Besides, the format of refcheck warnings was changed.
222
223 \item The minor version \textbf{\curversion} ensures compatibility with the latest versions
224 of \AmS-\LaTeX. Many thanks to Andrea Crisanti for providing information about the problem,
225 which notably manifested as duplicate labels in subsequent unlabelled equations.
226
227 \bigskip
228
229 \textbf{New options and commands:}
230
231 \item
232 Version \textbf{1.5}: \textit{msgs\/} and \textit{nomsgs\/}.
233
234 \item
235 Version \textbf{1.6}: \textit{ignoreunlbld\/} and
236 \textit{chkunlbld\/} (suggested by Miroslav Fikar).
237
238 \item
239 Version \textbf{1.9}: \verb#\refcheckxrdoc#.
240
241 \end{document}