summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/refstyle/refstyle.dtx
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/refstyle/refstyle.dtx
Initial commit
Diffstat (limited to 'macros/latex/contrib/refstyle/refstyle.dtx')
-rw-r--r--macros/latex/contrib/refstyle/refstyle.dtx1796
1 files changed, 1796 insertions, 0 deletions
diff --git a/macros/latex/contrib/refstyle/refstyle.dtx b/macros/latex/contrib/refstyle/refstyle.dtx
new file mode 100644
index 0000000000..c2c3acab8e
--- /dev/null
+++ b/macros/latex/contrib/refstyle/refstyle.dtx
@@ -0,0 +1,1796 @@
+% \iffalse
+%
+% refstyle.dtx
+% Copyright (C) 2002--2010 Danie Els
+%
+% -------------------------------------------------------------------
+% The refstyle package
+% for the formatting of references
+% -------------------------------------------------------------------
+% This work may be distributed and/or modified under the conditions
+% of the LaTeX Project Public License, either version 1.3c 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.3c or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work is "maintained" (as per LPPL maintenance status)
+% by Danie Els (dnjels@sun.ac.za).
+%
+% This package consists of the files: refstyle.dtx
+% refconfig.dtx
+% refstyle.ins
+% and the derived files: refstyle.sty
+% refstyle.cfg
+% -------------------------------------------------------------------
+%
+%<*pkg>
+\newcommand*{\RefstyleFileDate}{2010/11/02}
+\newcommand*{\RefstyleFileVersion}{v0.5}
+%</pkg>
+%
+%
+%<*driver>
+\documentclass[a4paper]{ltxdoc}
+\let\RefstyleFileDate\relax
+\let\RefstyleFileVersion\relax
+\usepackage{amsmath}
+\usepackage{amsfonts}
+ \DeclareMathSymbol{\square} {\mathord}{AMSa}{"03}
+ \DeclareMathSymbol{\blacksquare}{\mathord}{AMSa}{"04}
+\usepackage{calc}
+\usepackage{rotating}
+\usepackage[rounded]{syntax}
+\usepackage{varioref}
+\usepackage{refstyle}
+\usepackage{color}
+ \definecolor{hrefcol}{rgb}{0.00,0.00,1.00}
+\usepackage[pdfpagelabels]{hyperref}
+\hypersetup{breaklinks=true,
+ linktocpage,
+ pdfstartview=FitH,
+ colorlinks = true,
+ linkcolor = hrefcol,
+ urlcolor = hrefcol,
+ menucolor = hrefcol,
+ filecolor = hrefcol,
+ citecolor = hrefcol,
+ linkbordercolor = {0.8 0.8 0.8},
+ urlbordercolor = {0.8 0.8 0.8},
+ menubordercolor = {0.8 0.8 0.8},
+ filebordercolor = {0.8 0.8 0.8},
+ runbordercolor = {0.8 0.8 0.8},
+ citebordercolor = {0.8 0.8 0.8},
+ pdftitle={refstyle},
+ pdfauthor={Danie Els}}
+
+%---- macrocode env changes -------------------------------
+
+\setlength{\MacroIndent}{1.5em}
+
+%---- Scratches -------------------------------------------
+
+\newlength{\tdima}
+\newsavebox{\tboxa}
+
+%---- Spacing ---------------------------------------------
+
+\newlength{\myskip}
+\setlength{\myskip}{\topsep}
+ \addtolength{\myskip}{\parskip}
+ \addtolength{\myskip}{\partopsep}
+\newcommand*{\blankline}{\par\addvspace{\myskip}}
+\newlength{\mytab}
+\setlength{\mytab}{2\parindent}
+\newcommand{\tab}{\hspace*{\mytab}}
+
+%---- Indented environments -------------------------------
+
+\newenvironment{IndentPara}[1][1]
+ {\list{}{\setlength{\leftmargin}{#1\mytab}%
+ \setlength{\labelwidth}{0pt}%
+ \setlength{\labelsep}{0pt}%
+ \setlength{\itemindent}{\parindent}%
+ \setlength{\listparindent}{\parindent}%
+ }\item[]}%
+ {\endlist}
+\newenvironment{IndentParaX}[1][1]
+ {\list{}{\setlength{\leftmargin}{#1\mytab}%
+ \setlength{\topsep}{0pt}%
+ \setlength{\partopsep}{0pt}%
+ \setlength{\labelwidth}{0pt}%
+ \setlength{\labelsep}{0pt}%
+ \setlength{\itemindent}{\parindent}%
+ \setlength{\listparindent}{\parindent}%
+ }\item[]}%
+ {\endlist}
+\newcommand\bNP{\begin{IndentParaX}}
+\newcommand\eNP{\end{IndentParaX}}
+\newenvironment{Ipara}[1][\small]%
+ {\begin{IndentPara}\noindent#1\ignorespaces}%
+ {\end{IndentPara}}
+\newenvironment{Itabb}[1][\small]%
+ {\begin{IndentPara}#1\ignorespaces\begin{tabbing}\ignorespaces}%
+ {\end{tabbing}\end{IndentPara}}
+
+%---- Ruled & colored minipage ----------------------------
+
+\definecolor{shadecolor}{gray}{0.9}
+
+\newenvironment{fminipage}[1][\linewidth]
+ {\setlength{\tdima}{#1-2\fboxsep-2\fboxrule}%
+ \begin{lrbox}{\tboxa}\begin{minipage}{\tdima}}%
+ {\end{minipage}\end{lrbox}\noindent\fbox{\usebox{\tboxa}}}
+\newenvironment{cminipage}[1][\linewidth]
+ {\setlength{\tdima}{#1-2\fboxsep-2\fboxrule}%
+ \begin{lrbox}{\tboxa}\begin{minipage}{\tdima}}%
+ {\end{minipage}\end{lrbox}%
+ \noindent\colorbox{shadecolor}{\usebox{\tboxa}}}
+
+%---- Additional documenting commands ---------------------
+
+\def\lcbrack{\symbol{`\{}}
+\def\rcbrack{\symbol{`\}}}
+\makeatletter
+\def\meta@font@select{\normalfont\slshape}
+\makeatother
+\DeclareRobustCommand{\cmeta}[1]{%<- \<xxx>
+ \texttt{\bslash}\meta{#1}}
+\DeclareRobustCommand{\cmarg}[1]{%<- {\<xxx>}
+ \texttt{\lcbrack}\cmeta{#1}\texttt{\rcbrack}}
+\DeclareRobustCommand{\coarg}[1]{%<- [\<xxx>]
+ \texttt{[}\cmeta{#1}\texttt{]}}
+\DeclareRobustCommand{\argcmd}[2]{%<- \<xxx>yyy
+ \cmeta{#1}\texttt{#2}}
+\newcommand{\rmeta}[3][]{%
+ \texttt{\lcbrack#1}\meta{#2}\texttt{#3\rcbrack}}
+\newcommand{\refmeta}[3][]{\cmd{\brref}\rmeta[#1]{#2}{#3}}
+
+\newcommand*{\file}[1]{\texttt{#1}}
+\newcommand*{\pkg}[1]{\textsf{#1}}
+\newcommand*{\env}[1]{\texttt{#1}}
+\newcommand*{\opt}[1]{\texorpdfstring{\normalfont\texttt{\slshape#1}}{#1}}
+\newcommand*{\RS}{\pkg{refstyle}}
+\newcommand*{\RScfg}{\file{refstyle.cfg}}
+\newcommand*{\rtp}{type}
+\newcommand*{\Rtp}{Type}
+\newcommand*{\okeylst}{\oarg{key\_lst}}
+\newcommand*{\mkeylst}{\marg{key\_lst}}
+
+%---- Special eq tag command ------------------------------
+
+\def\spestag#1{\stepcounter{equation}%
+ \gdef\tagextra##1{%
+ \makebox[0pt][l]{\small\quad%
+ \cmd{\eqlabel}\texttt{\lcbrack##1\rcbrack}}%
+ \gdef\tagextra####1{}}%
+ \tag{\theequation\tagextra{#1}}\eqlabel{#1}}
+
+%---- other stuff -----------------------------------------
+
+\newcommand*{\ArTab}{\>\quad$\rightarrow$\quad}
+
+%----------------------------------------------------------
+
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\setlength\hfuzz{15pt}
+\hbadness=7000
+\begin{document}
+ \DocInput{refstyle.dtx}
+\end{document}
+
+%</driver>
+% \fi
+%
+% \CheckSum{552}
+%
+% \CharacterTable
+% {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
+% 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
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+% \changes{v0.0}{2002/12/01}{Initial version}
+% \changes{v0.1}{2003/04/01}{First stable version}
+% \changes{v0.2}{2003/07/30}{First updated version}
+% \changes{v0.3}{2006/09/09}{Documentation update}
+% \changes{v0.4}{2010/10/21}{Documentation update}
+% \changes{v0.4}{2010/10/21}{Add \texttt{nokeyprefix} option}
+% \changes{v0.5}{2010/11/02}{Documentation update}
+%
+% \DoNotIndex{
+% \@backslashchar, \@carcube, \@ehc, \@empty, \@firstoftwo,
+% \@ifnextchar, \@ifpackageloaded, \@ifstar, \@ifundefined, \@nil,
+% \@qend, \@qrelax, \@secondoftwo, \@tempa, \@undefined,
+% \AtEndOfPackage, \begingroup, \csname, \CurrentOption,
+% \DeclareOption, \def, \edef, \else, \endcsname, \endgroup,
+% \expandafter, \fi, \gdef, \iffalse, \ifx, \InputIfFileExists,
+% \let, \long, \lowercase, \MakeLowercase, \mbox, \MessageBreak,
+% \NeedsTeXFormat, \newcommand, \newif, \noexpand, \PackageError, \PackageInfo,
+% \PassOptionsToPackage, \RS@pkgname, \ProcessOptions, \protect,
+% \providecommand, \ProvidesPackage, \relax, \renewcommand,
+% \RequirePackage, \reserved@a, \reserved@b, \RS@tmpa,
+% \RS@tmpb, \S, \RS@setkeys, \space, \string, \textsc, \textup,
+% \unrestored@protected@xdef, \unskip, \uppercase,
+% \zap@space}
+%
+%^^A==== Titling ==========================================
+% \GetFileInfo{refstyle.sty}
+% \title{\vspace*{-1cm}
+% The \RS\ package\thanks{This file has version number
+% \fileversion, last revised
+% \filedate.}}
+% \author{Danie Els\\[1ex]
+% \small Department of Mechanical and Mechatronics Engineering\\
+% \small University of Stellenbosch, South Africa.\\
+% \normalsize e-mail: \texttt{\href{mailto:dnjels@sun.ac.za}%
+% {dnjels@sun.ac.za}}}
+% \date{\filedate}
+% \maketitle
+% \begin{center}
+% \textbf{Overview of the \RS\ package}
+% \end{center}
+% \noindent
+% When writing complex documents, often a large number of commands
+% for different type of references are defined, for example:
+% \begin{Ipara}
+% |\newcommand*{\eqref}[1]{eqn~(\ref{#1})}|\\
+% |\newcommand*{\Eqref}[1]{Equation~(\ref{#1})}|
+% \end{Ipara}
+% The \RS\ package was developed to automate this process. The
+% package provides a user interface to define sets of reference
+% and label commands for each referable object such as an equation
+% or a table, etc. When you declare, for example, a set of
+% reference commands to an equation:
+% \begin{Ipara}
+% \cmd{\newref}|{eq}|\mkeylst\
+% \end{Ipara}
+% \noindent
+% a series of commands of the format \cmd{\eq...} and \cmd{\Eq...}
+% are produced. The configuration options are set with a list of
+% key-values. Prefixes, inserts and other options for all the
+% different perturbations such as capitalized first letters,
+% singular and plural from, etc.\ can be defined. The
+% configuration can be changed temporarily with an optional list
+% of key-values when the commands are used. A direct interface to
+% the \pkg{varioref} package is also provided.
+% This enables compact reference formats:
+% \begin{Itabb}
+% \hspace{14em}\=\kill
+% |\eqref{e1} ...| \ArTab\eqref{e1} ...\\
+% |\Eqref[vref]{e1} ...| \ArTab\Eqref[vref]{e1} ...\\
+% |\eqref[s]{e1} and ...| \ArTab\eqref[s]{e1} and ...\\
+% |\eqref[name=eq.~]{e1} ...| \ArTab\eqref[name=eq.~]{e1} ...
+% \end{Itabb}
+% A range or a list of references can also be referred to in a
+% consistent way.
+% \begin{Itabb}
+% \hspace{14em}\=\kill
+% |\eqref{e1,e2,e3} ...| \ArTab\eqref{e1,e2,e3} ...\\
+% |\eqrangeref[vref]{e1}{e3} ...| \ArTab\eqrangeref[vref]{e1}{e3} ...
+% \end{Itabb}
+%
+% Templates for the different reference types and different
+% languages can be loaded with a configuring file.
+%
+% The package is aimed at large projects, enabling a consistent
+% way of producing references throughout a project. Enough
+% flexibility is provided to make local changes to a single
+% reference. For large projects such as a series of books or a
+% multi volume thesis, written as freestanding documents, a
+% facility is provided to interface to the \pkg{xr} package for
+% external document references.
+%
+% \medskip
+%
+% \begin{center}
+% \begin{fminipage}[.6\textwidth]
+% See also \pkg{refconfig.pdf} for setup and examples.
+% \end{fminipage}
+% \end{center}
+
+% \clearpage
+%
+% \tableofcontents
+% \clearpage
+%
+%
+% \section{Loading the \RS\ Package}
+%
+% \subsection{Document preamble}
+%
+% The \RS\ package is loaded in the preamble of the document:
+% \begin{enumerate}
+% \item[(a)] With a config file with \pkg{babel} language support
+% \begin{Ipara}
+% |\usepackage{varioref}[2001/09/04]%|~
+% ${\leftarrow}$ To use the \opt{vref} option\\
+% |\usepackage{refstyle}|
+% \end{Ipara}
+% When the package is loaded, it first searchers for a local user defined
+% configuration file \file{refstyle.def}. If it is not available it
+% looks for the global default config file \RScfg\ provided with this package.
+% These configuration files are loaded before the package options are precess.
+% It can therefore contain option commands using globally defined language
+% options and can interface to \pkg{babel} for language changes. The macro
+% \begin{Ipara}
+% |\DeclareLangOpt{|\meta{language}|}{|\meta{definitions}|}|
+% \end{Ipara}
+% is provided to declare the package option \meta{language} and add
+% \meta{definitions} to the |\extras|\meta{language} token for \pkg{babel}.
+% It can only be used inside \RScfg\ or \file{refstyle.def}.
+%
+% \item[(b)]
+% Or with an existing configuration with language support and addition
+% of your own extensions
+% \begin{Ipara}
+% |\documentclass[norwegian]{article}|\\
+% |\usepackage{babel} |\\
+% |\usepackage{refstyle} |\\
+% |\RSaddto{\RSnorwegian}{% |\\
+% | \def\RSthmtxt{teorem~}% |\\
+% | \def\RSthmstxt{teorem~}% |\\
+% | \def\RSThmtxt{Teorem~}% |\\
+% | \def\RSThmstxt{Teorem~}} |\\
+% |\newref{thm}{ |\\
+% | name = \RSthmtxt, |\\
+% | names = \RSthmstxt, |\\
+% | Name = \RSThmtxt, |\\
+% | Names = \RSThmstxt, |\\
+% | rngtxt = \RSrngtxt, |\\
+% | lsttxt = \RSlsttxt, |\\
+% | lsttwotxt = \RSlsttwotxt} |
+% \end{Ipara}
+%
+% \item[(c)]
+% Or without any configuration file, but by declaring your own
+% reference commands in the preamble.
+% \begin{Itabb}
+% \cmd{\usepackage}|[noconfig]{refstyle}|\\
+% \qquad\cmd{\newref}\marg{reftype$_{\,1}$}\mkeylst \\
+% \qquad\cmd{\newref}\marg{reftype$_{\,2}$}\mkeylst\\
+% \tab$\vdots$
+% \end{Itabb}
+%
+% \item[(d)]
+% Or with your own configuration file (without babel language support) for a specific project:
+% \begin{Itabb}
+% |\usepackage[noconfig]{refstyle}|\\
+% |\input{thisproject.ref}|
+% \end{Itabb}
+%
+% \end{enumerate}
+%
+% \subsection{Package options}
+%
+% \begin{description}
+% \item[\opt{noconfig}] Neither of the user supplied \file{refstyle.def} config
+% file or \file{refstyle.cfg} the config file supplied with this package
+% are loaded. The user must declare his or her own definitions and templates.
+% Note that these definitions are not passed on to \pkg{babel}'s language
+% changing mechanisms.
+%
+% \item[\opt{nokeyprefix}] Custom labeling commands \argcmd{\rtp}{label} are generated
+% by \pkg{refstyle} for every \meta{type} definition. It defaults to
+% \begin{Itabb}
+% \hspace{5em}\=hspace{5em}\=\kill
+% \argcmd{\rtp}{label}|{abc}|
+% \>\>~ $\rightarrow$ \cmd{\label}\rmeta{type\,:\,}{abc}
+% \end{Itabb}
+% With the \opt{nokeyprefix} option, the prefix is turned of and the
+% labeling commands defaults to
+% \begin{Itabb}
+% \hspace{5em}\=hspace{5em}\=\kill
+% \argcmd{\rtp}{label}|{abc}|
+% \>\>~ $\rightarrow$ \cmd{\label}|{abc}|
+% \end{Itabb}
+% This is useful for old documents with existing labeling commands or
+% where the user prefer not to use the \argcmd{\rtp}{label} commands.
+%
+%
+% \end{description}
+%
+%
+%
+%
+% \subsection{Companion packages}
+%
+% The \RS\ packages is intended for large projects. It is therefore
+% important that it works together with, or has direct interfaces
+% to the following packages:
+% \begin{description}
+% \item[\pkg{varioref}:\footnotemark]
+% \footnotetext{\pkg{varioref} v1.3c, 2001/09/04 or later,
+% because the starred versions of the commands
+% are used.}
+% Produce sophisticated page and page range references.
+%
+% \item[\pkg{hyperref}:\footnotemark]
+% \footnotetext{\pkg{hyperref} v6.72r, 2002/05/27 or later,
+% where a bug for interference with
+% \pkg{varioref} was fixed.}
+% To establish hyper links between the references and the
+% labels.
+%
+% \item[\pkg{xr, xr-hyper}:]
+% To establish references to external documents.
+%
+% \item[\pkg{showkeys}:]
+% To show all the labels and references. This is very useful
+% to find labels in large documents.
+% \end{description}
+%
+% \clearpage
+% \section{User Interface}
+%
+% The \RS\ package has one configuring command, \DescribeMacro{\newref}
+% \cmd{\newref}, that internally creates a series of label and
+% reference commands:
+% \blankline
+%
+% \begin{cminipage}[\linewidth]
+% \newcommand*{\crsi}{\smash{\rule[0pt]{.4pt}{1.25em}\rule[.5ex]{1.5em}{.4pt}}}^^A
+% \newcommand*{\crsl}{\smash{\rule[.5ex]{.4pt}{1.5em}\rule[.5ex]{1.5em}{.4pt}}}^^A
+% \begin{Itabb}
+% \hspace*{2em}\=\hspace{2em}\=\hspace{10em}\=\kill
+% \cmd{\newref}\marg{\rtp}\mkeylst\tab\mbox{}\\[.75ex]
+% \>\crsi \>\argcmd{{\rtp}}{key} \> Reference argument prefix \\[.75ex]
+% \>\crsl \>\argcmd{{\rtp}}{label} \> Custom label \\[.75ex]
+% \>\crsl \>\argcmd{{\rtp}}{ref} \> In text reference \\[.75ex]
+% \>\crsl \>\argcmd{{\Rtp}}{ref} \> Start of sentence reference \\[.75ex]
+% \>\crsl \>\argcmd{{\rtp}}{rangeref} \> In text range reference \\[.75ex]
+% \>\crsl \>\argcmd{{\Rtp}}{rangeref} \> Start of sentence range reference\quad\mbox{}\\[.75ex]
+% \>\crsl \>\argcmd{{\rtp}}{pageref} \> Page reference
+% \end{Itabb}
+% \end{cminipage}
+% \blankline
+%
+% \noindent
+% All the \cmeta{\rtp}... commands, excluding \argcmd{{\rtp}}{key}
+% and \argcmd{{\rtp}}{label} are robust.
+% All the options for the referencing commands are set with a
+% key-value list. \Tabref[vref=far]{refopt} gives a full list of all the
+% key-values and defaults.
+%
+% The \RS\ package do not redefine any internal \LaTeX\ commands and
+% depends only on the \cmd{\label}, \cmd{\ref}, \cmd{\pageref} and
+% the \pkg{varioref} commands.
+% The internally defined commands do not overwrite any
+% existing command with the same name, and an error results if a command
+% already exists. The exception is commands declared with a previous
+% \cmd{\newref} call, can be redefined by calling \cmd{\newref} again
+% with a new set of parameter.
+% If the \pkg{amsmath} package is loaded, and you define
+% \cmd{\newref}|{eq}| for references to equations, you need to
+% undefine \cmd{\eqref} before issuing \cmd{\newref} by
+% \begin{Ipara}
+% \cmd{\let}\cmd{\eqref}|=|\cmd{\relax}
+% \end{Ipara}
+%
+%
+% \section{Command Descriptions}
+%
+% The structure of the label and reference commands is given by the
+% syntax diagrams that follows. Examples are included for references
+% to equations, defined according to the template in
+% \RScfg\ with the
+% \cmd{\newref}|{eq}|\mkeylst. See also \secref{keyvals} for
+% explanations of the key-values.
+%
+% \subsection{The reference key}
+%
+% \begin{cminipage}[\linewidth]
+% \begin{syntdiag}
+% \tok{\argcmd{\rtp}{key}}
+% \end{syntdiag}
+% \end{cminipage}
+% \blankline
+% \noindent
+% The \argcmd{\rtp}{key} command returns the prefix added to the
+% argument of the label and the reference commands, for example:
+%
+% \begin{Itabb}
+% \hspace{10em}\=hspace{5em}\=\kill
+% \cmd{\newref}\marg{\rtp}|{}|
+% \>\>\argcmd{\rtp}{key} $\rightarrow$ \meta{type\,:\,}\\
+% \cmd{\newref}\marg{\rtp}|{key=xxx-}|
+% \>\>\argcmd{\rtp}{key} $\rightarrow$ |xxx-|
+% \end{Itabb}
+%
+% \noindent
+% The \argcmd{\rtp}{key} command is not a general command, but was
+% provided only as a link to the standard \LaTeX{} \cmd{\ref} and
+% \cmd{\pageref} commands:
+%
+% \begin{Itabb}
+% \hspace{10em}\=hspace{5em}\=\kill
+% \cmd{\label}|{|\argcmd{\rtp}{key}| abc}|
+% \>\>~ $\rightarrow$ \cmd{\label}\rmeta{type\,:\,}{abc}\\
+% \cmd{\ref}|{|\argcmd{\rtp}{key}| abc}|
+% \>\>~ $\rightarrow$ \cmd{\ref}\rmeta{type\,:\,}{abc}
+% \end{Itabb}
+% Note if the the \opt{nokeyprefix} option is active then the \argcmd{\rtp}{key}
+% is empty.
+%
+% \blankline
+% \noindent
+% \textbf{\slshape Examples:} equations
+% with \cmd{\newref}|{eq}|\mkeylst:
+%
+% \begin{Itabb}
+% \hspace*{18em}\=\kill
+% |\eqkey| \> \eqkey \\
+% |in eq.~\ref{\eqkey e1} ...| \>in eq.~\ref{\eqkey e1} ... \\
+% |on page \pageref{\eqkey e1} ...|\>on page \pageref{\eqkey e1} ... \\
+% |\vpageref*{\eqkey e1} ... | \>\vpageref*{\eqkey e1} ...
+% \end{Itabb}
+%
+% \subsection{Reference label}
+%
+% \begin{cminipage}[\linewidth]
+% \begin{syntdiag}
+% \tok{\argcmd{\rtp}{label}"{"<lbl>"}"}
+% \end{syntdiag}
+% \end{cminipage}
+% \blankline
+%
+% \noindent
+% The command \argcmd{\rtp}{label} prefix the reference
+% string in the \cmd{\label} with the string \meta{type\,:\,}, or its
+% redefinition with the \opt{key} option.
+%
+% \begin{Itabb}
+% \hspace{10em}\=hspace{5em}\=\kill
+% \argcmd{\rtp}{label}|{abc}|
+% \>\>~ $\rightarrow$ \cmd{\label}\rmeta{type\,:\,}{abc}
+% \end{Itabb}
+% \blankline
+%
+% \noindent
+% \textbf{\slshape Examples:}
+%
+% \begingroup
+% \begin{Ipara}
+% Let $z = x+\mathrm{i} y$ and $\alpha = \beta + \mathrm{i}
+% \gamma$, with $\mathrm{i}^2 = -1$, then
+% \begin{align}
+% &\mathrm{e}^z = \mathrm{e}^x \left(\cos y + \mathrm{i} \sin y \right)
+% \spestag{e1}\\
+% &z^\alpha = \mathrm{e}^{\alpha \ln z}
+% \spestag{e2}\\
+% \intertext{\Eqref{e1,e2} lead to the following interesting results:}
+% &\mathrm{e}^{\mathrm{i} \pi} + 1 = 0 \spestag{e3}\\
+% &\mathrm{i}^\mathrm{i} = \mathrm{e}^{-\pi/2}\spestag{e4}
+% \end{align}
+% \end{Ipara}
+% \endgroup
+%
+%
+% \subsection{Reference commands}
+%
+% \begin{cminipage}[1.05\textwidth]
+% \begin{syntdiag}
+% \tok{\argcmd{\rtp}{ref}}
+% \begin{stack}\\ \tok{$\ast$} \end{stack}
+% \begin{stack}\\ \tok{\okeylst} \end{stack}
+% "{"
+% \begin{rep} \tok{<lbl>} \\ ~,~ \end{rep}
+% "}"
+% \end{syntdiag}
+% \end{cminipage}
+% \smallskip
+%
+% \begin{cminipage}[1.05\textwidth]
+% \begin{syntdiag}
+% \tok{\argcmd{\Rtp}{ref}}
+% \begin{stack}\\ \tok{$\ast$} \end{stack}
+% \begin{stack}\\ \tok{\okeylst} \end{stack}
+% \tok{"{"}
+% \begin{rep} \tok{<lbl>} \\ ~,~ \end{rep}
+% \tok{"}"}
+% \end{syntdiag}
+% \end{cminipage}
+% \blankline
+% \noindent
+% The |*| optional form of the \argcmd{\rtp}{ref} and
+% \argcmd{\Rtp}{ref} commands eliminates the
+% name prefix. The |[s]| optional key-value argument is for the
+% plural form of the name prefix.
+% \blankline
+%
+% \noindent
+% \textbf{\slshape Examples:}
+% \begin{Itabb}
+% \hspace*{21em}\=\kill
+% |in \eqref{e1} ...| \>in \eqref{e1} ... \\
+% |in \eqref[s]{e1}--\eqref*{e4} ...|\>in \eqref[s]{e1}--\eqref*{e4} ...\\
+% |in \eqref[name=eq.~]{e2} ...| \>in \eqref[name=eq.~]{e2} ...
+% \end{Itabb}
+% \pagebreak[1]
+% \noindent
+% A list of references can be used:
+% \begin{Itabb}
+% \hspace*{21em}\=\kill
+% |in \eqref{e1,e2} ...| \>in \eqref{e1,e2} ... \\
+% |in \eqref{e1,e2,e3} ...| \>in \eqref{e1,e2,e3} ... \\
+% |in \eqref[lsttxt={, and~}]{e1,e2,e3} ...| \>in \eqref[lsttxt={, and~}]{e1,e2,e3} ...
+% \end{Itabb}
+% \pagebreak[2]
+% The reference to the page can be included with the \opt{vref} or \opt{vref=far}
+% options that activates the \pkg{varioref} reference.
+% \begin{Itabb}
+% \hspace*{18em}\=\kill
+% |in \eqref[vref]{e1} ...| \>in \eqref[vref]{e1} ...\\
+% |in \eqref[vref=far]{e1} ...| \>in \eqref[vref=far]{e1} ...
+% \end{Itabb}
+% The \argcmd{\Rtp}{ref} command is identical to the
+% \argcmd{\rtp}{ref} command except that it uses the \opt{Name} and
+% \opt{Names} key-value options.
+% \begin{Itabb}
+% \hspace*{18em}\=\kill
+% |\Eqref{e1} is ...| \>\Eqref{e1} is ... \\
+% |\Eqref{e1,e2} are ...| \>\Eqref{e1,e2} are ... \\
+% |\Eqref[lsttxt={\ or~}]{e1,e2,e3}| \>\Eqref[lsttxt={\ or~}]{e1,e2,e3}
+% \end{Itabb}
+% \noindent
+% References to external documents can be added with the \opt{xr}
+% option. Please read the documentation of the \pkg{xr} package.
+%
+% \begin{Itabb}
+% \hspace{10em}\=hspace{5em}\=\kill
+% \cmd{\eqref}|[|\opt{xr}|=A-]{xyz}| \> \>$\rightarrow$~
+% |equation~\ref{A-eq:xyz}|
+% \end{Itabb}
+%
+%
+% \subsection{Range reference commands}
+%
+% \begin{cminipage}[\linewidth]
+% \begin{syntdiag}
+% \tok{\argcmd{\rtp}{rangeref}}
+% \begin{stack}\\ \tok{$\ast$} \end{stack}
+% \begin{stack}\\ \tok{\okeylst} \end{stack}
+% \tok{"{"<lbl>$_1$"}{"<lbl>$_2$"}"}
+% \end{syntdiag}
+% \end{cminipage}
+% \smallskip
+%
+% \begin{cminipage}[\linewidth]
+% \begin{syntdiag}
+% \tok{\argcmd{\Rtp}{rangeref}}
+% \begin{stack}\\ \tok{$\ast$} \end{stack}
+% \begin{stack}\\ \tok{\okeylst} \end{stack}
+% \tok{"{"<lbl>$_1$"}{"<lbl>$_2$"}"}
+% \end{syntdiag}
+% \end{cminipage}
+% \blankline
+%
+% \noindent
+% The \argcmd{\rtp}{rangeref} and \argcmd{\Rtp}{rangeref} commands
+% return a range of references and take two arguments. The |*|
+% optional form again eliminates the name prefix.
+% \blankline
+%
+% \noindent
+% \textbf{\slshape Examples:}
+% \begin{Itabb}
+% \hspace*{19em}\=\kill
+% |in \eqrangeref{e1}{e4} ...| \>in \eqrangeref{e1}{e4} ... \\
+% |... and \eqrangeref*{e1}{e4} ...| \>... and \eqrangeref*{e1}{e4} ... \\
+% |\Eqrangeref{e1}{e4} are ...| \>\Eqrangeref{e1}{e4} are ... \\
+% |\Eqrangeref[vref,rngtxt=--]{e1}{e4}| \>\Eqrangeref[rngtxt=--,vref]{e1}{e4}
+% \end{Itabb}
+%
+%
+% \subsection{Page reference command}\seclabel{PRefCmds}
+%
+% \begin{cminipage}
+% \begin{syntdiag}
+% \tok{\argcmd{\rtp}{pageref}}
+% \begin{stack}\\ \tok{\okeylst} \end{stack}
+% \tok{"{"<lbl>"}"}
+% \end{syntdiag}
+% \end{cminipage}
+% \blankline
+% \noindent
+% The \argcmd{\rtp}{pageref} commands returns the page number of a
+% reference.
+% \blankline
+%
+% \noindent
+% \textbf{\slshape Examples:}
+% \begin{Itabb}
+% \hspace*{18em}\=\kill
+% |it is on page \eqpageref{e1} ...| \>it is on page \eqpageref{e1} ...\\
+% |it is \eqpageref[vref]{e1} ...| \>it is \eqpageref[vref]{e1} ...
+% \end{Itabb}
+%
+%
+%^^A=================================================================
+% \begin{table}
+% \newcommand*{\Q}{\ensuremath{\blacksquare}}^^A
+% \newcommand*{\X}{\ensuremath{\square}}^^A
+% \setlength{\fboxsep}{1em}^^A
+% \centering
+% \caption[The available options and key-value parameters]^^A
+% {The available options and key-value parameters for
+% the label and reference commands of the \RS\ package.}
+% \tablabel{refopt}
+% \blankline
+% \begin{cminipage}[.9\textwidth]
+% \renewcommand{\thempfootnote}{\fnsymbol{mpfootnote}}
+% \renewcommand{\footnoterule}{}
+% \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}llccccccc@{}}
+% & & \multicolumn{7}{c}{Commands\footnote{^^A
+% The commands are obtained by calling the configuring command
+% \cmd{\newref} and setting the default key-values. The
+% active key-values can be changed temporarily inside the
+% commands.}} \\
+% \cline{3-9}
+% Parameter & Default &
+% \begin{turn}{90}\argcmd{{\rtp}}{key}~ \end{turn}&
+% \begin{turn}{90}\argcmd{{\rtp}}{label}~ \end{turn}&
+% \begin{turn}{90}\argcmd{{\rtp}}{ref}~ \end{turn}&
+% \begin{turn}{90}\argcmd{{\Rtp}}{ref}~ \end{turn}&
+% \begin{turn}{90}\argcmd{{\rtp}}{rangeref}~ \end{turn}&
+% \begin{turn}{90}\argcmd{{\Rtp}}{rangeref}~ \end{turn}&
+% \begin{turn}{90}\argcmd{{\rtp}}{pageref}~ \end{turn}\\
+% \hline
+% \noalign{\smallskip}
+% ~$\ast$ & &\X &\X &\Q &\Q &\Q &\Q &\X\\
+% \okeylst & &\X &\X &\Q &\Q &\Q &\Q &\Q\\[1ex]
+% \opt{key} &|={|\meta{\rtp:}|},| &\X &\X &\Q &\Q &\Q &\Q &\Q\\
+% \opt{s} & |={true}|\footnote{^^A
+% Options defaults to \opt{true} but is initialized
+% as \opt{false}. The \argcmd{{\rtp}}{ref}\texttt{[s]}\marg{lbl}
+% command results in the plural: \opt{names}.
+% The same principle is also valid for the \opt{vref}
+% option.\fnlabel{b}}|,|
+% &\X &\X &\Q &\Q &\X &\X &\X\\
+% \opt{vref} &|={true}|\fnref*{b}|,|
+% &\X &\X &\Q &\Q &\Q &\Q &\Q\\
+% \opt{xr} &|={},| &\X &\X &\Q &\Q &\Q &\Q &\Q\\[1ex]
+% \opt{name} &|={},| &\X &\X &\Q &\X &\X &\X &\X\\
+% \opt{names}\footnote{^^A
+% Option depends on the selection of the \texttt{s=true/false}
+% optional key-value for singular or plural.\fnlabel{c}}
+% &|={},| &\X &\X &\Q &\X &\Q &\X &\X\\
+% \opt{Name} &|={},| &\X &\X &\X &\Q &\X &\X &\X\\
+% \opt{Names}\fnref*{c}
+% &|={},| &\X &\X &\X &\Q &\X &\Q &\X\\
+% \opt{lsttwotxt} &|={\space and~},| &\X &\X &\Q &\Q &\X &\X &\X\\
+% \opt{lsttxt} &|={\space and~},| &\X &\X &\Q &\Q &\X &\X &\X\\
+% \opt{rngtxt} &|={\space to~},| &\X &\X &\X &\X &\Q &\Q &\X\\[1ex]
+% \opt{refcmd} &|=\ref{#1},| &\X &\X &\Q &\Q &\Q &\Q &\Q\\
+%
+% \hline
+% \noalign{\smallskip}
+%
+% \footnotesize \Q\ -- \makebox[0pt][l]{\footnotesize Available}\\
+% \footnotesize \X\ -- \makebox[0pt][l]{Not available}
+% \end{tabular*}
+% \end{cminipage}
+% \end{table}
+%^^A=================================================================
+%
+%
+%
+% \clearpage
+% \section{\pkg{Keyval} Optional Arguments}\seclabel{keyvals}
+%
+% Al the options for the referencing commands are set with a key-value
+% list. \Tabref[vref]{refopt} gives a full list of all the key-values and
+% defaults. The options can also be changed locally with the
+% \okeylst\ optional arguments.
+%
+%
+% \subsection{Identifier: \opt{key}}
+%
+% The \opt{key} key-value is the prefix to the reference label
+% of the \cmd{\ref} and \cmd{\pageref} commands.
+% The default is \opt{key=}\meta{type\,:\,}.
+% With the default \RScfg:
+%
+% \begin{Itabb}
+% \tab\=\hspace{3.5cm}\=\hspace{2em}\=\kill
+% \cmd{\newref}|{tab}{...}|\\[1ex]
+% \>|\tablabel{abc}|
+% \>~ $\rightarrow$ |\label{tab:abc}|\\
+% \>|\tabref{abc}|
+% \>~ $\rightarrow$ |table~\ref{tab:abc}|\\[1ex]
+% \cmd{\newref}|{tab}{key=xxx-,...}|\\[1ex]
+% \>|\tablabel{abc}|
+% \>~ $\rightarrow$ |\label{xxx-abc}|\\
+% \>|\tabref{abc}|
+% \>~ $\rightarrow$ |table~\ref{xxx-abc}|
+% \end{Itabb}
+% For existing documents containing labels such as |\label{tab:xx}|,
+% you can use the \opt{nokeyprefix} option which defines \opt{key}|={}|. The
+% normal \cmd{\label} command can then be used and the reference
+% commands defaults to
+% \begin{Itabb}
+% \tab\=\hspace{3.5cm}\=\hspace{2em}\=\kill
+% \>\cmd{\label}|{tab:xx}| \\
+% \>|\tabref{tab:xx}| \>~ $\rightarrow$ |table~\ref{tab:xx}|
+% \end{Itabb}
+%
+%
+% \subsection{Plural form: \opt{s}}
+%
+% The \opt{s} conditional option (\texttt{true/false}) switches the
+% singular/plural form of the reference on and off. The default is
+% \opt{s}\texttt{=true}, but it is initialized to \texttt{false}.
+% \begin{Itabb}
+% \tab\=\hspace{3.5cm}\=\hspace{2em}\=\kill
+% |\tabref{abc}|
+% \>\>~ $\rightarrow$ |table~\ref{tab:abc}|\\
+% |\tabref[s]{abc}|
+% \>\>~ $\rightarrow$ |tables~\ref{tab:abc}|
+% \end{Itabb}
+%
+%
+% \subsection{Extended reference: \opt{vref}}
+%
+% The \opt{vref} conditional option (\texttt{true/far/false}) switches the
+% \pkg{varioref} page referencing on and off. The default is
+% \opt{vref}\texttt{=true}, but it is initialized to \texttt{false}.
+%
+% \begin{Itabb}
+% \tab\=\hspace{3.5cm}\=\hspace{2em}\=\kill
+% |\tabref{abc}|
+% \>\>~ $\rightarrow$ |table~\ref{tab:abc}|\\
+% |\tabref[vref]{abc}|
+% \>\>~ $\rightarrow$ |table~\ref{tab:abc}|
+% |\vpageref[\unskip]{tab:abc}|\\
+% |\tabref[vref=far]{abc}|^^A
+% \>\>~ $\rightarrow$ |table~\ref{tab:abc}|
+% |\reftextfaraway{tab:abc}|
+% \end{Itabb}
+%
+%
+% \subsection{External interfaces: \opt{xr}}
+%
+% The \opt{xr} option is for references to external documents.
+% It inserts a prefix in the reference label, compatible with the
+% \pkg{xr} package. The default is \opt{xr}|={}|.
+%
+% External document can be defined in the preamble with the
+% \pkg{xr} or \pkg{xr-hyper} packages:
+% \begin{Ipara}
+% \cmd{\usepackage}|{xr}|\\
+% \cmd{\externaldocument}\oarg{xr\_key}\marg{filename}
+% \end{Ipara}
+%
+% \noindent
+% If, for example, an external document defined with
+% \meta{xr\_key}\texttt{=\{A-\}}, uses an identical setup (e.g.\ the same
+% \RScfg), then it can be referenced with
+%
+% \begin{Itabb}
+% \tab\=\hspace{3.5cm}\=\hspace{2em}\=\kill
+% |\tabref[xr=A-]{abc}|
+% \>\>~ $\rightarrow$ |table~\ref{A-tab:abc}|
+% \end{Itabb}
+% \noindent or otherwise
+% \begin{Itabb}
+% \tab\=\hspace{3.5cm}\=\hspace{2em}\=\kill
+% |\tabref[xr=A-,key=]{abc}|
+% \>\>~ $\rightarrow$ |table~\ref{A-abc}|
+% \end{Itabb}
+%
+%
+% \subsection{Language parameters: \opt{name}, \opt{names},
+% \opt{Name}, \opt{Names}, \opt{rngtxt}, \opt{lsttwotxt}, \opt{lsttxt}}
+% \seclabel{langopts}
+%
+% This key-values contain the text prefixes and insertions.
+% Every house style or user has his or her own preference for naming the reference types,
+% therefore are there no defaults provided.
+%
+% \begin{Itabb}
+% \hspace*{1.5cm}\=\hspace{7cm}\=\kill
+% \opt{name} \> ---~Inside sentence reference prefix (singular)
+% \> default=|{}|\\
+% \opt{names}\> ---~Inside sentence reference prefix (plural)
+% \> default=|{}|\\
+% \opt{Name} \> ---~First word reference prefix (singular)
+% \> default=|{}|\\
+% \opt{Names}\> ---~First word reference prefix (plural)
+% \> default=|{}|\\
+% \opt{rngtxt}\> ---~Range of references
+% \> default=|{\ to~}|\\
+% \opt{lsttwotxt}\> ---~List of references (two)
+% \> default=|{\ and~}|\\
+% \opt{lsttxt}\> ---~List of references (more than two)
+% \> default=|{\ and~}|
+% \end{Itabb}
+% \noindent
+% Good typographic style manuals recommend the minimum use of
+% capital letters and punctuation that breaks the flow of a sentence
+% or paragraph. For abbreviations, Bringhurst\cite{Bring1996}
+% recommends the Oxford house style: Use a period only when the word
+% stops prematurely. The period is omitted if the abbreviation
+% begins with the first letter and end with the last. As an example
+% for equations, use eq.~(1) or eqn~(1).
+% A good guideline is not to abbreviate any reference type names.
+% If a sentence starts with a
+% reference then the type name must always be written in full.
+% A typical example for references to a table is:
+% \begin{Ipara}
+% \opt{name}| ={table~}, |\opt{names}| ={tables~},|\\
+% \opt{Name}| ={Table~}, |\opt{Names}| ={Tables~},|\\
+% \opt{rngtxt}|={\ to~}, |\opt{lsttxt}|={, and~}, |\opt{lsttwotxt}|={\ and~},|
+% \end{Ipara}
+% Note the hardspace after the text. It is needed to keep the text
+% and the reference together on the same line.
+%
+% The \RS\ configuration file can be setup to interface with \pkg{babel}
+% for different languages or for automatic language changes inside a
+% document. The language specific key-values can be added to the
+% \pkg{babel} hook |\extras|\meta{language}. The command
+% \DescribeMacro{\DeclareLangOpt}\cmd{\DeclareLangOpt}\footnote{^^A
+% Only for use in \RScfg\ the default config file}
+% is provided to supply a \meta{language} option to the package
+% and to add the option contents to |\extras|\meta{language}. The
+% default config file contains the following lines for equations:
+% \begin{Ipara}
+% |\newcommand\RSenglish{% |\\
+% | \def\RSeqtxt{equation~}% |\\
+% | \def\RSeqstxt{equations~}%|\\
+% | \def\RSEqtxt{Equation~}% |\\
+% | \def\RSEqstxt{Equations~}%|\\
+% | : |\\
+% | } |\\
+% |\DeclareLangOpt{english}{\RSenglish}|
+% \end{Ipara}
+% \DescribeMacro{\RSaddto}or manually with the \cmd{\RSaddto} command
+% \begin{Ipara}
+% |\RSaddto{\extrasenglish}{\RSenglish}|
+% \end{Ipara}
+% The key-value options for language specific options
+% are then set as:
+% \begin{Ipara}
+% |\newref{eq}{% |\\
+% | name = \RSeqtxt, |\\
+% | names = \RSeqstxt,|\\
+% | Name = \RSEqtxt, |\\
+% | Names = \RSEqstxt,|\\
+% | : |\\
+% | } |
+% \end{Ipara}
+%
+% \noindent\LaTeX{}/\pkg{babel} provides some language specific
+% names that can be utilized.
+%
+% \begin{Ipara}
+% |\chaptername \appendixname|\\
+% |\figurename \tablename|\\
+% |\partname \pagename|
+% \end{Ipara}
+%
+% To setup a multilingual document with \pkg{babel},
+% \emph{always} make the language options global so that other
+% language compliant packages can detect it.
+% A typical setup for an Afrikaans/English document would be:
+% {\makeatletter\def\meta@font@select{\normalfont\ttfamily\slshape}
+% \begin{Ipara}
+% |\documentclass[UKenglish,afrikaans,|\meta{options}|]{|\meta{LaTeX\_class}|}|\\
+% |\usepackage[T1]{fontenc}%..|\texttt{\slshape hyphenation of words with accents}\\
+% |\usepackage{babel}%........|\texttt{\slshape language def's}\\
+% |\usepackage{varioref}%.....|\texttt{\slshape for \opt{vref} option}\\
+% |\usepackage{refstyle}|
+% \end{Ipara}}
+%
+%
+% \subsection{Reference formatting command: \opt{refcmd}}
+%
+% The \opt{refcmd} key-value holds the contents of the internal
+% command that formats the reference. The |#1| parameter
+% passed to the command is the full reference label.
+% For example:
+% \begin{Itabb}
+% \hspace{10em}\=hspace{5em}\=\kill
+% \opt{refcmd}|=(\ref{#1})| \> $\rightarrow$~
+% |(\ref{|\meta{label}|})|
+% \end{Itabb}
+%
+% External commands can be employed. For example, to make references
+% to equations identical to the \AmS\ \cmd{\eqref} command:
+% \begin{Itabb}
+% \opt{refcmd}|={\textup{\tagform@{\ref{#1}}}}%|~~It needs \file{amsmath.sty}
+% \end{Itabb}
+%
+% The \opt{refcmd} can be used in conjuntion with the |\ifRSstar|,
+% |\ifRSnameon|, |\ifRSplural| and |\ifRScapname| internal
+% conditional variables to format the reference. As an example for a
+% reference to a footnote, where a duplicate footnote mark is needed,
+% can the \opt{refcmd} be configured so that the starred form of the
+% reference command produce a superscripted duplicate mark:
+% \begin{Itabb}
+% |\newcommand{\RSfnmark}[1]{%|\\
+% | \begingroup |\\
+% | \unrestored@protected@xdef\@thefnmark{#1}%|\\
+% | \endgroup |\\
+% | \@footnotemark} |\\[1ex]
+% \opt{refcmd}|={\ifRSstar\RSfnmark{\ref{#1}}\else(\ref{#1})\fi}|
+% \end{Itabb}
+% \noindent The second footnote mark, \fnref*[name]{b}, in
+% \tabref[vref]{refopt}, was obtained in this way with the reference
+% |\fnref*{b}|. See \RScfg\ for another
+% example for references to chapters and appendices.
+%
+% The \pkg{nameref} package can easily be incorporated if you need elaborate
+% references which include the section or chapter name:
+% \begin{Ipara}
+% |\Secref[vref, refcmd={\S\ref{#1}, `\nameref{#1}'}]{PRefCmds}|
+% \end{Ipara}
+% gives
+% \begin{Ipara}
+% \Secref[vref, refcmd={\S\ref{#1}, `\nameref{#1}'}]{PRefCmds}
+% \end{Ipara}
+%
+% \section{Default configuration files}
+%
+% The \pkg{refstyle} package first searches for the \file{refstyle.def}
+% configuration file, and if it not found, then it uses the default
+% configuration file \RScfg\ that is supplied with the package.
+%
+% The default configuration file, \RScfg, makes a
+% number of default reference declarations and provides language
+% definitions for the language parameters. See the file
+% \file{refconfig.pdf} for the documentation.
+% \medskip
+%
+% \begin{center}
+% \begin{fminipage}[.55\textwidth]
+% \slshape Any user is welcome to customize the
+% local copy of the \RScfg\ file or copy
+% the relevant contents to your own \file{refstyle.def}
+% configuration file.
+% \end{fminipage}
+% \end{center}
+%
+% \begin{thebibliography}{99}
+% \bibitem{Bring1996}
+% {Bringhurst, R.} (1996), \emph{The elements of typographic style},
+% Hartley \& Marks Publishers, Point Roberts, WA, USA and Vancouver,
+% BC, Canada, second edn.
+% \end{thebibliography}
+%
+% \StopEventually{\PrintChanges\PrintIndex}
+% \clearpage
+%
+% \section{Implementation: \pkg{refstyle.sty}}
+%
+% \subsection{Identification}
+% \begin{macrocode}
+%<*pkg>
+\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+\ProvidesPackage{refstyle}[\RefstyleFileDate\space
+ \RefstyleFileVersion\space
+ Reference formatting (DNJ Els)]
+\newcommand*{\RS@pkgname}{refstyle}
+% \end{macrocode}
+%
+%
+% \subsection{External packages}
+%
+% Load all the external packages.
+% \begin{macrocode}
+\RequirePackage{keyval}
+% \end{macrocode}
+%
+% \begin{macro}{\RS@setkeys}
+% \changes{v0.3}{2006/09/09}{original \cmd{\setkeys} copy}
+% Note if \pkg{xkeyval} is loaded, it redefines \pkg{keyval}'s
+% macros. To fix this bug, we need the original \cmd{\setkeys}
+% command.
+% \begin{macrocode}
+\def\RS@setkeys#1#2{%
+ \def\KV@prefix{KV@#1@}%
+ \let\@tempc\relax
+ \KV@do#2,\relax,}
+% \end{macrocode}
+% \end{macro}
+%
+% \noindent A small bug-fix for \pkg{showkeys}. Will be removed
+% after release of new version.
+%
+% \begin{macrocode}
+\@ifundefined{vref@space}{\let\vref@space\space}{}
+% \end{macrocode}
+%
+% \begin{macro}{\@safe@activestrue}
+% \changes{v0.5}{2010/11/02}{Add \cmd{\@safe@activesfalse}}
+% \begin{macro}{\@safe@activesfalse}
+% \changes{v0.5}{2010/11/02}{Add \cmd{\@safe@activestrue}}
+% If \pkg{babel} is not loaded, make the following
+% commands inactive.
+% \begin{macrocode}
+\providecommand*{\@safe@activestrue}{}
+\providecommand*{\@safe@activesfalse}{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Utility commands}
+%
+% \begin{macro}{\RS@namelet}
+% \begin{macro}{\RS@nameuse}
+% \begin{macro}{\RS@namedef}
+% \begin{macro}{\RS@robustnamedef}
+% \noindent
+% The following is a list of commands that take a variable \marg{name}
+% as argument. This enables on-the-fly definitions of user commands.
+% \begin{Itabb}
+% Usage:~\=\cmd{\RS@robustnamedef}\marg{name}~\=\kill
+% Usage:
+% \>\cmd{\RS@namelet}\marg{name}
+% \> $\rightarrow$ \cmd{\let}\cmeta{name}\\
+% \>\cmd{\RS@nameuse}\marg{name}
+% \> $\rightarrow$ \cmeta{name}\\
+% \>\cmd{\RS@namedef}\marg{name}
+% \> $\rightarrow$ \cmd{\def}\cmeta{name}\\
+% \>\cmd{\RS@robustnamedef}\marg{name}
+% \> $\rightarrow$
+% \cmd{\def}\cmeta{name}|{\protect|\cmeta{name\textvisiblespace}|}|^^A
+% \cmd{\def}\cmeta{name\textvisiblespace}
+% \end{Itabb}
+% \begin{macrocode}
+\newcommand*{\RS@namelet}[1]{\expandafter\let\csname #1\endcsname}
+\newcommand*{\RS@nameuse}[1]{\csname #1\endcsname}
+\newcommand*{\RS@namedef}[1]{\expandafter\def\csname #1\endcsname}
+\newcommand*{\RS@robustnamedef}[1]{%
+ \expandafter\edef\csname #1\endcsname{%
+ \noexpand\protect\RS@nameuse{#1 }}%
+ \RS@namedef{#1 }}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\RS@ifundefined}
+% This is an improved definition\footnote{Posted by Markus Kohm
+% on c.t.t. 2002/11/11} for the \LaTeX{} kernel command
+% \cmd{\@ifundefined} that do not leave an undefined command
+% defined as \cmd{\relax} after the test.
+%
+% The usage is:
+% \cmd{\RS@ifundefined}\marg{name}\marg{true}\marg{false} executes
+% the contents of \meta{true} if \cmeta{name} is not defined and
+% \meta{false} if defined.
+% \begin{macrocode}
+\def\RS@ifundefined#1{%
+ \begingroup\expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname#1\endcsname\relax
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RS@removedef}
+% The command removes the definition of a command, including
+% robust definitions.
+% \begin{macrocode}
+\newcommand*{\RS@removedef}[1]{%
+ \RS@namelet{#1}\@undefined%
+ \RS@ifundefined{#1 }{}{\RS@namelet{#1 }\@undefined}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RS@testednamedef}
+% \begin{macro}{\RS@testedrobustnamedef}
+% These command are identical to \cmd{\RS@namedef} and
+% \cmd{\RS@robustnamedef}, but only define the \cmeta{name}
+% command if it is legal. Otherwise an error message
+% is written to the log file and the program is terminated.
+% \begin{macrocode}
+\newcommand*{\RS@testednamedef}[1]{%
+ \RS@ifnamedefinable{#1}\RS@namedef{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*{\RS@testedrobustnamedef}[1]{%
+ \RS@ifnamedefinable{#1}\RS@robustnamedef{#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\RS@ifnamedefinable}
+% A modified version of the \LaTeX{} kernel command
+% (from ltdefns.dtx).
+% \begin{macrocode}
+\long\def\RS@ifnamedefinable #1{%
+ \edef\reserved@a{#1}%
+ \RS@ifundefined\reserved@a
+ {\edef\reserved@b{\expandafter\@carcube \reserved@a xxx\@nil}%
+ \ifx \reserved@b\@qend \RS@notdefinable\else
+ \ifx \reserved@a\@qrelax \RS@notdefinable\else
+ \PackageInfo{\RS@pkgname}{\@backslashchar\reserved@a\space created}%
+ \fi
+ \fi}%
+ \RS@notdefinable}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RS@notdefinable}
+% The error message when an illegal definition is attempted.
+% \begin{macrocode}
+\gdef\RS@notdefinable{%
+ \PackageError{\RS@pkgname}{%
+ Command \@backslashchar\reserved@a\space
+ already defined.\MessageBreak
+ Or name \@backslashchar\@qend... illegal.\MessageBreak
+ It can not be redefined by the \@backslashchar newref%
+ }{%
+ If \@backslashchar\reserved@a\space is not important\MessageBreak
+ then \protect\let\@backslashchar\reserved@a%
+ =\protect\relax,\MessageBreak
+ else use a different \@backslashchar newref.}%
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RS@setbool}
+% The command\footnote{Taken from the \pkg{ifthen} package.}
+% \cmd{\RS@setbool}\marg{conditional}\marg{true/false}
+% sets the \meta{conditional} to |true| or |false|.
+% \begin{Itabb}
+% Usage:~\=
+% \cmd{\RS@setbool}|{RSplural}{false}|\quad\=$\rightarrow$\quad
+% |\RSpluralfalse|\\
+% \>\cmd{\RS@setbool}|{RSplural}{true}|\quad\>$\rightarrow$\quad
+% |\RSpluraltrue|
+% \end{Itabb}
+%
+% \begin{macrocode}
+\newcommand*{\RS@setbool}[2]{%
+ \lowercase{\def\@tempa{#2}}%
+ \@ifundefined{@tempswa\@tempa}%
+ {\PackageError{\RS@pkgname}%
+ {You can only set the option to `true' or `false'}\@ehc}%
+ {\csname#1\@tempa\endcsname}}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{First character case changes}
+%
+% \begin{macro}{\RS@firstcap}
+% This macro\footnote{Posted by Dan Luecking on c.t.t.} change the
+% first character of a string to uppercase and returns the result
+% in \cmd{\RS@cap}.
+% \begin{Ipara}
+% Usage:~|\RS@fistcap xxxx\@nil| then |\RS@cap| $\rightarrow$ |Xxxx|
+% \end{Ipara}
+% \begin{macrocode}
+\def\RS@firstcap#1#2\@nil{%
+ \iffalse{\fi
+ \uppercase{\edef\RS@cap{\iffalse}\fi#1}#2}}%
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \subsection{Reference building commands}
+%
+% \begin{macro}{\ifRS@keyactive}
+% \changes{v0.4}{2010/10/21}{Add \opt{nokeyprefix} to turn of the key prefix}
+% We need to peek into the options list for the \opt{nokeyprefix} option
+% before the options are processed to find out if the key prefix must be
+% included in the |\|\meta{key}|label| command. Make \opt{nokeyprefix}
+% not used afterwards.
+% \begin{macrocode}
+\newif\ifRS@keyactive
+\@ifpackagewith{\@currname}{nokeyprefix}%
+ {\RS@keyactivefalse}%
+ {\RS@keyactivetrue}
+\DeclareOption{nokeyprefix}{\OptionNotUsed}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\ifRSstar}
+% \begin{macro}{\ifRSnameon}
+% \begin{macro}{\ifRScapname}
+% \begin{macro}{\ifRSplural}
+% \begin{macro}{\ifRSlsttwo}
+% \changes{v0.4}{2010/10/21}{Add \cmd{\ifRSlsttwo} test for list containing only two parameter}
+% The |\if| conditional values that are set by the reference commands.
+% These values can be accessed by user defined key-values.
+% \begin{macrocode}
+\newif\ifRSstar\RSstarfalse
+\newif\ifRSnameon\RSnameontrue
+\newif\ifRScapname\RScapnamefalse
+\newif\ifRSplural\RSpluralfalse
+\newif\ifRSlsttwo\RSlsttwofalse
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\newref}
+% The main user interface for template setup. It take the |#1| or
+% \meta{key} parameter and make it lowercase before passing it on to
+% \cmd{\RS@newref}.
+%
+%
+% \begin{macrocode}
+\newcommand*{\newref}[1]{%
+ \lowercase{\def\RS@tempa{#1}}%
+ \expandafter\RS@newref\expandafter{\RS@tempa}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RS@newref}
+% \changes{v0.4}{2010/10/21}{Ad \texttt{lsttwotxt} option}
+% This command configures a new template.
+% \begin{macrocode}
+\newcommand*{\RS@newref}[2]{%
+% \end{macrocode}
+% \bNP[2.0]\noindent Clears an existing template before defining a new one.\eNP
+% \begin{macrocode}
+ \RS@clearref{#1}%
+% \end{macrocode}
+% \bNP[2.0]\noindent Create |\ifRS@|\meta{key}|vref| conditional \eNP
+% \begin{macrocode}
+% \expandafter\newif\csname ifRS@#1vref\endcsname%
+% \end{macrocode}
+% \bNP[2.0]\noindent Creates a series of key-values for every template
+% that stores the setup for the specific template.\eNP
+% \begin{macrocode}
+ \ifRS@keyactive
+ \define@key{RS@#1}{key}[#1:]{\RS@namedef{RS@#1@key}{##1}}%
+ \else
+ \define@key{RS@#1}{key}[]{\RS@namedef{RS@#1@key}{##1}}%
+ \fi
+ \define@key{RS@#1}{s}[true]{\RS@setbool{RSplural}{##1}}%
+ \define@key{RS@#1}{name}[]{\RS@namedef{RS@#1@name}{##1}}%
+ \define@key{RS@#1}{names}[]{\RS@namedef{RS@#1@names}{##1}}%
+ \define@key{RS@#1}{Name}[]{\RS@namedef{RS@#1@Name}{##1}}%
+ \define@key{RS@#1}{Names}[]{\RS@namedef{RS@#1@Names}{##1}}%
+ \define@key{RS@#1}{rngtxt}[\space to~]{\RS@namedef{RS@#1@rngtxt}{##1}}%
+ \define@key{RS@#1}{lsttwotxt}[\space and~]{\RS@namedef{RS@#1@lsttwotxt}{##1}}%
+ \define@key{RS@#1}{lsttxt}[\space and~]{\RS@namedef{RS@#1@lsttxt}{##1}}%
+ \define@key{RS@#1}{refcmd}[\ref{####1}]{\RS@namedef{RS@#1@rcmd}####1{##1}}%
+ \define@key{RS@#1}{xr}[]{\RS@namedef{RS@#1@xr}{##1}}%
+ \define@key{RS@#1}{vref}[true]{\RS@namedef{RS@#1vref}{##1}}%
+% \end{macrocode}
+% \bNP[2.0]\noindent Set default key-value parameters.\eNP
+% \begin{macrocode}
+ \RS@setkeys{RS@#1}{key,
+ s=false,
+ name,names,Name,Names,
+ rngtxt,lsttwotxt,lsttxt,
+ refcmd,
+ xr,
+ vref=false}%
+% \end{macrocode}
+% \bNP[2.0]\noindent Set key-values according to user definitions.\eNP
+% \begin{macrocode}
+ \RS@setkeys{RS@#1}{#2}%
+% \end{macrocode}
+% \bNP[2.0]\noindent Build the reference commands.\eNP
+% \begin{macrocode}
+ \RS@buildref{#1}%
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RS@clearref}
+% Clear a reference template for redefinition. It check
+% if the template already exists and clear it if it does.
+%
+% \begin{macrocode}
+\newcommand*{\RS@clearref}[1]{%
+ \RS@ifundefined{RS@#1@template}
+ {\RS@namedef{RS@#1@template}{#1}%
+ \PackageInfo{\RS@pkgname}%
+ {New reference template \protect\newref{#1}}{}}
+ {\PackageInfo{\RS@pkgname}%
+ {Reference template \protect\newref{#1} redefined}{}
+ \RS@firstcap#1\@nil
+ \RS@removedef{#1key}%
+ \RS@removedef{#1label}%
+ \RS@removedef{#1ref}%
+ \RS@removedef{\RS@cap ref}%
+ \RS@removedef{#1rangeref}%
+ \RS@removedef{\RS@cap rangeref}%
+ \RS@removedef{#1pageref}%
+ }%
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RS@buildref}
+% Build the reference commands. See \tabref{refopt} for the list of
+% commands. The \cmd{\RS@buildref}\marg{key} build commands to
+% call \cmd{\RS@cmd}\marg{cmd}\marg{key}, for example:
+% \begin{Ipara}
+% \cmeta{key}|ref| \quad$\rightarrow$\quad
+% |{\RScapnamefalse\RS@cmd{ref}|\marg{key}|}|
+% \end{Ipara}
+% \changes{v0.2}{2003/07/30}{Remove robust def of \argcmd{{\rtp}}{label}}
+% \begin{macrocode}
+\newcommand*{\RS@buildref}[1]{%
+ \RS@firstcap#1\@nil
+ \RS@testednamedef{#1key}{\RS@nameuse{RS@#1@key}}
+ \RS@testednamedef{#1label}##1{\label{\RS@nameuse{RS@#1@key}##1}}
+ \RS@testedrobustnamedef{#1ref}{\RScapnamefalse\RS@cmd{ref}{#1}}
+ \RS@testedrobustnamedef{\RS@cap ref}{\RScapnametrue\RS@cmd{ref}{#1}}
+ \RS@testedrobustnamedef{#1rangeref}{\RScapnamefalse\RS@cmd{rangeref}{#1}}
+ \RS@testedrobustnamedef{\RS@cap rangeref}{\RScapnametrue\RS@cmd{rangeref}{#1}}
+ \RS@testedrobustnamedef{#1pageref}{\RScapnamefalse\RS@cmd{pageref}{#1}}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RS@cmd}
+% \begin{macro}{\RS@@cmd}
+% The command \cmd{\RS@cmd}\marg{cmd}\marg{key} calls the final
+% reference formatting commands.
+% It checks for the starred form and set the conditionals
+% |\ifRSstar| and |\ifRSnameon| accordingly.
+% It also extracts the optional key-value list.
+% \begin{Itabb}
+% \hspace*{4.5cm}\=\kill
+% \cmd{\RS@cmd}|{ref}|\marg{key} \>$\rightarrow$\quad
+% |\RS@ref|\marg{key}\okeylst\\
+% \cmd{\RS@cmd}|{rangeref}|\marg{key} \>$\rightarrow$\quad
+% |\RS@rangeref|\marg{key}\okeylst\\
+% \cmd{\RS@cmd}|{pageref}|\marg{key} \>$\rightarrow$\quad
+% |\RS@pageref|\marg{key}\okeylst
+% \end{Itabb}
+% \begin{macrocode}
+\newcommand*{\RS@cmd}[2]{%
+ \@ifstar{\RSstartrue\RSnameonfalse\RS@@cmd{#1}{#2}}%
+ {\RSstarfalse\RSnameontrue\RS@@cmd{#1}{#2}}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*{\RS@@cmd}[2]{%
+ \@ifnextchar[%
+ {\RS@nameuse{RS@#1}{#2}}%
+ {\RS@nameuse{RS@#1}{#2}[]}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsection{Reference formatting commands}
+%
+% \begin{macro}{\RS@ref}
+% \changes{v0.5}{2010/11/02}{Add \cmd{\@safe@activestrue} to avoid active chars is ref list}
+% \begin{macro}{\RS@@ref}
+% \begin{macro}{\RS@@@ref}
+% \changes{v0.4}{2010/10/21}{Add \cmd{\ifRSlsttwo} test for list containing only two parameter}
+% The command \cmd{\RS@ref}\marg{key}\okeylst\marg{label\_lst}
+% typeset the references to the comma-separated reference
+% label list according to the configuration for \meta{key}.
+%
+% First of all, remove all spaces for the reference label list.
+% \begin{macrocode}
+\def\RS@ref#1[#2]#3{%
+ \begingroup
+ \RS@setkeys{RS@#1}{#2}%
+ \@safe@activestrue%
+ \edef\RS@tmpa{\zap@space#3 \@empty}%
+ \@safe@activesfalse%
+ \edef\RS@tmpa{\noexpand\RS@@ref{#1} \RS@tmpa,\relax\noexpand\@eolst}%
+ \RS@tmpa%
+ \endgroup}
+% \end{macrocode}
+% \end{macro}
+% Check if there is a single or multiple references in the
+% reference label list. If a single reference label then use the
+% form set by the \opt{s} key-value. If multiple reference labels
+% the use the plural form of the name prefix.\footnote{
+% The list of reference commands came from the \pkg{typedref} package.}
+%
+% \begin{macrocode}
+\def\RS@@ref#1 #2,#3\@eolst{%
+ \ifx\relax#3\relax
+ \RS@makename{#1}%
+ \RS@makeref{#1}{#2}%
+ \RS@makevpageref{#1}{#2}%
+ \else
+ \RSpluraltrue%
+ \RS@makename{#1}%
+ \RS@makeref{#1}{#2}%
+ \RS@makevpageref{#1}{#2}%
+ \RSnameonfalse%
+ \RSlsttwotrue%
+ \RS@@@ref{#1} #3\@eolst%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% For more than one reference in the reference list, typeset the
+% rest of the references.
+% \begin{macrocode}
+\def\RS@@@ref#1 #2,#3\@eolst{%
+ \ifx\relax#3\relax
+ \ifRSlsttwo
+ \RS@nameuse{RS@#1@lsttwotxt}%
+ \else
+ \RS@nameuse{RS@#1@lsttxt}%
+ \fi
+ \RS@makeref{#1}{#2}%
+ \RS@makevpageref{#1}{#2}%
+ \else
+ \RSlsttwofalse%
+ \unskip,\space%
+ \RS@makeref{#1}{#2}%
+ \RS@makevpageref{#1}{#2}%
+ \RS@@@ref{#1} #3\@eolst%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RS@rangeref}
+% The command \cmd{\RS@rangeref}\marg{key}\okeylst\marg{lbl1}\marg{lbl2}
+% typeset the references as a range.
+% \begin{macrocode}
+\def\RS@rangeref#1[#2]#3#4{%
+ \begingroup
+ \RS@setkeys{RS@#1}{#2}%
+ \RSpluraltrue%
+ \RS@makename{#1}%
+ \RS@makeref{#1}{#3}%
+ \RS@nameuse{RS@#1@rngtxt}%
+ \RSnameonfalse%
+ \RS@makeref{#1}{#4}%
+ \RS@makevpagerefrange{#1}{#3}{#4}%
+ \endgroup}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RS@pageref}
+% The command \cmd{\RS@pageref}\marg{key}\okeylst\marg{lbl} type
+% the page where \marg{lbl} was defined.
+% \begin{macrocode}
+\def\RS@pageref#1[#2]#3{%
+ \begingroup%
+ \RS@setkeys{RS@#1}{#2}%
+ \RS@ifvref{#1}%
+ {\mbox{}\vpageref*{\RS@lbl{#1}{#3}}}%
+ {\reftextfaraway{\RS@lbl{#1}{#3}}}%
+ {\pageref{\RS@lbl{#1}{#3}}}%
+ \endgroup}
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v0.2}{2003/07/30}{Remove redundant \cmd{\RS@label}}
+%
+% \begin{macrocode}
+\newcommand*{\RS@true}{true}
+\newcommand*{\RS@false}{false}
+\newcommand*{\RS@far}{far}
+% \end{macrocode}
+%
+% \begin{macro}{\RS@ifvref}
+% The command \cmd{\RS@ifvref}\marg{key}\marg{true}\marg{faraway}\marg{false}
+% executes the contents of \meta{true} if the \opt{vref} option for
+% the \meta{key} reference type is true and \meta{false} otherwise.
+% \begin{macrocode}
+\newcommand{\RS@ifvref}[4]{%
+ \edef\RS@tempa{\RS@nameuse{RS@#1vref}}%
+ \ifx\RS@tempa\RS@true\relax
+ #2%
+ \else\ifx\RS@tempa\RS@far\relax
+ #3%
+ \else\ifx\RS@tempa\RS@false\relax
+ #4%
+ \else
+ \PackageError{\RS@pkgname}%
+ {You can only set the vref option to `true', `far' or `false'}\@ehc
+ \fi\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RS@makename}
+% The command \cmd{\RS@makename}\marg{key} build the prefix
+% to the reference commands.
+% \begin{macrocode}
+\newcommand{\RS@makename}[1]{%
+ \ifRSstar\else\ifRSnameon
+ \ifRSplural
+ \ifRScapname
+ \RS@nameuse{RS@#1@Names}%
+ \else
+ \RS@nameuse{RS@#1@names}%
+ \fi
+ \else
+ \ifRScapname
+ \RS@nameuse{RS@#1@Name}%
+ \else
+ \RS@nameuse{RS@#1@name}%
+ \fi
+ \fi
+ \fi\fi
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RS@lbl}
+% This command builds the full label string for the \cmd{\ref}
+% command.
+% \begin{Ipara}
+% \cmd{\RS@lbl}\marg{key}\marg{label} \quad$\rightarrow$\quad
+% |{|\meta{xr_key}\meta{key}\meta{label}|}|
+% \end{Ipara}
+% \begin{macrocode}
+\newcommand*{\RS@lbl}[2]{%
+ \RS@nameuse{RS@#1@xr}\RS@nameuse{RS@#1@key}#2%
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RS@makeref}
+% The command \cmd{\RS@makeref}\marg{key}\marg{label} formats
+% the \cmd{\ref} output
+% \begin{Ipara}
+% \cmd{\RS@makeref}\marg{key}\marg{label} \quad$\rightarrow$\quad
+% \cmeta{rcmd}|{\ref{|\meta{xr_key}\meta{key}\meta{label}|}}|
+% \end{Ipara}
+% \begin{macrocode}
+\newcommand{\RS@makeref}[2]{%
+ \RS@nameuse{RS@#1@rcmd}{\RS@lbl{#1}{#2}}%
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RS@makevpageref}
+% The command \cmd{\RS@makevpageref}\marg{key}\marg{label} adds the
+% \pkg{varioref} page reference if the \opt{vref} option is true.
+% \begin{macrocode}
+\newcommand{\RS@makevpageref}[2]{%
+ \RS@ifvref{#1}%
+ {\vpageref[\unskip]{\RS@lbl{#1}{#2}}}%
+ { \reftextfaraway{\RS@lbl{#1}{#2}}}%
+ {}%
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RS@makevpagerefrange}
+% The command \cmd{\RS@makevpagerefrange}\marg{key}\marg{lbl1}\marg{lbl1}
+% adds the \pkg{varioref} page range reference if the \opt{vref}
+% option is true.
+% \begin{macrocode}
+\newcommand{\RS@makevpagerefrange}[3]{%
+ \RS@ifvref{#1}%
+ {\space\vpagerefrange[\unskip]{\RS@lbl{#1}{#2}}{\RS@lbl{#1}{#3}}}%
+ {\space\vpagerefrange[\unskip]{\RS@lbl{#1}{#2}}{\RS@lbl{#1}{#3}}}%
+ {}%
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{\pkg{varioref} command predefinitions}
+%
+% \begin{macrocode}
+\AtBeginDocument{%
+ \providecommand{\vpageref}{%
+ \PackageError{\RS@pkgname}%
+ {The vref option used, but varioref.sty not loaded.}%
+ {Load varioref.sty}}
+ \providecommand{\reftextfaraway}{%
+ \PackageError{\RS@pkgname}%
+ {The vref=far option used, but varioref.sty not loaded.}%
+ {Load varioref.sty}}
+ \providecommand{\vpagerefrange}{%
+ \PackageError{\RS@pkgname}%
+ {The vref option used, but varioref.sty not loaded.}%
+ {Load varioref.sty}}
+ }
+% \end{macrocode}
+%
+%
+% \subsection{Support for language option inclusions in config file}
+%
+% \begin{macro}{\RSaddto}
+% \changes{v0.2}{2003/07/30}{Rename \cmd{\RS@addto} to \cmd{\RSaddto}}
+% Command from the \pkg{varioref} package is used to add
+% language definitions to the |\extras|\meta{language} token
+% for \pkg{babel}.
+% \begin{macrocode}
+\def\RSaddto#1#2{%
+ #2%
+ \@temptokena{#2}%
+ \ifx#1\relax
+ \let#1\@empty
+ \fi
+ \ifx#1\undefined
+ \edef#1{\the\@temptokena}%
+ \else
+ \toks@\expandafter{#1}%
+ \edef#1{\the\toks@\the\@temptokena}%
+ \fi
+ \@temptokena{}\toks@\@temptokena}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DeclareLangOpt}
+% \changes{v0.5}{2010/11/02}{Add \cmd{\extras}\meta{language} to beginning of document.}
+% Command to declare a language option and add
+% language definitions to the |\extras|\meta{language} token
+% for \pkg{babel}.
+% \begin{macrocode}
+\def\DeclareLangOpt#1#2{%
+ \edef\RS@tempa{\expandafter\@gobble\string#2}%
+ \RS@ifundefined{\RS@tempa}%
+ {\PackageError{\RS@pkgname}{%
+ Unknown definitions \@backslashchar\RS@tempa\MessageBreak
+ for language option `#1'}{}}%
+ {\DeclareOption{#1}{%
+ \AtBeginDocument{\expandafter\RSaddto\csname extras#1\endcsname #2}}}%
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \subsection{Configuration files}
+%
+% \begin{macro}{\RS@cfgfile,\RS@reffile}
+% \changes{v0.4}{2010/10/21}{Ad alternative definition file \cmd{refstyle.def}}
+% Define the config file and alternate definition file names.
+% \begin{macrocode}
+\newcommand*{\RS@cfgfile}{refstyle.cfg}
+\newcommand*{\RS@reffile}{refstyle.def}
+% \end{macrocode}
+% \end{macro}
+%
+% We need to peek into the options list before the
+% options are processed to find out if the config
+% file is to be loaded or not. The config file can
+% contain options and must be loaded before
+% \cmd{\ProcessOptions}. Make \opt{noconfig} not used
+% afterwards.
+%
+% We first test for a local config file \file{refstyle.def}
+% and then for the global config file \file{refstyle.cfg}.
+% \begin{macrocode}
+\@ifpackagewith{\@currname}{noconfig}%
+ {\PackageInfo{\RS@pkgname}{No config file loaded}}%
+ {\InputIfFileExists{\RS@reffile}%
+ {\PackageInfo{\RS@pkgname}{Local config file \RS@reffile\space used}}
+ {\InputIfFileExists{\RS@cfgfile}%
+ {\PackageInfo{\RS@pkgname}{Config file \RS@cfgfile\space used}}%
+ {\PackageInfo{\RS@pkgname}{No config file found}}}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareOption{noconfig}{\OptionNotUsed}%
+% \end{macrocode}
+%
+% Process the options, including options in config file.
+% \begin{macrocode}
+\ProcessOptions*\relax
+% \end{macrocode}
+%
+% The end of this package.
+% \begin{macrocode}
+%</pkg>
+% \end{macrocode}
+%
+% \Finale
+\endinput