Debian Codegraph @

texmf-dist/source/latex/refstyle/refstyle.dtx

raw
1 % \iffalse
2 %
3 % refstyle.dtx
4 % Copyright (C) 2002--2024 Danie Els
5 %
6 % -------------------------------------------------------------------
7 % The refstyle package
8 % for the formatting of references
9 % -------------------------------------------------------------------
10 % This work may be distributed and/or modified under the conditions
11 % of the LaTeX Project Public License, either version 1.3c of this
12 % license or (at your option) any later version. The latest version
13 % of this license is in
14 % http://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2008/12/01 or later.
17 %
18 % This work has the LPPL maintenance status 'maintained'.
19 %
20 % This Current Maintainer of this work is Danie Els ([email protected])
21 %
22 % This package consists of the files: refstyle.dtx
23 % refconfig.dtx
24 % refstyle.ins
25 % and the derived files: refstyle.sty
26 % refstyle.cfg
27 % -------------------------------------------------------------------
28 %
29 %<*pkg>
30 \newcommand*{\RefstyleFileDate}{2024/02/01}
31 \newcommand*{\RefstyleFileVersion}{v0.6b}
32 %</pkg>
33 %
34 %
35 %<*driver>
36 \documentclass[a4paper]{ltxdoc}
37 \let\RefstyleFileDate\relax
38 \let\RefstyleFileVersion\relax
39 \usepackage{amsmath}
40 \usepackage{amsfonts}
41 \DeclareMathSymbol{\square} {\mathord}{AMSa}{"03}
42 \DeclareMathSymbol{\blacksquare}{\mathord}{AMSa}{"04}
43 \usepackage{calc}
44 \usepackage{rotating}
45 \usepackage[rounded]{syntax}
46 \usepackage{varioref}
47 \usepackage{refstyle}
48 \usepackage{color}
49 \definecolor{hrefcol}{rgb}{0.00,0.00,1.00}
50 \usepackage[pdfpagelabels]{hyperref}
51 \hypersetup{breaklinks=true,
52 linktocpage,
53 pdfstartview=FitH,
54 colorlinks = true,
55 linkcolor = hrefcol,
56 urlcolor = hrefcol,
57 menucolor = hrefcol,
58 filecolor = hrefcol,
59 citecolor = hrefcol,
60 linkbordercolor = {0.8 0.8 0.8},
61 urlbordercolor = {0.8 0.8 0.8},
62 menubordercolor = {0.8 0.8 0.8},
63 filebordercolor = {0.8 0.8 0.8},
64 runbordercolor = {0.8 0.8 0.8},
65 citebordercolor = {0.8 0.8 0.8},
66 pdftitle={refstyle},
67 pdfauthor={Danie Els}}
68
69 %---- macrocode env changes -------------------------------
70
71 \setlength{\MacroIndent}{1.5em}
72
73 %---- Scratches -------------------------------------------
74
75 \newlength{\tdima}
76 \newsavebox{\tboxa}
77
78 %---- Spacing ---------------------------------------------
79
80 \newlength{\myskip}
81 \setlength{\myskip}{\topsep}
82 \addtolength{\myskip}{\parskip}
83 \addtolength{\myskip}{\partopsep}
84 \newcommand*{\blankline}{\par\addvspace{\myskip}}
85 \newlength{\mytab}
86 \setlength{\mytab}{2\parindent}
87 \newcommand{\tab}{\hspace*{\mytab}}
88
89 %---- Indented environments -------------------------------
90
91 \newenvironment{IndentPara}[1][1]
92 {\list{}{\setlength{\leftmargin}{#1\mytab}%
93 \setlength{\labelwidth}{0pt}%
94 \setlength{\labelsep}{0pt}%
95 \setlength{\itemindent}{\parindent}%
96 \setlength{\listparindent}{\parindent}%
97 }\item[]}%
98 {\endlist}
99 \newenvironment{IndentParaX}[1][1]
100 {\list{}{\setlength{\leftmargin}{#1\mytab}%
101 \setlength{\topsep}{0pt}%
102 \setlength{\partopsep}{0pt}%
103 \setlength{\labelwidth}{0pt}%
104 \setlength{\labelsep}{0pt}%
105 \setlength{\itemindent}{\parindent}%
106 \setlength{\listparindent}{\parindent}%
107 }\item[]}%
108 {\endlist}
109 \newcommand\bNP{\begin{IndentParaX}}
110 \newcommand\eNP{\end{IndentParaX}}
111 \newenvironment{Ipara}[1][\small]%
112 {\begin{IndentPara}\noindent#1\ignorespaces}%
113 {\end{IndentPara}}
114 \newenvironment{Itabb}[1][\small]%
115 {\begin{IndentPara}#1\ignorespaces\begin{tabbing}\ignorespaces}%
116 {\end{tabbing}\end{IndentPara}}
117
118 %---- Ruled & colored minipage ----------------------------
119
120 \definecolor{shadecolor}{gray}{0.9}
121
122 \newenvironment{fminipage}[1][\linewidth]
123 {\setlength{\tdima}{#1-2\fboxsep-2\fboxrule}%
124 \begin{lrbox}{\tboxa}\begin{minipage}{\tdima}}%
125 {\end{minipage}\end{lrbox}\noindent\fbox{\usebox{\tboxa}}}
126 \newenvironment{cminipage}[1][\linewidth]
127 {\setlength{\tdima}{#1-2\fboxsep-2\fboxrule}%
128 \begin{lrbox}{\tboxa}\begin{minipage}{\tdima}}%
129 {\end{minipage}\end{lrbox}%
130 \noindent\colorbox{shadecolor}{\usebox{\tboxa}}}
131
132 %---- Additional documenting commands ---------------------
133
134 \def\lcbrack{\symbol{`\{}}
135 \def\rcbrack{\symbol{`\}}}
136 \makeatletter
137 \def\meta@font@select{\normalfont\slshape}
138 \makeatother
139 \DeclareRobustCommand{\cmeta}[1]{%<- \<xxx>
140 \texttt{\bslash}\meta{#1}}
141 \DeclareRobustCommand{\cmarg}[1]{%<- {\<xxx>}
142 \texttt{\lcbrack}\cmeta{#1}\texttt{\rcbrack}}
143 \DeclareRobustCommand{\coarg}[1]{%<- [\<xxx>]
144 \texttt{[}\cmeta{#1}\texttt{]}}
145 \DeclareRobustCommand{\argcmd}[2]{%<- \<xxx>yyy
146 \cmeta{#1}\texttt{#2}}
147 \newcommand{\rmeta}[3][]{%
148 \texttt{\lcbrack#1}\meta{#2}\texttt{#3\rcbrack}}
149 \newcommand{\refmeta}[3][]{\cmd{\brref}\rmeta[#1]{#2}{#3}}
150
151 \newcommand*{\file}[1]{\texttt{#1}}
152 \newcommand*{\pkg}[1]{\textsf{#1}}
153 \newcommand*{\env}[1]{\texttt{#1}}
154 \newcommand*{\opt}[1]{\texorpdfstring{\normalfont\texttt{\slshape#1}}{#1}}
155 \newcommand*{\RS}{\pkg{refstyle}}
156 \newcommand*{\RScfg}{\file{refstyle.cfg}}
157 \newcommand*{\rtp}{type}
158 \newcommand*{\Rtp}{Type}
159 \newcommand*{\okeylst}{\oarg{key\_lst}}
160 \newcommand*{\mkeylst}{\marg{key\_lst}}
161
162 %---- Special eq tag command ------------------------------
163
164 \def\spestag#1{\stepcounter{equation}%
165 \gdef\tagextra##1{%
166 \makebox[0pt][l]{\small\quad%
167 \cmd{\eqlabel}\texttt{\lcbrack##1\rcbrack}}%
168 \gdef\tagextra####1{}}%
169 \tag{\theequation\tagextra{#1}}\eqlabel{#1}}
170
171 %---- other stuff -----------------------------------------
172
173 \newcommand*{\ArTab}{\>\quad$\rightarrow$\quad}
174
175 %----------------------------------------------------------
176
177 \EnableCrossrefs
178 \CodelineIndex
179 \RecordChanges
180 \setlength\hfuzz{15pt}
181 \hbadness=7000
182 \begin{document}
183 \DocInput{refstyle.dtx}
184 \end{document}
185
186 %</driver>
187 % \fi
188 %
189 % \CheckSum{552}
190 %
191 % \CharacterTable
192 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
193 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
194 % Digits \0\1\2\3\4\5\6\7\8\9
195 % Exclamation \! Double quote \" Hash (number) \#
196 % Dollar \$ Percent \% Ampersand \&
197 % Acute accent \' Left paren \( Right paren \)
198 % Asterisk \* Plus \+ Comma \,
199 % Minus \- Point \. Solidus \/
200 % Colon \: Semicolon \; Less than \<
201 % Equals \= Greater than \> Question mark \?
202 % Commercial at \@ Left bracket \[ Backslash \\
203 % Right bracket \] Circumflex \^ Underscore \_
204 % Grave accent \` Left brace \{ Vertical bar \|
205 % Right brace \} Tilde \~}
206 %
207 % \changes{v0.0}{2002/12/01}{Initial version}
208 % \changes{v0.1}{2003/04/01}{First stable version}
209 % \changes{v0.2}{2003/07/30}{First updated version}
210 % \changes{v0.3}{2006/09/09}{Documentation update}
211 % \changes{v0.4}{2010/10/21}{Documentation update}
212 % \changes{v0.4}{2010/10/21}{Add \texttt{nokeyprefix} option}
213 % \changes{v0.5}{2010/11/02}{Documentation update}
214 %
215 % \DoNotIndex{
216 % \@backslashchar, \@carcube, \@ehc, \@empty, \@firstoftwo,
217 % \@ifnextchar, \@ifpackageloaded, \@ifstar, \@ifundefined, \@nil,
218 % \@qend, \@qrelax, \@secondoftwo, \@tempa, \@undefined,
219 % \AtEndOfPackage, \begingroup, \csname, \CurrentOption,
220 % \DeclareOption, \def, \edef, \else, \endcsname, \endgroup,
221 % \expandafter, \fi, \gdef, \iffalse, \ifx, \InputIfFileExists,
222 % \let, \long, \lowercase, \MakeLowercase, \mbox, \MessageBreak,
223 % \NeedsTeXFormat, \newcommand, \newif, \noexpand, \PackageError, \PackageInfo,
224 % \PassOptionsToPackage, \RS@pkgname, \ProcessOptions, \protect,
225 % \providecommand, \ProvidesPackage, \relax, \renewcommand,
226 % \RequirePackage, \reserved@a, \reserved@b, \RS@tmpa,
227 % \RS@tmpb, \S, \RS@setkeys, \space, \string, \textsc, \textup,
228 % \unrestored@protected@xdef, \unskip, \uppercase,
229 % \zap@space}
230 %
231 %^^A==== Titling ==========================================
232 % \GetFileInfo{refstyle.sty}
233 % \title{\vspace*{-1cm}
234 % The \RS\ package\thanks{This file has version number
235 % \fileversion, last revised
236 % \filedate.}}
237 % \author{Danie Els\\[1ex]
238 % \normalsize e-mail: \texttt{\href{mailto:[email protected]}%
239 % {[email protected]}}}
240 % \date{\filedate}
241 % \maketitle
242 % \begin{center}
243 % \textbf{Overview of the \RS\ package}
244 % \end{center}
245 % \noindent
246 % When writing complex documents, often a large number of commands
247 % for different type of references are defined, for example:
248 % \begin{Ipara}
249 % |\newcommand*{\eqref}[1]{eqn~(\ref{#1})}|\\
250 % |\newcommand*{\Eqref}[1]{Equation~(\ref{#1})}|
251 % \end{Ipara}
252 % The \RS\ package was developed to automate this process. The
253 % package provides a user interface to define sets of reference
254 % and label commands for each referable object such as an equation
255 % or a table, etc. When you declare, for example, a set of
256 % reference commands to an equation:
257 % \begin{Ipara}
258 % \cmd{\newref}|{eq}|\mkeylst\
259 % \end{Ipara}
260 % \noindent
261 % a series of commands of the format \cmd{\eq...} and \cmd{\Eq...}
262 % are produced. The configuration options are set with a list of
263 % key-values. Prefixes, inserts and other options for all the
264 % different perturbations such as capitalized first letters,
265 % singular and plural from, etc.\ can be defined. The
266 % configuration can be changed temporarily with an optional list
267 % of key-values when the commands are used. A direct interface to
268 % the \pkg{varioref} package is also provided.
269 % This enables compact reference formats:
270 % \begin{Itabb}
271 % \hspace{14em}\=\kill
272 % |\eqref{e1} ...| \ArTab\eqref{e1} ...\\
273 % |\Eqref[vref]{e1} ...| \ArTab\Eqref[vref]{e1} ...\\
274 % |\eqref[s]{e1} and ...| \ArTab\eqref[s]{e1} and ...\\
275 % |\eqref[name=eq.~]{e1} ...| \ArTab\eqref[name=eq.~]{e1} ...
276 % \end{Itabb}
277 % A range or a list of references can also be referred to in a
278 % consistent way.
279 % \begin{Itabb}
280 % \hspace{14em}\=\kill
281 % |\eqref{e1,e2,e3} ...| \ArTab\eqref{e1,e2,e3} ...\\
282 % |\eqrangeref[vref]{e1}{e3} ...| \ArTab\eqrangeref[vref]{e1}{e3} ...
283 % \end{Itabb}
284 %
285 % Templates for the different reference types and different
286 % languages can be loaded with a configuring file.
287 %
288 % The package is aimed at large projects, enabling a consistent
289 % way of producing references throughout a project. Enough
290 % flexibility is provided to make local changes to a single
291 % reference. For large projects such as a series of books or a
292 % multi volume thesis, written as freestanding documents, a
293 % facility is provided to interface to the \pkg{xr} package for
294 % external document references.
295 %
296 % \medskip
297 %
298 % \begin{center}
299 % \begin{fminipage}[.6\textwidth]
300 % See also \pkg{refconfig.pdf} for setup and examples.
301 % \end{fminipage}
302 % \end{center}
303
304 % \clearpage
305 %
306 % \tableofcontents
307 % \clearpage
308 %
309 %
310 % \section{Loading the \RS\ Package}
311 %
312 % \subsection{Document preamble}
313 %
314 % The \RS\ package is loaded in the preamble of the document:
315 % \begin{enumerate}
316 % \item[(a)] With a config file with \pkg{babel} language support
317 % \begin{Ipara}
318 % |\usepackage{varioref}[2001/09/04]%|~
319 % ${\leftarrow}$ To use the \opt{vref} option\\
320 % |\usepackage{refstyle}|
321 % \end{Ipara}
322 % When the package is loaded, it first searchers for a local user defined
323 % configuration file \file{refstyle.def}. If it is not available it
324 % looks for the global default config file \RScfg\ provided with this package.
325 % These configuration files are loaded before the package options are precess.
326 % It can therefore contain option commands using globally defined language
327 % options and can interface to \pkg{babel} for language changes. The macro
328 % \begin{Ipara}
329 % |\DeclareLangOpt{|\meta{language}|}{|\meta{definitions}|}|
330 % \end{Ipara}
331 % is provided to declare the package option \meta{language} and add
332 % \meta{definitions} to the |\extras|\meta{language} token for \pkg{babel}.
333 % It can only be used inside \RScfg\ or \file{refstyle.def}.
334 %
335 % \item[(b)]
336 % Or with an existing configuration with language support and addition
337 % of your own extensions
338 % \begin{Ipara}
339 % |\documentclass[norwegian]{article}|\\
340 % |\usepackage{babel} |\\
341 % |\usepackage{refstyle} |\\
342 % |\RSaddto{\RSnorwegian}{% |\\
343 % | \def\RSthmtxt{teorem~}% |\\
344 % | \def\RSthmstxt{teorem~}% |\\
345 % | \def\RSThmtxt{Teorem~}% |\\
346 % | \def\RSThmstxt{Teorem~}} |\\
347 % |\newref{thm}{ |\\
348 % | name = \RSthmtxt, |\\
349 % | names = \RSthmstxt, |\\
350 % | Name = \RSThmtxt, |\\
351 % | Names = \RSThmstxt, |\\
352 % | rngtxt = \RSrngtxt, |\\
353 % | lsttxt = \RSlsttxt, |\\
354 % | lsttwotxt = \RSlsttwotxt} |
355 % \end{Ipara}
356 %
357 % \item[(c)]
358 % Or without any configuration file, but by declaring your own
359 % reference commands in the preamble.
360 % \begin{Itabb}
361 % \cmd{\usepackage}|[noconfig]{refstyle}|\\
362 % \qquad\cmd{\newref}\marg{reftype$_{\,1}$}\mkeylst \\
363 % \qquad\cmd{\newref}\marg{reftype$_{\,2}$}\mkeylst\\
364 % \tab$\vdots$
365 % \end{Itabb}
366 %
367 % \item[(d)]
368 % Or with your own configuration file (without babel language support) for a specific project:
369 % \begin{Itabb}
370 % |\usepackage[noconfig]{refstyle}|\\
371 % |\input{thisproject.ref}|
372 % \end{Itabb}
373 %
374 % \end{enumerate}
375 %
376 % \subsection{Package options}
377 %
378 % \begin{description}
379 % \item[\opt{noconfig}] Neither of the user supplied \file{refstyle.def} config
380 % file or \file{refstyle.cfg} the config file supplied with this package
381 % are loaded. The user must declare his or her own definitions and templates.
382 % Note that these definitions are not passed on to \pkg{babel}'s language
383 % changing mechanisms.
384 %
385 % \item[\opt{nokeyprefix}] Custom labeling commands \argcmd{\rtp}{label} are generated
386 % by \pkg{refstyle} for every \meta{type} definition. It defaults to
387 % \begin{Itabb}
388 % \hspace{5em}\=hspace{5em}\=\kill
389 % \argcmd{\rtp}{label}|{abc}|
390 % \>\>~ $\rightarrow$ \cmd{\label}\rmeta{type\,:\,}{abc}
391 % \end{Itabb}
392 % With the \opt{nokeyprefix} option, the prefix is turned of and the
393 % labeling commands defaults to
394 % \begin{Itabb}
395 % \hspace{5em}\=hspace{5em}\=\kill
396 % \argcmd{\rtp}{label}|{abc}|
397 % \>\>~ $\rightarrow$ \cmd{\label}|{abc}|
398 % \end{Itabb}
399 % This is useful for old documents with existing labeling commands or
400 % where the user prefer not to use the \argcmd{\rtp}{label} commands.
401 %
402 %
403 % \end{description}
404 %
405 %
406 %
407 %
408 % \subsection{Companion packages}
409 %
410 % The \RS\ packages is intended for large projects. It is therefore
411 % important that it works together with, or has direct interfaces
412 % to the following packages:
413 % \begin{description}
414 % \item[\pkg{varioref}:\footnotemark]
415 % \footnotetext{\pkg{varioref} v1.3c, 2001/09/04 or later,
416 % because the starred versions of the commands
417 % are used.}
418 % Produce sophisticated page and page range references.
419 %
420 % \item[\pkg{hyperref}:\footnotemark]
421 % \footnotetext{\pkg{hyperref} v6.72r, 2002/05/27 or later,
422 % where a bug for interference with
423 % \pkg{varioref} was fixed.}
424 % To establish hyper links between the references and the
425 % labels.
426 %
427 % \item[\pkg{xr, xr-hyper}:]
428 % To establish references to external documents.
429 %
430 % \item[\pkg{showkeys}:]
431 % To show all the labels and references. This is very useful
432 % to find labels in large documents.
433 % \end{description}
434 %
435 % \clearpage
436 % \section{User Interface}
437 %
438 % The \RS\ package has one configuring command, \DescribeMacro{\newref}
439 % \cmd{\newref}, that internally creates a series of label and
440 % reference commands:
441 % \blankline
442 %
443 % \begin{cminipage}[\linewidth]
444 % \newcommand*{\crsi}{\smash{\rule[0pt]{.4pt}{1.25em}\rule[.5ex]{1.5em}{.4pt}}}^^A
445 % \newcommand*{\crsl}{\smash{\rule[.5ex]{.4pt}{1.5em}\rule[.5ex]{1.5em}{.4pt}}}^^A
446 % \begin{Itabb}
447 % \hspace*{2em}\=\hspace{2em}\=\hspace{10em}\=\kill
448 % \cmd{\newref}\marg{\rtp}\mkeylst\tab\mbox{}\\[.75ex]
449 % \>\crsi \>\argcmd{{\rtp}}{key} \> Reference argument prefix \\[.75ex]
450 % \>\crsl \>\argcmd{{\rtp}}{label} \> Custom label \\[.75ex]
451 % \>\crsl \>\argcmd{{\rtp}}{ref} \> In text reference \\[.75ex]
452 % \>\crsl \>\argcmd{{\Rtp}}{ref} \> Start of sentence reference \\[.75ex]
453 % \>\crsl \>\argcmd{{\rtp}}{rangeref} \> In text range reference \\[.75ex]
454 % \>\crsl \>\argcmd{{\Rtp}}{rangeref} \> Start of sentence range reference\quad\mbox{}\\[.75ex]
455 % \>\crsl \>\argcmd{{\rtp}}{pageref} \> Page reference
456 % \end{Itabb}
457 % \end{cminipage}
458 % \blankline
459 %
460 % \noindent
461 % All the \cmeta{\rtp}... commands, excluding \argcmd{{\rtp}}{key}
462 % and \argcmd{{\rtp}}{label} are robust.
463 % All the options for the referencing commands are set with a
464 % key-value list. \Tabref[vref=far]{refopt} gives a full list of all the
465 % key-values and defaults.
466 %
467 % The \RS\ package do not redefine any internal \LaTeX\ commands and
468 % depends only on the \cmd{\label}, \cmd{\ref}, \cmd{\pageref} and
469 % the \pkg{varioref} commands.
470 % The internally defined commands do not overwrite any
471 % existing command with the same name, and an error results if a command
472 % already exists. The exception is commands declared with a previous
473 % \cmd{\newref} call, can be redefined by calling \cmd{\newref} again
474 % with a new set of parameter.
475 % If the \pkg{amsmath} package is loaded, and you define
476 % \cmd{\newref}|{eq}| for references to equations, you need to
477 % undefine \cmd{\eqref} before issuing \cmd{\newref} by
478 % \begin{Ipara}
479 % \cmd{\let}\cmd{\eqref}|=|\cmd{\relax}
480 % \end{Ipara}
481 %
482 %
483 % \section{Command Descriptions}
484 %
485 % The structure of the label and reference commands is given by the
486 % syntax diagrams that follows. Examples are included for references
487 % to equations, defined according to the template in
488 % \RScfg\ with the
489 % \cmd{\newref}|{eq}|\mkeylst. See also \secref{keyvals} for
490 % explanations of the key-values.
491 %
492 % \subsection{The reference key}
493 %
494 % \begin{cminipage}[\linewidth]
495 % \begin{syntdiag}
496 % \tok{\argcmd{\rtp}{key}}
497 % \end{syntdiag}
498 % \end{cminipage}
499 % \blankline
500 % \noindent
501 % The \argcmd{\rtp}{key} command returns the prefix added to the
502 % argument of the label and the reference commands, for example:
503 %
504 % \begin{Itabb}
505 % \hspace{10em}\=hspace{5em}\=\kill
506 % \cmd{\newref}\marg{\rtp}|{}|
507 % \>\>\argcmd{\rtp}{key} $\rightarrow$ \meta{type\,:\,}\\
508 % \cmd{\newref}\marg{\rtp}|{key=xxx-}|
509 % \>\>\argcmd{\rtp}{key} $\rightarrow$ |xxx-|
510 % \end{Itabb}
511 %
512 % \noindent
513 % The \argcmd{\rtp}{key} command is not a general command, but was
514 % provided only as a link to the standard \LaTeX{} \cmd{\ref} and
515 % \cmd{\pageref} commands:
516 %
517 % \begin{Itabb}
518 % \hspace{10em}\=hspace{5em}\=\kill
519 % \cmd{\label}|{|\argcmd{\rtp}{key}| abc}|
520 % \>\>~ $\rightarrow$ \cmd{\label}\rmeta{type\,:\,}{abc}\\
521 % \cmd{\ref}|{|\argcmd{\rtp}{key}| abc}|
522 % \>\>~ $\rightarrow$ \cmd{\ref}\rmeta{type\,:\,}{abc}
523 % \end{Itabb}
524 % Note if the the \opt{nokeyprefix} option is active then the \argcmd{\rtp}{key}
525 % is empty.
526 %
527 % \blankline
528 % \noindent
529 % \textbf{\slshape Examples:} equations
530 % with \cmd{\newref}|{eq}|\mkeylst:
531 %
532 % \begin{Itabb}
533 % \hspace*{18em}\=\kill
534 % |\eqkey| \> \eqkey \\
535 % |in eq.~\ref{\eqkey e1} ...| \>in eq.~\ref{\eqkey e1} ... \\
536 % |on page \pageref{\eqkey e1} ...|\>on page \pageref{\eqkey e1} ... \\
537 % |\vpageref*{\eqkey e1} ... | \>\vpageref*{\eqkey e1} ...
538 % \end{Itabb}
539 %
540 % \subsection{Reference label}
541 %
542 % \begin{cminipage}[\linewidth]
543 % \begin{syntdiag}
544 % \tok{\argcmd{\rtp}{label}"{"<lbl>"}"}
545 % \end{syntdiag}
546 % \end{cminipage}
547 % \blankline
548 %
549 % \noindent
550 % The command \argcmd{\rtp}{label} prefix the reference
551 % string in the \cmd{\label} with the string \meta{type\,:\,}, or its
552 % redefinition with the \opt{key} option.
553 %
554 % \begin{Itabb}
555 % \hspace{10em}\=hspace{5em}\=\kill
556 % \argcmd{\rtp}{label}|{abc}|
557 % \>\>~ $\rightarrow$ \cmd{\label}\rmeta{type\,:\,}{abc}
558 % \end{Itabb}
559 % \blankline
560 %
561 % \noindent
562 % \textbf{\slshape Examples:}
563 %
564 % \begingroup
565 % \begin{Ipara}
566 % Let $z = x+\mathrm{i} y$ and $\alpha = \beta + \mathrm{i}
567 % \gamma$, with $\mathrm{i}^2 = -1$, then
568 % \begin{align}
569 % &\mathrm{e}^z = \mathrm{e}^x \left(\cos y + \mathrm{i} \sin y \right)
570 % \spestag{e1}\\
571 % &z^\alpha = \mathrm{e}^{\alpha \ln z}
572 % \spestag{e2}\\
573 % \intertext{\Eqref{e1,e2} lead to the following interesting results:}
574 % &\mathrm{e}^{\mathrm{i} \pi} + 1 = 0 \spestag{e3}\\
575 % &\mathrm{i}^\mathrm{i} = \mathrm{e}^{-\pi/2}\spestag{e4}
576 % \end{align}
577 % \end{Ipara}
578 % \endgroup
579 %
580 %
581 % \subsection{Reference commands}
582 %
583 % \begin{cminipage}[1.05\textwidth]
584 % \begin{syntdiag}
585 % \tok{\argcmd{\rtp}{ref}}
586 % \begin{stack}\\ \tok{$\ast$} \end{stack}
587 % \begin{stack}\\ \tok{\okeylst} \end{stack}
588 % "{"
589 % \begin{rep} \tok{<lbl>} \\ ~,~ \end{rep}
590 % "}"
591 % \end{syntdiag}
592 % \end{cminipage}
593 % \smallskip
594 %
595 % \begin{cminipage}[1.05\textwidth]
596 % \begin{syntdiag}
597 % \tok{\argcmd{\Rtp}{ref}}
598 % \begin{stack}\\ \tok{$\ast$} \end{stack}
599 % \begin{stack}\\ \tok{\okeylst} \end{stack}
600 % \tok{"{"}
601 % \begin{rep} \tok{<lbl>} \\ ~,~ \end{rep}
602 % \tok{"}"}
603 % \end{syntdiag}
604 % \end{cminipage}
605 % \blankline
606 % \noindent
607 % The |*| optional form of the \argcmd{\rtp}{ref} and
608 % \argcmd{\Rtp}{ref} commands eliminates the
609 % name prefix. The |[s]| optional key-value argument is for the
610 % plural form of the name prefix.
611 % \blankline
612 %
613 % \noindent
614 % \textbf{\slshape Examples:}
615 % \begin{Itabb}
616 % \hspace*{21em}\=\kill
617 % |in \eqref{e1} ...| \>in \eqref{e1} ... \\
618 % |in \eqref[s]{e1}--\eqref*{e4} ...|\>in \eqref[s]{e1}--\eqref*{e4} ...\\
619 % |in \eqref[name=eq.~]{e2} ...| \>in \eqref[name=eq.~]{e2} ...
620 % \end{Itabb}
621 % \pagebreak[1]
622 % \noindent
623 % A list of references can be used:
624 % \begin{Itabb}
625 % \hspace*{21em}\=\kill
626 % |in \eqref{e1,e2} ...| \>in \eqref{e1,e2} ... \\
627 % |in \eqref{e1,e2,e3} ...| \>in \eqref{e1,e2,e3} ... \\
628 % |in \eqref[lsttxt={, and~}]{e1,e2,e3} ...| \>in \eqref[lsttxt={, and~}]{e1,e2,e3} ...
629 % \end{Itabb}
630 % \pagebreak[2]
631 % The reference to the page can be included with the \opt{vref} or \opt{vref=far}
632 % options that activates the \pkg{varioref} reference.
633 % \begin{Itabb}
634 % \hspace*{18em}\=\kill
635 % |in \eqref[vref]{e1} ...| \>in \eqref[vref]{e1} ...\\
636 % |in \eqref[vref=far]{e1} ...| \>in \eqref[vref=far]{e1} ...
637 % \end{Itabb}
638 % The \argcmd{\Rtp}{ref} command is identical to the
639 % \argcmd{\rtp}{ref} command except that it uses the \opt{Name} and
640 % \opt{Names} key-value options.
641 % \begin{Itabb}
642 % \hspace*{18em}\=\kill
643 % |\Eqref{e1} is ...| \>\Eqref{e1} is ... \\
644 % |\Eqref{e1,e2} are ...| \>\Eqref{e1,e2} are ... \\
645 % |\Eqref[lsttxt={\ or~}]{e1,e2,e3}| \>\Eqref[lsttxt={\ or~}]{e1,e2,e3}
646 % \end{Itabb}
647 % \noindent
648 % References to external documents can be added with the \opt{xr}
649 % option. Please read the documentation of the \pkg{xr} package.
650 %
651 % \begin{Itabb}
652 % \hspace{10em}\=hspace{5em}\=\kill
653 % \cmd{\eqref}|[|\opt{xr}|=A-]{xyz}| \> \>$\rightarrow$~
654 % |equation~\ref{A-eq:xyz}|
655 % \end{Itabb}
656 %
657 %
658 % \subsection{Range reference commands}
659 %
660 % \begin{cminipage}[\linewidth]
661 % \begin{syntdiag}
662 % \tok{\argcmd{\rtp}{rangeref}}
663 % \begin{stack}\\ \tok{$\ast$} \end{stack}
664 % \begin{stack}\\ \tok{\okeylst} \end{stack}
665 % \tok{"{"<lbl>$_1$"}{"<lbl>$_2$"}"}
666 % \end{syntdiag}
667 % \end{cminipage}
668 % \smallskip
669 %
670 % \begin{cminipage}[\linewidth]
671 % \begin{syntdiag}
672 % \tok{\argcmd{\Rtp}{rangeref}}
673 % \begin{stack}\\ \tok{$\ast$} \end{stack}
674 % \begin{stack}\\ \tok{\okeylst} \end{stack}
675 % \tok{"{"<lbl>$_1$"}{"<lbl>$_2$"}"}
676 % \end{syntdiag}
677 % \end{cminipage}
678 % \blankline
679 %
680 % \noindent
681 % The \argcmd{\rtp}{rangeref} and \argcmd{\Rtp}{rangeref} commands
682 % return a range of references and take two arguments. The |*|
683 % optional form again eliminates the name prefix.
684 % \blankline
685 %
686 % \noindent
687 % \textbf{\slshape Examples:}
688 % \begin{Itabb}
689 % \hspace*{19em}\=\kill
690 % |in \eqrangeref{e1}{e4} ...| \>in \eqrangeref{e1}{e4} ... \\
691 % |... and \eqrangeref*{e1}{e4} ...| \>... and \eqrangeref*{e1}{e4} ... \\
692 % |\Eqrangeref{e1}{e4} are ...| \>\Eqrangeref{e1}{e4} are ... \\
693 % |\Eqrangeref[vref,rngtxt=--]{e1}{e4}| \>\Eqrangeref[rngtxt=--,vref]{e1}{e4}
694 % \end{Itabb}
695 %
696 %
697 % \subsection{Page reference command}\seclabel{PRefCmds}
698 %
699 % \begin{cminipage}
700 % \begin{syntdiag}
701 % \tok{\argcmd{\rtp}{pageref}}
702 % \begin{stack}\\ \tok{\okeylst} \end{stack}
703 % \tok{"{"<lbl>"}"}
704 % \end{syntdiag}
705 % \end{cminipage}
706 % \blankline
707 % \noindent
708 % The \argcmd{\rtp}{pageref} commands returns the page number of a
709 % reference.
710 % \blankline
711 %
712 % \noindent
713 % \textbf{\slshape Examples:}
714 % \begin{Itabb}
715 % \hspace*{18em}\=\kill
716 % |it is on page \eqpageref{e1} ...| \>it is on page \eqpageref{e1} ...\\
717 % |it is \eqpageref[vref]{e1} ...| \>it is \eqpageref[vref]{e1} ...
718 % \end{Itabb}
719 %
720 %
721 %^^A=================================================================
722 % \begin{table}
723 % \newcommand*{\Q}{\ensuremath{\blacksquare}}^^A
724 % \newcommand*{\X}{\ensuremath{\square}}^^A
725 % \setlength{\fboxsep}{1em}^^A
726 % \centering
727 % \caption[The available options and key-value parameters]^^A
728 % {The available options and key-value parameters for
729 % the label and reference commands of the \RS\ package.}
730 % \tablabel{refopt}
731 % \blankline
732 % \begin{cminipage}[.9\textwidth]
733 % \renewcommand{\thempfootnote}{\fnsymbol{mpfootnote}}
734 % \renewcommand{\footnoterule}{}
735 % \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}llccccccc@{}}
736 % & & \multicolumn{7}{c}{Commands\footnote{^^A
737 % The commands are obtained by calling the configuring command
738 % \cmd{\newref} and setting the default key-values. The
739 % active key-values can be changed temporarily inside the
740 % commands.}} \\
741 % \cline{3-9}
742 % Parameter & Default &
743 % \begin{turn}{90}\argcmd{{\rtp}}{key}~ \end{turn}&
744 % \begin{turn}{90}\argcmd{{\rtp}}{label}~ \end{turn}&
745 % \begin{turn}{90}\argcmd{{\rtp}}{ref}~ \end{turn}&
746 % \begin{turn}{90}\argcmd{{\Rtp}}{ref}~ \end{turn}&
747 % \begin{turn}{90}\argcmd{{\rtp}}{rangeref}~ \end{turn}&
748 % \begin{turn}{90}\argcmd{{\Rtp}}{rangeref}~ \end{turn}&
749 % \begin{turn}{90}\argcmd{{\rtp}}{pageref}~ \end{turn}\\
750 % \hline
751 % \noalign{\smallskip}
752 % ~$\ast$ & &\X &\X &\Q &\Q &\Q &\Q &\X\\
753 % \okeylst & &\X &\X &\Q &\Q &\Q &\Q &\Q\\[1ex]
754 % \opt{key} &|={|\meta{\rtp:}|},| &\X &\X &\Q &\Q &\Q &\Q &\Q\\
755 % \opt{s} & |={true}|\footnote{^^A
756 % Options defaults to \opt{true} but is initialized
757 % as \opt{false}. The \argcmd{{\rtp}}{ref}\texttt{[s]}\marg{lbl}
758 % command results in the plural: \opt{names}.
759 % The same principle is also valid for the \opt{vref}
760 % option.\fnlabel{b}}|,|
761 % &\X &\X &\Q &\Q &\X &\X &\X\\
762 % \opt{vref} &|={true}|\fnref*{b}|,|
763 % &\X &\X &\Q &\Q &\Q &\Q &\Q\\
764 % \opt{xr} &|={},| &\X &\X &\Q &\Q &\Q &\Q &\Q\\[1ex]
765 % \opt{name} &|={},| &\X &\X &\Q &\X &\X &\X &\X\\
766 % \opt{names}\footnote{^^A
767 % Option depends on the selection of the \texttt{s=true/false}
768 % optional key-value for singular or plural.\fnlabel{c}}
769 % &|={},| &\X &\X &\Q &\X &\Q &\X &\X\\
770 % \opt{Name} &|={},| &\X &\X &\X &\Q &\X &\X &\X\\
771 % \opt{Names}\fnref*{c}
772 % &|={},| &\X &\X &\X &\Q &\X &\Q &\X\\
773 % \opt{lsttwotxt} &|={\space and~},| &\X &\X &\Q &\Q &\X &\X &\X\\
774 % \opt{lsttxt} &|={\space and~},| &\X &\X &\Q &\Q &\X &\X &\X\\
775 % \opt{rngtxt} &|={\space to~},| &\X &\X &\X &\X &\Q &\Q &\X\\[1ex]
776 % \opt{refcmd} &|=\ref{#1},| &\X &\X &\Q &\Q &\Q &\Q &\Q\\
777 %
778 % \hline
779 % \noalign{\smallskip}
780 %
781 % \footnotesize \Q\ -- \makebox[0pt][l]{\footnotesize Available}\\
782 % \footnotesize \X\ -- \makebox[0pt][l]{Not available}
783 % \end{tabular*}
784 % \end{cminipage}
785 % \end{table}
786 %^^A=================================================================
787 %
788 %
789 %
790 % \clearpage
791 % \section{\pkg{Keyval} Optional Arguments}\seclabel{keyvals}
792 %
793 % Al the options for the referencing commands are set with a key-value
794 % list. \Tabref[vref]{refopt} gives a full list of all the key-values and
795 % defaults. The options can also be changed locally with the
796 % \okeylst\ optional arguments.
797 %
798 %
799 % \subsection{Identifier: \opt{key}}
800 %
801 % The \opt{key} key-value is the prefix to the reference label
802 % of the \cmd{\ref} and \cmd{\pageref} commands.
803 % The default is \opt{key=}\meta{type\,:\,}.
804 % With the default \RScfg:
805 %
806 % \begin{Itabb}
807 % \tab\=\hspace{3.5cm}\=\hspace{2em}\=\kill
808 % \cmd{\newref}|{tab}{...}|\\[1ex]
809 % \>|\tablabel{abc}|
810 % \>~ $\rightarrow$ |\label{tab:abc}|\\
811 % \>|\tabref{abc}|
812 % \>~ $\rightarrow$ |table~\ref{tab:abc}|\\[1ex]
813 % \cmd{\newref}|{tab}{key=xxx-,...}|\\[1ex]
814 % \>|\tablabel{abc}|
815 % \>~ $\rightarrow$ |\label{xxx-abc}|\\
816 % \>|\tabref{abc}|
817 % \>~ $\rightarrow$ |table~\ref{xxx-abc}|
818 % \end{Itabb}
819 % For existing documents containing labels such as |\label{tab:xx}|,
820 % you can use the \opt{nokeyprefix} option which defines \opt{key}|={}|. The
821 % normal \cmd{\label} command can then be used and the reference
822 % commands defaults to
823 % \begin{Itabb}
824 % \tab\=\hspace{3.5cm}\=\hspace{2em}\=\kill
825 % \>\cmd{\label}|{tab:xx}| \\
826 % \>|\tabref{tab:xx}| \>~ $\rightarrow$ |table~\ref{tab:xx}|
827 % \end{Itabb}
828 %
829 %
830 % \subsection{Plural form: \opt{s}}
831 %
832 % The \opt{s} conditional option (\texttt{true/false}) switches the
833 % singular/plural form of the reference on and off. The default is
834 % \opt{s}\texttt{=true}, but it is initialized to \texttt{false}.
835 % \begin{Itabb}
836 % \tab\=\hspace{3.5cm}\=\hspace{2em}\=\kill
837 % |\tabref{abc}|
838 % \>\>~ $\rightarrow$ |table~\ref{tab:abc}|\\
839 % |\tabref[s]{abc}|
840 % \>\>~ $\rightarrow$ |tables~\ref{tab:abc}|
841 % \end{Itabb}
842 %
843 %
844 % \subsection{Extended reference: \opt{vref}}
845 %
846 % The \opt{vref} conditional option (\texttt{true/far/false}) switches the
847 % \pkg{varioref} page referencing on and off. The default is
848 % \opt{vref}\texttt{=true}, but it is initialized to \texttt{false}.
849 %
850 % \begin{Itabb}
851 % \tab\=\hspace{3.5cm}\=\hspace{2em}\=\kill
852 % |\tabref{abc}|
853 % \>\>~ $\rightarrow$ |table~\ref{tab:abc}|\\
854 % |\tabref[vref]{abc}|
855 % \>\>~ $\rightarrow$ |table~\ref{tab:abc}|
856 % |\vpageref[\unskip]{tab:abc}|\\
857 % |\tabref[vref=far]{abc}|^^A
858 % \>\>~ $\rightarrow$ |table~\ref{tab:abc}|
859 % |\reftextfaraway{tab:abc}|
860 % \end{Itabb}
861 %
862 %
863 % \subsection{External interfaces: \opt{xr}}
864 %
865 % The \opt{xr} option is for references to external documents.
866 % It inserts a prefix in the reference label, compatible with the
867 % \pkg{xr} package. The default is \opt{xr}|={}|.
868 %
869 % External document can be defined in the preamble with the
870 % \pkg{xr} or \pkg{xr-hyper} packages:
871 % \begin{Ipara}
872 % \cmd{\usepackage}|{xr}|\\
873 % \cmd{\externaldocument}\oarg{xr\_key}\marg{filename}
874 % \end{Ipara}
875 %
876 % \noindent
877 % If, for example, an external document defined with
878 % \meta{xr\_key}\texttt{=\{A-\}}, uses an identical setup (e.g.\ the same
879 % \RScfg), then it can be referenced with
880 %
881 % \begin{Itabb}
882 % \tab\=\hspace{3.5cm}\=\hspace{2em}\=\kill
883 % |\tabref[xr=A-]{abc}|
884 % \>\>~ $\rightarrow$ |table~\ref{A-tab:abc}|
885 % \end{Itabb}
886 % \noindent or otherwise
887 % \begin{Itabb}
888 % \tab\=\hspace{3.5cm}\=\hspace{2em}\=\kill
889 % |\tabref[xr=A-,key=]{abc}|
890 % \>\>~ $\rightarrow$ |table~\ref{A-abc}|
891 % \end{Itabb}
892 %
893 %
894 % \subsection{Language parameters: \opt{name}, \opt{names},
895 % \opt{Name}, \opt{Names}, \opt{rngtxt}, \opt{lsttwotxt}, \opt{lsttxt}}
896 % \seclabel{langopts}
897 %
898 % This key-values contain the text prefixes and insertions.
899 % Every house style or user has his or her own preference for naming the reference types,
900 % therefore are there no defaults provided.
901 %
902 % \begin{Itabb}
903 % \hspace*{1.5cm}\=\hspace{7cm}\=\kill
904 % \opt{name} \> ---~Inside sentence reference prefix (singular)
905 % \> default=|{}|\\
906 % \opt{names}\> ---~Inside sentence reference prefix (plural)
907 % \> default=|{}|\\
908 % \opt{Name} \> ---~First word reference prefix (singular)
909 % \> default=|{}|\\
910 % \opt{Names}\> ---~First word reference prefix (plural)
911 % \> default=|{}|\\
912 % \opt{rngtxt}\> ---~Range of references
913 % \> default=|{\ to~}|\\
914 % \opt{lsttwotxt}\> ---~List of references (two)
915 % \> default=|{\ and~}|\\
916 % \opt{lsttxt}\> ---~List of references (more than two)
917 % \> default=|{\ and~}|
918 % \end{Itabb}
919 % \noindent
920 % Good typographic style manuals recommend the minimum use of
921 % capital letters and punctuation that breaks the flow of a sentence
922 % or paragraph. For abbreviations, Bringhurst\cite{Bring1996}
923 % recommends the Oxford house style: Use a period only when the word
924 % stops prematurely. The period is omitted if the abbreviation
925 % begins with the first letter and end with the last. As an example
926 % for equations, use eq.~(1) or eqn~(1).
927 % A good guideline is not to abbreviate any reference type names.
928 % If a sentence starts with a
929 % reference then the type name must always be written in full.
930 % A typical example for references to a table is:
931 % \begin{Ipara}
932 % \opt{name}| ={table~}, |\opt{names}| ={tables~},|\\
933 % \opt{Name}| ={Table~}, |\opt{Names}| ={Tables~},|\\
934 % \opt{rngtxt}|={\ to~}, |\opt{lsttxt}|={, and~}, |\opt{lsttwotxt}|={\ and~},|
935 % \end{Ipara}
936 % Note the hardspace after the text. It is needed to keep the text
937 % and the reference together on the same line.
938 %
939 % The \RS\ configuration file can be setup to interface with \pkg{babel}
940 % for different languages or for automatic language changes inside a
941 % document. The language specific key-values can be added to the
942 % \pkg{babel} hook |\extras|\meta{language}. The command
943 % \DescribeMacro{\DeclareLangOpt}\cmd{\DeclareLangOpt}\footnote{^^A
944 % Only for use in \RScfg\ the default config file}
945 % is provided to supply a \meta{language} option to the package
946 % and to add the option contents to |\extras|\meta{language}. The
947 % default config file contains the following lines for equations:
948 % \begin{Ipara}
949 % |\newcommand\RSenglish{% |\\
950 % | \def\RSeqtxt{equation~}% |\\
951 % | \def\RSeqstxt{equations~}%|\\
952 % | \def\RSEqtxt{Equation~}% |\\
953 % | \def\RSEqstxt{Equations~}%|\\
954 % | : |\\
955 % | } |\\
956 % |\DeclareLangOpt{english}{\RSenglish}|
957 % \end{Ipara}
958 % \DescribeMacro{\RSaddto}or manually with the \cmd{\RSaddto} command
959 % \begin{Ipara}
960 % |\RSaddto{\extrasenglish}{\RSenglish}|
961 % \end{Ipara}
962 % The key-value options for language specific options
963 % are then set as:
964 % \begin{Ipara}
965 % |\newref{eq}{% |\\
966 % | name = \RSeqtxt, |\\
967 % | names = \RSeqstxt,|\\
968 % | Name = \RSEqtxt, |\\
969 % | Names = \RSEqstxt,|\\
970 % | : |\\
971 % | } |
972 % \end{Ipara}
973 %
974 % \noindent\LaTeX{}/\pkg{babel} provides some language specific
975 % names that can be utilized.
976 %
977 % \begin{Ipara}
978 % |\chaptername \appendixname|\\
979 % |\figurename \tablename|\\
980 % |\partname \pagename|
981 % \end{Ipara}
982 %
983 % To setup a multilingual document with \pkg{babel},
984 % \emph{always} make the language options global so that other
985 % language compliant packages can detect it.
986 % A typical setup for an Afrikaans/English document would be:
987 % {\makeatletter\def\meta@font@select{\normalfont\ttfamily\slshape}
988 % \begin{Ipara}
989 % |\documentclass[UKenglish,afrikaans,|\meta{options}|]{|\meta{LaTeX\_class}|}|\\
990 % |\usepackage[T1]{fontenc}%..|\texttt{\slshape hyphenation of words with accents}\\
991 % |\usepackage{babel}%........|\texttt{\slshape language def's}\\
992 % |\usepackage{varioref}%.....|\texttt{\slshape for \opt{vref} option}\\
993 % |\usepackage{refstyle}|
994 % \end{Ipara}}
995 %
996 %
997 % \subsection{Reference formatting command: \opt{refcmd}}
998 %
999 % The \opt{refcmd} key-value holds the contents of the internal
1000 % command that formats the reference. The |#1| parameter
1001 % passed to the command is the full reference label.
1002 % For example:
1003 % \begin{Itabb}
1004 % \hspace{10em}\=hspace{5em}\=\kill
1005 % \opt{refcmd}|=(\ref{#1})| \> $\rightarrow$~
1006 % |(\ref{|\meta{label}|})|
1007 % \end{Itabb}
1008 %
1009 % External commands can be employed. For example, to make references
1010 % to equations identical to the \AmS\ \cmd{\eqref} command:
1011 % \begin{Itabb}
1012 % \opt{refcmd}|={\textup{\tagform@{\ref{#1}}}}%|~~It needs \file{amsmath.sty}
1013 % \end{Itabb}
1014 %
1015 % The \opt{refcmd} can be used in conjuntion with the |\ifRSstar|,
1016 % |\ifRSnameon|, |\ifRSplural| and |\ifRScapname| internal
1017 % conditional variables to format the reference. As an example for a
1018 % reference to a footnote, where a duplicate footnote mark is needed,
1019 % can the \opt{refcmd} be configured so that the starred form of the
1020 % reference command produce a superscripted duplicate mark:
1021 % \begin{Itabb}
1022 % |\newcommand{\RSfnmark}[1]{%|\\
1023 % | \begingroup |\\
1024 % | \unrestored@protected@xdef\@thefnmark{#1}%|\\
1025 % | \endgroup |\\
1026 % | \@footnotemark} |\\[1ex]
1027 % \opt{refcmd}|={\ifRSstar\RSfnmark{\ref{#1}}\else(\ref{#1})\fi}|
1028 % \end{Itabb}
1029 % \noindent The second footnote mark, \fnref*[name]{b}, in
1030 % \tabref[vref]{refopt}, was obtained in this way with the reference
1031 % |\fnref*{b}|. See \RScfg\ for another
1032 % example for references to chapters and appendices.
1033 %
1034 % The \pkg{nameref} package can easily be incorporated if you need elaborate
1035 % references which include the section or chapter name:
1036 % \begin{Ipara}
1037 % |\Secref[vref, refcmd={\S\ref{#1}, `\nameref{#1}'}]{PRefCmds}|
1038 % \end{Ipara}
1039 % gives
1040 % \begin{Ipara}
1041 % \Secref[vref, refcmd={\S\ref{#1}, `\nameref{#1}'}]{PRefCmds}
1042 % \end{Ipara}
1043 %
1044 % \section{Default configuration files}
1045 %
1046 % The \pkg{refstyle} package first searches for the \file{refstyle.def}
1047 % configuration file, and if it not found, then it uses the default
1048 % configuration file \RScfg\ that is supplied with the package.
1049 %
1050 % The default configuration file, \RScfg, makes a
1051 % number of default reference declarations and provides language
1052 % definitions for the language parameters. See the file
1053 % \file{refconfig.pdf} for the documentation.
1054 % \medskip
1055 %
1056 % \begin{center}
1057 % \begin{fminipage}[.55\textwidth]
1058 % \slshape Any user is welcome to customize the
1059 % local copy of the \RScfg\ file or copy
1060 % the relevant contents to your own \file{refstyle.def}
1061 % configuration file.
1062 % \end{fminipage}
1063 % \end{center}
1064 %
1065 % \begin{thebibliography}{99}
1066 % \bibitem{Bring1996}
1067 % {Bringhurst, R.} (1996), \emph{The elements of typographic style},
1068 % Hartley \& Marks Publishers, Point Roberts, WA, USA and Vancouver,
1069 % BC, Canada, second edn.
1070 % \end{thebibliography}
1071 %
1072 % \StopEventually{\PrintChanges\PrintIndex}
1073 % \clearpage
1074 %
1075 % \section{Implementation: \pkg{refstyle.sty}}
1076 %
1077 % \subsection{Identification}
1078 % \begin{macrocode}
1079 %<*pkg>
1080 \NeedsTeXFormat{LaTeX2e}
1081 \ProvidesPackage{refstyle}[\RefstyleFileDate\space
1082 \RefstyleFileVersion\space
1083 Reference formatting (DNJ Els)]
1084 \newcommand*{\RS@pkgname}{refstyle}
1085 % \end{macrocode}
1086 %
1087 %
1088 % \subsection{External packages}
1089 %
1090 % Load all the external packages.
1091 % \begin{macrocode}
1092 \RequirePackage{keyval}
1093 % \end{macrocode}
1094 %
1095 % \begin{macro}{\RS@setkeys}
1096 % \changes{v0.3}{2006/09/09}{original \cmd{\setkeys} copy}
1097 % Note if \pkg{xkeyval} is loaded, it redefines \pkg{keyval}'s
1098 % macros. To fix this bug, we need the original \cmd{\setkeys}
1099 % command.
1100 % \begin{macrocode}
1101 \def\RS@setkeys#1#2{%
1102 \def\KV@prefix{KV@#1@}%
1103 \let\@tempc\relax
1104 \KV@do#2,\relax,}
1105 % \end{macrocode}
1106 % \end{macro}
1107 %
1108 % \noindent A small bug-fix for \pkg{showkeys}. Will be removed
1109 % after release of new version.
1110 %
1111 % \begin{macrocode}
1112 \@ifundefined{vref@space}{\let\vref@space\space}{}
1113 % \end{macrocode}
1114 %
1115 % \begin{macro}{\@safe@activestrue}
1116 % \changes{v0.5}{2010/11/02}{Add \cmd{\@safe@activesfalse}}
1117 % \begin{macro}{\@safe@activesfalse}
1118 % \changes{v0.5}{2010/11/02}{Add \cmd{\@safe@activestrue}}
1119 % If \pkg{babel} is not loaded, make the following
1120 % commands inactive.
1121 % \begin{macrocode}
1122 \providecommand*{\@safe@activestrue}{}
1123 \providecommand*{\@safe@activesfalse}{}
1124 % \end{macrocode}
1125 % \end{macro}
1126 % \end{macro}
1127 %
1128 % \subsection{Utility commands}
1129 %
1130 % \begin{macro}{\RS@namelet}
1131 % \begin{macro}{\RS@nameuse}
1132 % \begin{macro}{\RS@namedef}
1133 % \begin{macro}{\RS@robustnamedef}
1134 % \noindent
1135 % The following is a list of commands that take a variable \marg{name}
1136 % as argument. This enables on-the-fly definitions of user commands.
1137 % \begin{Itabb}
1138 % Usage:~\=\cmd{\RS@robustnamedef}\marg{name}~\=\kill
1139 % Usage:
1140 % \>\cmd{\RS@namelet}\marg{name}
1141 % \> $\rightarrow$ \cmd{\let}\cmeta{name}\\
1142 % \>\cmd{\RS@nameuse}\marg{name}
1143 % \> $\rightarrow$ \cmeta{name}\\
1144 % \>\cmd{\RS@namedef}\marg{name}
1145 % \> $\rightarrow$ \cmd{\def}\cmeta{name}\\
1146 % \>\cmd{\RS@robustnamedef}\marg{name}
1147 % \> $\rightarrow$
1148 % \cmd{\def}\cmeta{name}|{\protect|\cmeta{name\textvisiblespace}|}|^^A
1149 % \cmd{\def}\cmeta{name\textvisiblespace}
1150 % \end{Itabb}
1151 % \begin{macrocode}
1152 \newcommand*{\RS@namelet}[1]{\expandafter\let\csname #1\endcsname}
1153 \newcommand*{\RS@nameuse}[1]{\csname #1\endcsname}
1154 \newcommand*{\RS@namedef}[1]{\expandafter\def\csname #1\endcsname}
1155 \newcommand*{\RS@robustnamedef}[1]{%
1156 \expandafter\edef\csname #1\endcsname{%
1157 \noexpand\protect\RS@nameuse{#1 }}%
1158 \RS@namedef{#1 }}
1159 % \end{macrocode}
1160 % \end{macro}
1161 % \end{macro}
1162 % \end{macro}
1163 % \end{macro}
1164 %
1165 % \begin{macro}{\RS@ifundefined}
1166 % This is an improved definition\footnote{Posted by Markus Kohm
1167 % on c.t.t. 2002/11/11} for the \LaTeX{} kernel command
1168 % \cmd{\@ifundefined} that do not leave an undefined command
1169 % defined as \cmd{\relax} after the test.
1170 %
1171 % The usage is:
1172 % \cmd{\RS@ifundefined}\marg{name}\marg{true}\marg{false} executes
1173 % the contents of \meta{true} if \cmeta{name} is not defined and
1174 % \meta{false} if defined.
1175 % \begin{macrocode}
1176 \def\RS@ifundefined#1{%
1177 \begingroup\expandafter\expandafter\expandafter\endgroup
1178 \expandafter\ifx\csname#1\endcsname\relax
1179 \expandafter\@firstoftwo
1180 \else
1181 \expandafter\@secondoftwo
1182 \fi}
1183 % \end{macrocode}
1184 % \end{macro}
1185 %
1186 % \begin{macro}{\RS@removedef}
1187 % The command removes the definition of a command, including
1188 % robust definitions.
1189 % \begin{macrocode}
1190 \newcommand*{\RS@removedef}[1]{%
1191 \RS@namelet{#1}\@undefined%
1192 \RS@ifundefined{#1 }{}{\RS@namelet{#1 }\@undefined}}
1193 % \end{macrocode}
1194 % \end{macro}
1195 %
1196 % \begin{macro}{\RS@testednamedef}
1197 % \begin{macro}{\RS@testedrobustnamedef}
1198 % These command are identical to \cmd{\RS@namedef} and
1199 % \cmd{\RS@robustnamedef}, but only define the \cmeta{name}
1200 % command if it is legal. Otherwise an error message
1201 % is written to the log file and the program is terminated.
1202 % \begin{macrocode}
1203 \newcommand*{\RS@testednamedef}[1]{%
1204 \RS@ifnamedefinable{#1}\RS@namedef{#1}}
1205 % \end{macrocode}
1206 % \begin{macrocode}
1207 \newcommand*{\RS@testedrobustnamedef}[1]{%
1208 \RS@ifnamedefinable{#1}\RS@robustnamedef{#1}}
1209 % \end{macrocode}
1210 % \end{macro}
1211 % \end{macro}
1212 %
1213 % \begin{macro}{\RS@ifnamedefinable}
1214 % A modified version of the \LaTeX{} kernel command
1215 % (from ltdefns.dtx).
1216 % \begin{macrocode}
1217 \long\def\RS@ifnamedefinable #1{%
1218 \edef\reserved@a{#1}%
1219 \RS@ifundefined\reserved@a
1220 {\edef\reserved@b{\expandafter\@carcube \reserved@a xxx\@nil}%
1221 \ifx \reserved@b\@qend \RS@notdefinable\else
1222 \ifx \reserved@a\@qrelax \RS@notdefinable\else
1223 \PackageInfo{\RS@pkgname}{\@backslashchar\reserved@a\space created}%
1224 \fi
1225 \fi}%
1226 \RS@notdefinable}
1227 % \end{macrocode}
1228 % \end{macro}
1229 %
1230 % \begin{macro}{\RS@notdefinable}
1231 % The error message when an illegal definition is attempted.
1232 % \begin{macrocode}
1233 \gdef\RS@notdefinable{%
1234 \PackageError{\RS@pkgname}{%
1235 Command \@backslashchar\reserved@a\space
1236 already defined.\MessageBreak
1237 Or name \@backslashchar\@qend... illegal.\MessageBreak
1238 It can not be redefined by the \@backslashchar newref%
1239 }{%
1240 If \@backslashchar\reserved@a\space is not important\MessageBreak
1241 then \protect\let\@backslashchar\reserved@a%
1242 =\protect\relax,\MessageBreak
1243 else use a different \@backslashchar newref.}%
1244 }
1245 % \end{macrocode}
1246 % \end{macro}
1247 %
1248 % \begin{macro}{\RS@setbool}
1249 % The command\footnote{Taken from the \pkg{ifthen} package.}
1250 % \cmd{\RS@setbool}\marg{conditional}\marg{true/false}
1251 % sets the \meta{conditional} to |true| or |false|.
1252 % \begin{Itabb}
1253 % Usage:~\=
1254 % \cmd{\RS@setbool}|{RSplural}{false}|\quad\=$\rightarrow$\quad
1255 % |\RSpluralfalse|\\
1256 % \>\cmd{\RS@setbool}|{RSplural}{true}|\quad\>$\rightarrow$\quad
1257 % |\RSpluraltrue|
1258 % \end{Itabb}
1259 %
1260 % \begin{macrocode}
1261 \newcommand*{\RS@setbool}[2]{%
1262 \lowercase{\def\@tempa{#2}}%
1263 \@ifundefined{@tempswa\@tempa}%
1264 {\PackageError{\RS@pkgname}%
1265 {You can only set the option to `true' or `false'}\@ehc}%
1266 {\csname#1\@tempa\endcsname}}
1267 % \end{macrocode}
1268 % \end{macro}
1269 %
1270 %
1271 % \subsection{First character case changes}
1272 %
1273 % \begin{macro}{\RS@firstcap}
1274 % This macro\footnote{Posted by Dan Luecking on c.t.t.} change the
1275 % first character of a string to uppercase and returns the result
1276 % in \cmd{\RS@cap}.
1277 % \begin{Ipara}
1278 % Usage:~|\RS@fistcap xxxx\@nil| then |\RS@cap| $\rightarrow$ |Xxxx|
1279 % \end{Ipara}
1280 % \begin{macrocode}
1281 \def\RS@firstcap#1#2\@nil{%
1282 \iffalse{\fi
1283 \uppercase{\edef\RS@cap{\iffalse}\fi#1}#2}}%
1284 % \end{macrocode}
1285 % \end{macro}
1286 %
1287 %
1288 %
1289 % \subsection{Reference building commands}
1290 %
1291 % \begin{macro}{\ifRS@keyactive}
1292 % \changes{v0.4}{2010/10/21}{Add \opt{nokeyprefix} to turn of the key prefix}
1293 % We need to peek into the options list for the \opt{nokeyprefix} option
1294 % before the options are processed to find out if the key prefix must be
1295 % included in the |\|\meta{key}|label| command. Make \opt{nokeyprefix}
1296 % not used afterwards.
1297 % \begin{macrocode}
1298 \newif\ifRS@keyactive
1299 \@ifpackagewith{\@currname}{nokeyprefix}%
1300 {\RS@keyactivefalse}%
1301 {\RS@keyactivetrue}
1302 \DeclareOption{nokeyprefix}{\OptionNotUsed}
1303 % \end{macrocode}
1304 % \end{macro}
1305 %
1306 %
1307 % \begin{macro}{\ifRSstar}
1308 % \begin{macro}{\ifRSnameon}
1309 % \begin{macro}{\ifRScapname}
1310 % \begin{macro}{\ifRSplural}
1311 % \begin{macro}{\ifRSlsttwo}
1312 % \changes{v0.4}{2010/10/21}{Add \cmd{\ifRSlsttwo} test for list containing only two parameter}
1313 % The |\if| conditional values that are set by the reference commands.
1314 % These values can be accessed by user defined key-values.
1315 % \begin{macrocode}
1316 \newif\ifRSstar\RSstarfalse
1317 \newif\ifRSnameon\RSnameontrue
1318 \newif\ifRScapname\RScapnamefalse
1319 \newif\ifRSplural\RSpluralfalse
1320 \newif\ifRSlsttwo\RSlsttwofalse
1321 % \end{macrocode}
1322 % \end{macro}
1323 % \end{macro}
1324 % \end{macro}
1325 % \end{macro}
1326 % \end{macro}
1327 %
1328 %
1329 % \begin{macro}{\newref}
1330 % The main user interface for template setup. It take the |#1| or
1331 % \meta{key} parameter and make it lowercase before passing it on to
1332 % \cmd{\RS@newref}.
1333 %
1334 %
1335 % \begin{macrocode}
1336 \newcommand*{\newref}[1]{%
1337 \lowercase{\def\RS@tempa{#1}}%
1338 \expandafter\RS@newref\expandafter{\RS@tempa}}
1339 % \end{macrocode}
1340 % \end{macro}
1341 %
1342 % \begin{macro}{\RS@newref}
1343 % \changes{v0.4}{2010/10/21}{Ad \texttt{lsttwotxt} option}
1344 % This command configures a new template.
1345 % \begin{macrocode}
1346 \newcommand*{\RS@newref}[2]{%
1347 % \end{macrocode}
1348 % \bNP[2.0]\noindent Clears an existing template before defining a new one.\eNP
1349 % \begin{macrocode}
1350 \RS@clearref{#1}%
1351 % \end{macrocode}
1352 % \bNP[2.0]\noindent Create |\ifRS@|\meta{key}|vref| conditional \eNP
1353 % \begin{macrocode}
1354 % \expandafter\newif\csname ifRS@#1vref\endcsname%
1355 % \end{macrocode}
1356 % \bNP[2.0]\noindent Creates a series of key-values for every template
1357 % that stores the setup for the specific template.\eNP
1358 % \begin{macrocode}
1359 \ifRS@keyactive
1360 \define@key{RS@#1}{key}[#1:]{\RS@namedef{RS@#1@key}{##1}}%
1361 \else
1362 \define@key{RS@#1}{key}[]{\RS@namedef{RS@#1@key}{##1}}%
1363 \fi
1364 \define@key{RS@#1}{s}[true]{\RS@setbool{RSplural}{##1}}%
1365 \define@key{RS@#1}{name}[]{\RS@namedef{RS@#1@name}{##1}}%
1366 \define@key{RS@#1}{names}[]{\RS@namedef{RS@#1@names}{##1}}%
1367 \define@key{RS@#1}{Name}[]{\RS@namedef{RS@#1@Name}{##1}}%
1368 \define@key{RS@#1}{Names}[]{\RS@namedef{RS@#1@Names}{##1}}%
1369 \define@key{RS@#1}{rngtxt}[\space to~]{\RS@namedef{RS@#1@rngtxt}{##1}}%
1370 \define@key{RS@#1}{lsttwotxt}[\space and~]{\RS@namedef{RS@#1@lsttwotxt}{##1}}%
1371 \define@key{RS@#1}{lsttxt}[\space and~]{\RS@namedef{RS@#1@lsttxt}{##1}}%
1372 \define@key{RS@#1}{refcmd}[\ref{####1}]{\RS@namedef{RS@#1@rcmd}####1{##1}}%
1373 \define@key{RS@#1}{xr}[]{\RS@namedef{RS@#1@xr}{##1}}%
1374 \define@key{RS@#1}{vref}[true]{\RS@namedef{RS@#1vref}{##1}}%
1375 % \end{macrocode}
1376 % \bNP[2.0]\noindent Set default key-value parameters.\eNP
1377 % \begin{macrocode}
1378 \RS@setkeys{RS@#1}{key,
1379 s=false,
1380 name,names,Name,Names,
1381 rngtxt,lsttwotxt,lsttxt,
1382 refcmd,
1383 xr,
1384 vref=false}%
1385 % \end{macrocode}
1386 % \bNP[2.0]\noindent Set key-values according to user definitions.\eNP
1387 % \begin{macrocode}
1388 \RS@setkeys{RS@#1}{#2}%
1389 % \end{macrocode}
1390 % \bNP[2.0]\noindent Build the reference commands.\eNP
1391 % \begin{macrocode}
1392 \RS@buildref{#1}%
1393 }
1394 % \end{macrocode}
1395 % \end{macro}
1396 %
1397 % \begin{macro}{\RS@clearref}
1398 % Clear a reference template for redefinition. It check
1399 % if the template already exists and clear it if it does.
1400 %
1401 % \begin{macrocode}
1402 \newcommand*{\RS@clearref}[1]{%
1403 \RS@ifundefined{RS@#1@template}
1404 {\RS@namedef{RS@#1@template}{#1}%
1405 \PackageInfo{\RS@pkgname}%
1406 {New reference template \protect\newref{#1}}{}}
1407 {\PackageInfo{\RS@pkgname}%
1408 {Reference template \protect\newref{#1} redefined}{}
1409 \RS@firstcap#1\@nil
1410 \RS@removedef{#1key}%
1411 \RS@removedef{#1label}%
1412 \RS@removedef{#1ref}%
1413 \RS@removedef{\RS@cap ref}%
1414 \RS@removedef{#1rangeref}%
1415 \RS@removedef{\RS@cap rangeref}%
1416 \RS@removedef{#1pageref}%
1417 }%
1418 }
1419 % \end{macrocode}
1420 % \end{macro}
1421 %
1422 % \begin{macro}{\RS@buildref}
1423 % Build the reference commands. See \tabref{refopt} for the list of
1424 % commands. The \cmd{\RS@buildref}\marg{key} build commands to
1425 % call \cmd{\RS@cmd}\marg{cmd}\marg{key}, for example:
1426 % \begin{Ipara}
1427 % \cmeta{key}|ref| \quad$\rightarrow$\quad
1428 % |{\RScapnamefalse\RS@cmd{ref}|\marg{key}|}|
1429 % \end{Ipara}
1430 % \changes{v0.2}{2003/07/30}{Remove robust def of \argcmd{{\rtp}}{label}}
1431 % \begin{macrocode}
1432 \newcommand*{\RS@buildref}[1]{%
1433 \RS@firstcap#1\@nil
1434 \RS@testednamedef{#1key}{\RS@nameuse{RS@#1@key}}
1435 \RS@testednamedef{#1label}##1{\label{\RS@nameuse{RS@#1@key}##1}}
1436 \RS@testedrobustnamedef{#1ref}{\RScapnamefalse\RS@cmd{ref}{#1}}
1437 \RS@testedrobustnamedef{\RS@cap ref}{\RScapnametrue\RS@cmd{ref}{#1}}
1438 \RS@testedrobustnamedef{#1rangeref}{\RScapnamefalse\RS@cmd{rangeref}{#1}}
1439 \RS@testedrobustnamedef{\RS@cap rangeref}{\RScapnametrue\RS@cmd{rangeref}{#1}}
1440 \RS@testedrobustnamedef{#1pageref}{\RScapnamefalse\RS@cmd{pageref}{#1}}
1441 }
1442 % \end{macrocode}
1443 % \end{macro}
1444 %
1445 % \begin{macro}{\RS@cmd}
1446 % \begin{macro}{\RS@@cmd}
1447 % The command \cmd{\RS@cmd}\marg{cmd}\marg{key} calls the final
1448 % reference formatting commands.
1449 % It checks for the starred form and set the conditionals
1450 % |\ifRSstar| and |\ifRSnameon| accordingly.
1451 % It also extracts the optional key-value list.
1452 % \begin{Itabb}
1453 % \hspace*{4.5cm}\=\kill
1454 % \cmd{\RS@cmd}|{ref}|\marg{key} \>$\rightarrow$\quad
1455 % |\RS@ref|\marg{key}\okeylst\\
1456 % \cmd{\RS@cmd}|{rangeref}|\marg{key} \>$\rightarrow$\quad
1457 % |\RS@rangeref|\marg{key}\okeylst\\
1458 % \cmd{\RS@cmd}|{pageref}|\marg{key} \>$\rightarrow$\quad
1459 % |\RS@pageref|\marg{key}\okeylst
1460 % \end{Itabb}
1461 % \begin{macrocode}
1462 \newcommand*{\RS@cmd}[2]{%
1463 \@ifstar{\RSstartrue\RSnameonfalse\RS@@cmd{#1}{#2}}%
1464 {\RSstarfalse\RSnameontrue\RS@@cmd{#1}{#2}}}
1465 % \end{macrocode}
1466 % \begin{macrocode}
1467 \newcommand*{\RS@@cmd}[2]{%
1468 \@ifnextchar[%
1469 {\RS@nameuse{RS@#1}{#2}}%
1470 {\RS@nameuse{RS@#1}{#2}[]}}
1471 % \end{macrocode}
1472 % \end{macro}
1473 % \end{macro}
1474 %
1475 %
1476 % \subsection{Reference formatting commands}
1477 %
1478 % \begin{macro}{\RS@ref}
1479 % \changes{v0.5}{2010/11/02}{Add \cmd{\@safe@activestrue} to avoid active chars is ref list}
1480 % \begin{macro}{\RS@@ref}
1481 % \begin{macro}{\RS@@@ref}
1482 % \changes{v0.4}{2010/10/21}{Add \cmd{\ifRSlsttwo} test for list containing only two parameter}
1483 % The command \cmd{\RS@ref}\marg{key}\okeylst\marg{label\_lst}
1484 % typeset the references to the comma-separated reference
1485 % label list according to the configuration for \meta{key}.
1486 %
1487 % First of all, remove all spaces for the reference label list.
1488 % \begin{macrocode}
1489 \def\RS@ref#1[#2]#3{%
1490 \begingroup
1491 \RS@setkeys{RS@#1}{#2}%
1492 \@safe@activestrue%
1493 \edef\RS@tmpa{\zap@space#3 \@empty}%
1494 \@safe@activesfalse%
1495 \edef\RS@tmpa{\noexpand\RS@@ref{#1} \RS@tmpa,\relax\noexpand\@eolst}%
1496 \RS@tmpa%
1497 \endgroup}
1498 % \end{macrocode}
1499 % \end{macro}
1500 % Check if there is a single or multiple references in the
1501 % reference label list. If a single reference label then use the
1502 % form set by the \opt{s} key-value. If multiple reference labels
1503 % the use the plural form of the name prefix.\footnote{
1504 % The list of reference commands came from the \pkg{typedref} package.}
1505 %
1506 % \begin{macrocode}
1507 \def\RS@@ref#1 #2,#3\@eolst{%
1508 \ifx\relax#3\relax
1509 \RS@makename{#1}%
1510 \RS@makeref{#1}{#2}%
1511 \RS@makevpageref{#1}{#2}%
1512 \else
1513 \RSpluraltrue%
1514 \RS@makename{#1}%
1515 \RS@makeref{#1}{#2}%
1516 \RS@makevpageref{#1}{#2}%
1517 \RSnameonfalse%
1518 \RSlsttwotrue%
1519 \RS@@@ref{#1} #3\@eolst%
1520 \fi}
1521 % \end{macrocode}
1522 % \end{macro}
1523 % For more than one reference in the reference list, typeset the
1524 % rest of the references.
1525 % \begin{macrocode}
1526 \def\RS@@@ref#1 #2,#3\@eolst{%
1527 \ifx\relax#3\relax
1528 \ifRSlsttwo
1529 \RS@nameuse{RS@#1@lsttwotxt}%
1530 \else
1531 \RS@nameuse{RS@#1@lsttxt}%
1532 \fi
1533 \RS@makeref{#1}{#2}%
1534 \RS@makevpageref{#1}{#2}%
1535 \else
1536 \RSlsttwofalse%
1537 \unskip,\space%
1538 \RS@makeref{#1}{#2}%
1539 \RS@makevpageref{#1}{#2}%
1540 \RS@@@ref{#1} #3\@eolst%
1541 \fi}
1542 % \end{macrocode}
1543 % \end{macro}
1544 %
1545 % \begin{macro}{\RS@rangeref}
1546 % The command \cmd{\RS@rangeref}\marg{key}\okeylst\marg{lbl1}\marg{lbl2}
1547 % typeset the references as a range.
1548 % \begin{macrocode}
1549 \def\RS@rangeref#1[#2]#3#4{%
1550 \begingroup
1551 \RS@setkeys{RS@#1}{#2}%
1552 \RSpluraltrue%
1553 \RS@makename{#1}%
1554 \RS@makeref{#1}{#3}%
1555 \RS@nameuse{RS@#1@rngtxt}%
1556 \RSnameonfalse%
1557 \RS@makeref{#1}{#4}%
1558 \RS@makevpagerefrange{#1}{#3}{#4}%
1559 \endgroup}
1560 % \end{macrocode}
1561 % \end{macro}
1562 %
1563 % \begin{macro}{\RS@pageref}
1564 % The command \cmd{\RS@pageref}\marg{key}\okeylst\marg{lbl} type
1565 % the page where \marg{lbl} was defined.
1566 % \begin{macrocode}
1567 \def\RS@pageref#1[#2]#3{%
1568 \begingroup%
1569 \RS@setkeys{RS@#1}{#2}%
1570 \RS@ifvref{#1}%
1571 {\mbox{}\vpageref*{\RS@lbl{#1}{#3}}}%
1572 {\reftextfaraway{\RS@lbl{#1}{#3}}}%
1573 {\pageref{\RS@lbl{#1}{#3}}}%
1574 \endgroup}
1575 % \end{macrocode}
1576 % \end{macro}
1577 %
1578 % \changes{v0.2}{2003/07/30}{Remove redundant \cmd{\RS@label}}
1579 %
1580 % \begin{macrocode}
1581 \newcommand*{\RS@true}{true}
1582 \newcommand*{\RS@false}{false}
1583 \newcommand*{\RS@far}{far}
1584 % \end{macrocode}
1585 %
1586 % \begin{macro}{\RS@ifvref}
1587 % The command \cmd{\RS@ifvref}\marg{key}\marg{true}\marg{faraway}\marg{false}
1588 % executes the contents of \meta{true} if the \opt{vref} option for
1589 % the \meta{key} reference type is true and \meta{false} otherwise.
1590 % \begin{macrocode}
1591 \newcommand{\RS@ifvref}[4]{%
1592 \edef\RS@tempa{\RS@nameuse{RS@#1vref}}%
1593 \ifx\RS@tempa\RS@true\relax
1594 #2%
1595 \else\ifx\RS@tempa\RS@far\relax
1596 #3%
1597 \else\ifx\RS@tempa\RS@false\relax
1598 #4%
1599 \else
1600 \PackageError{\RS@pkgname}%
1601 {You can only set the vref option to `true', `far' or `false'}\@ehc
1602 \fi\fi\fi}
1603 % \end{macrocode}
1604 % \end{macro}
1605 %
1606 % \begin{macro}{\RS@makename}
1607 % The command \cmd{\RS@makename}\marg{key} build the prefix
1608 % to the reference commands.
1609 % \begin{macrocode}
1610 \newcommand{\RS@makename}[1]{%
1611 \ifRSstar\else\ifRSnameon
1612 \ifRSplural
1613 \ifRScapname
1614 \RS@nameuse{RS@#1@Names}%
1615 \else
1616 \RS@nameuse{RS@#1@names}%
1617 \fi
1618 \else
1619 \ifRScapname
1620 \RS@nameuse{RS@#1@Name}%
1621 \else
1622 \RS@nameuse{RS@#1@name}%
1623 \fi
1624 \fi
1625 \fi\fi
1626 }
1627 % \end{macrocode}
1628 % \end{macro}
1629 %
1630 % \begin{macro}{\RS@lbl}
1631 % This command builds the full label string for the \cmd{\ref}
1632 % command.
1633 % \begin{Ipara}
1634 % \cmd{\RS@lbl}\marg{key}\marg{label} \quad$\rightarrow$\quad
1635 % |{|\meta{xr_key}\meta{key}\meta{label}|}|
1636 % \end{Ipara}
1637 % \begin{macrocode}
1638 \newcommand*{\RS@lbl}[2]{%
1639 \RS@nameuse{RS@#1@xr}\RS@nameuse{RS@#1@key}#2%
1640 }
1641 % \end{macrocode}
1642 % \end{macro}
1643 %
1644 % \begin{macro}{\RS@makeref}
1645 % The command \cmd{\RS@makeref}\marg{key}\marg{label} formats
1646 % the \cmd{\ref} output
1647 % \begin{Ipara}
1648 % \cmd{\RS@makeref}\marg{key}\marg{label} \quad$\rightarrow$\quad
1649 % \cmeta{rcmd}|{\ref{|\meta{xr_key}\meta{key}\meta{label}|}}|
1650 % \end{Ipara}
1651 % \begin{macrocode}
1652 \newcommand{\RS@makeref}[2]{%
1653 \RS@nameuse{RS@#1@rcmd}{\RS@lbl{#1}{#2}}%
1654 }
1655 % \end{macrocode}
1656 % \end{macro}
1657 %
1658 % \begin{macro}{\RS@makevpageref}
1659 % The command \cmd{\RS@makevpageref}\marg{key}\marg{label} adds the
1660 % \pkg{varioref} page reference if the \opt{vref} option is true.
1661 % \begin{macrocode}
1662 \newcommand{\RS@makevpageref}[2]{%
1663 \RS@ifvref{#1}%
1664 {\vpageref[\unskip]{\RS@lbl{#1}{#2}}}%
1665 { \reftextfaraway{\RS@lbl{#1}{#2}}}%
1666 {}%
1667 }
1668 % \end{macrocode}
1669 % \end{macro}
1670 %
1671 % \begin{macro}{\RS@makevpagerefrange}
1672 % The command \cmd{\RS@makevpagerefrange}\marg{key}\marg{lbl1}\marg{lbl1}
1673 % adds the \pkg{varioref} page range reference if the \opt{vref}
1674 % option is true.
1675 % \begin{macrocode}
1676 \newcommand{\RS@makevpagerefrange}[3]{%
1677 \RS@ifvref{#1}%
1678 {\space\vpagerefrange[\unskip]{\RS@lbl{#1}{#2}}{\RS@lbl{#1}{#3}}}%
1679 {\space\vpagerefrange[\unskip]{\RS@lbl{#1}{#2}}{\RS@lbl{#1}{#3}}}%
1680 {}%
1681 }
1682 % \end{macrocode}
1683 % \end{macro}
1684 %
1685 %
1686 % \subsection{\pkg{varioref} command predefinitions}
1687 %
1688 % \begin{macrocode}
1689 \AtBeginDocument{%
1690 \providecommand{\vpageref}{%
1691 \PackageError{\RS@pkgname}%
1692 {The vref option used, but varioref.sty not loaded.}%
1693 {Load varioref.sty}}
1694 \providecommand{\reftextfaraway}{%
1695 \PackageError{\RS@pkgname}%
1696 {The vref=far option used, but varioref.sty not loaded.}%
1697 {Load varioref.sty}}
1698 \providecommand{\vpagerefrange}{%
1699 \PackageError{\RS@pkgname}%
1700 {The vref option used, but varioref.sty not loaded.}%
1701 {Load varioref.sty}}
1702 }
1703 % \end{macrocode}
1704 %
1705 %
1706 % \subsection{Support for language option inclusions in config file}
1707 %
1708 % \begin{macro}{\RSaddto}
1709 % \changes{v0.2}{2003/07/30}{Rename \cmd{\RS@addto} to \cmd{\RSaddto}}
1710 % Command from the \pkg{varioref} package is used to add
1711 % language definitions to the |\extras|\meta{language} token
1712 % for \pkg{babel}.
1713 % \begin{macrocode}
1714 \def\RSaddto#1#2{%
1715 #2%
1716 \@temptokena{#2}%
1717 \ifx#1\relax
1718 \let#1\@empty
1719 \fi
1720 \ifx#1\undefined
1721 \edef#1{\the\@temptokena}%
1722 \else
1723 \toks@\expandafter{#1}%
1724 \edef#1{\the\toks@\the\@temptokena}%
1725 \fi
1726 \@temptokena{}\toks@\@temptokena}
1727 % \end{macrocode}
1728 % \end{macro}
1729 %
1730 % \begin{macro}{\DeclareLangOpt}
1731 % \changes{v0.5}{2010/11/02}{Add \cmd{\extras}\meta{language} to beginning of document.}
1732 % Command to declare a language option and add
1733 % language definitions to the |\extras|\meta{language} token
1734 % for \pkg{babel}.
1735 % \begin{macrocode}
1736 \def\DeclareLangOpt#1#2{%
1737 \edef\RS@tempa{\expandafter\@gobble\string#2}%
1738 \RS@ifundefined{\RS@tempa}%
1739 {\PackageError{\RS@pkgname}{%
1740 Unknown definitions \@backslashchar\RS@tempa\MessageBreak
1741 for language option `#1'}{}}%
1742 {\DeclareOption{#1}{%
1743 \AtBeginDocument{\expandafter\RSaddto\csname extras#1\endcsname #2}}}%
1744 }
1745 % \end{macrocode}
1746 % \end{macro}
1747 %
1748 %
1749 %
1750 % \subsection{Configuration files}
1751 %
1752 % \begin{macro}{\RS@cfgfile,\RS@reffile}
1753 % \changes{v0.4}{2010/10/21}{Ad alternative definition file \cmd{refstyle.def}}
1754 % Define the config file and alternate definition file names.
1755 % \begin{macrocode}
1756 \newcommand*{\RS@cfgfile}{refstyle.cfg}
1757 \newcommand*{\RS@reffile}{refstyle.def}
1758 % \end{macrocode}
1759 % \end{macro}
1760 %
1761 % We need to peek into the options list before the
1762 % options are processed to find out if the config
1763 % file is to be loaded or not. The config file can
1764 % contain options and must be loaded before
1765 % \cmd{\ProcessOptions}. Make \opt{noconfig} not used
1766 % afterwards.
1767 %
1768 % We first test for a local config file \file{refstyle.def}
1769 % and then for the global config file \file{refstyle.cfg}.
1770 % \begin{macrocode}
1771 \@ifpackagewith{\@currname}{noconfig}%
1772 {\PackageInfo{\RS@pkgname}{No config file loaded}}%
1773 {\InputIfFileExists{\RS@reffile}%
1774 {\PackageInfo{\RS@pkgname}{Local config file \RS@reffile\space used}}
1775 {\InputIfFileExists{\RS@cfgfile}%
1776 {\PackageInfo{\RS@pkgname}{Config file \RS@cfgfile\space used}}%
1777 {\PackageInfo{\RS@pkgname}{No config file found}}}}
1778 % \end{macrocode}
1779 %
1780 % \begin{macrocode}
1781 \DeclareOption{noconfig}{\OptionNotUsed}%
1782 % \end{macrocode}
1783 %
1784 % Process the options, including options in config file.
1785 % \begin{macrocode}
1786 \ProcessOptions*\relax
1787 % \end{macrocode}
1788 %
1789 % The end of this package.
1790 % \begin{macrocode}
1791 %</pkg>
1792 % \end{macrocode}
1793 %
1794 % \Finale
1795 \endinput