From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/refstyle/README | 70 ++ macros/latex/contrib/refstyle/refconfig.dtx | 1212 ++++++++++++++++++ macros/latex/contrib/refstyle/refconfig.pdf | Bin 0 -> 292980 bytes macros/latex/contrib/refstyle/refstyle.cfg | 571 +++++++++ macros/latex/contrib/refstyle/refstyle.dtx | 1796 +++++++++++++++++++++++++++ macros/latex/contrib/refstyle/refstyle.ins | 97 ++ macros/latex/contrib/refstyle/refstyle.pdf | Bin 0 -> 484262 bytes macros/latex/contrib/refstyle/refstyle.sty | 327 +++++ 8 files changed, 4073 insertions(+) create mode 100644 macros/latex/contrib/refstyle/README create mode 100644 macros/latex/contrib/refstyle/refconfig.dtx create mode 100644 macros/latex/contrib/refstyle/refconfig.pdf create mode 100644 macros/latex/contrib/refstyle/refstyle.cfg create mode 100644 macros/latex/contrib/refstyle/refstyle.dtx create mode 100644 macros/latex/contrib/refstyle/refstyle.ins create mode 100644 macros/latex/contrib/refstyle/refstyle.pdf create mode 100644 macros/latex/contrib/refstyle/refstyle.sty (limited to 'macros/latex/contrib/refstyle') diff --git a/macros/latex/contrib/refstyle/README b/macros/latex/contrib/refstyle/README new file mode 100644 index 0000000000..e33a537d59 --- /dev/null +++ b/macros/latex/contrib/refstyle/README @@ -0,0 +1,70 @@ + The refstyle package + For extended references + +File: README +Author: Danie Els + +DESCRIPTION +=========== + +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. + +Copyright: 2002--2010 Danie Els +Licence: LPPL + +FILES IN DISTRIBUTION +===================== + + BASE DISTRIBUTION: + + README This file. + refstyle.ins Package installation file. + refstyle.dtx Package source file. + refconfig.dtx Package configuration source file. + + refstyle.sty + refstyle.cfg Package style and config files. Was produced by + executing "latex refstyle.ins". + + DOCUMENTATION: + + refstyle.pdf User manual for refstyle package. It was + produced by executing: + + latex refstyle.ins + + pdflatex refstyle.dtx + pdflatex refstyle.dtx + makeindex -s gglo.ist -o refstyle.gls refstyle.glo + makeindex -s gind.ist -o refstyle.ind refstyle.idx + pdflatex refstyle.dtx + pdflatex refstyle.dtx + + refconfig.pdf Configuration manual for refstyle package. Produced + form refconfig.dtx in the same manner as above. + + +BASIC INSTALLATION +==================== + + The minimum requirement to use the package is the to have + refstyle.sty and refstyle.cfg in a directory where TeX can find it. + + For a basic installation on a TDS compliant system, move the following + files to the following directories: + + /tex/latex/refstyle/ + refstyle.sty + refstyle.cfg + + /source/latex/refstyle/ + refstyle.ins + refstyle.dtx + refconfig.dtx + + /doc/latex/refstyle/ + README + refstyle.pdf + refconfig.pdf diff --git a/macros/latex/contrib/refstyle/refconfig.dtx b/macros/latex/contrib/refstyle/refconfig.dtx new file mode 100644 index 0000000000..a603d8e135 --- /dev/null +++ b/macros/latex/contrib/refstyle/refconfig.dtx @@ -0,0 +1,1212 @@ +% \iffalse +% +% refconfig.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 +% ------------------------------------------------------------------- +% +% +%<*driver> +\documentclass[a4paper]{ltxdoc} + \EnableCrossrefs + \CodelineIndex + \RecordChanges +\usepackage{color} +\usepackage{framed} + \setlength{\FrameSep}{1\fboxsep} + \definecolor{shadecolor}{gray}{0.9} + \newenvironment{RSframed}{\shaded}{\endshaded} +\usepackage{xspace} +\usepackage{varioref} +\usepackage{refstyle} + +%-- macrocode env changes ------------------------------ + +\setlength{\MacroIndent}{1.5em} + +%-- Indented environments ------------------------------ + +\newlength{\tdima} +\newsavebox{\tboxa} +\newlength{\mytab} +\setlength{\mytab}{2\parindent} + +\newenvironment{IndentPara}[1][1] + {\list{}{\setlength{\leftmargin}{#1\mytab}% + \setlength{\labelwidth}{0pt}% + \setlength{\labelsep}{0pt}% + \setlength{\itemindent}{\parindent}% + \setlength{\listparindent}{\parindent}% + }\item[]}% + {\endlist} +\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}} + +%-- Additional documenting commands -------------------- + +\makeatletter +\def\meta@font@select{\normalfont\slshape} +\makeatother + +\newcommand*{\file}[1]{\texttt{#1}} +\newcommand*{\pkg}[1]{\textsf{#1}} +\newcommand*{\env}[1]{\texttt{#1}} +\newcommand*{\opt}[1]{\texttt{\slshape#1}} +\newcommand*{\RS}{\pkg{refstyle}\xspace} + +\newcommand*{\ArTab}{\>\quad$\rightarrow$\quad} + +%------------------------------------------------------- + +\setlength\hfuzz{15pt} +\hbadness=7000 +\begin{document} + \DocInput{refconfig.dtx} +\end{document} + +% +% \fi +% +% \CheckSum{1098} +% +% \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/04/01}{Initial version} +% \changes{v0.2}{2003/07/30}{Updated version} +% \changes{v0.3}{2006/09/07}{Documentation update} +% \changes{v0.4}{2010/10/21}{Add \cmd{\RSlsttwotxt} for lists} +% \changes{v0.5}{2010/11/02}{Bug fixes} +% +% \DoNotIndex{ +% \",\@chapapp,\@ifpackageloaded,\AtBeginDocument, +% \begingroup,\def,\edef,\else,\endgroup, +% \fi,\ifx, \let, \newcommand,\newref, +% \providecommand,\ProvidesFile,\ref,\relax, +% \renewcommand,\RS@ifundefined,\RS@tmpa,\RS@tmpb, +% \S,\space,\ss,\string,\textup,\unrestored@protected@xdef} +% +%^^A-- Titling -------------------------------------------- +% \GetFileInfo{refstyle.cfg} +% \title{\vskip -2em +% Configuration file for \RS\ package\thanks{ +% This file has version number +% \fileversion, last revised +% \filedate.}} +% \author{Danie Els\\[1ex] +% \small Department of Mechanical and Mechatroncs Engineering\\ +% \small University of Stellenbosch, South Africa.\\ +% \normalsize e-mail: \texttt{dnjels@sun.ac.za}} +% \date{\filedate} +% \maketitle +% +% \tableofcontents +% \clearpage +% +% +% \section{The \RS\ configuration file} +% +% \subsubsection*{Reference templates} +% The default configuration file, \file{refstyle.cfg}, makes the +% following reference declarations: +% \begin{Ipara} +% |\newref{part}{...}| \quad$\rightarrow$ Parts\\ +% |\newref{chap}{...}| \quad$\rightarrow$ Chapters and Appendices\\ +% |\newref{sec}{...} | \quad$\rightarrow$ Sections\\ +% |\newref{eq}{...} | \quad$\rightarrow$ Equations\\ +% |\newref{fig}{...} | \quad$\rightarrow$ Figures\\ +% |\newref{tab}{...} | \quad$\rightarrow$ Tables\\ +% |\newref{fn}{...} | \quad$\rightarrow$ Footnotes +% \end{Ipara} +% If there is a need for more reference types, this standard +% list can be expanded. +% +% \subsubsection*{Language definitions} +% The \RS\ package also provides the following language definitions +% options for references, when loaded together with \pkg{babel}: +% \begin{itemize} +% \item afrikaans +% \item danish +% \item english, USenglish, american, canadian, UKenglish, british +% \item french +% \item german, ngerman, austrian, naustrian +% \item italian +% \item norwegian, nynorsk, norsk, bokmal\footnote{Norwegian Bokm{\aa}l +% is not defined in \pkg{babel} yet.} +% \item portuges, portuguese, brazilian, brazil +% \item swedish +% \end{itemize} +% +% \noindent See \secref[vref]{Thm} for an example of how to link your +% own definitions to an exsiting language setup. +% \StopEventually{\PrintChanges} +% \clearpage +% \section{Implementation} +% \begin{macrocode} +%<*cfg> +% \end{macrocode} +% \subsection{Identification} +% \begin{RSframed} +% \begin{macrocode} +\ProvidesFile{refstyle.cfg}[2010/11/02\space + 0.5\space + Configuration file for refstyle (DNJ Els)] +% \end{macrocode} +% \end{RSframed} +% +% \subsection{Language Definitions for \RS\ Package} +% +% \subsubsection{English} +% +% \begin{macro}{\RSenglish,\RSukenglish} +% Support provided by the author. +% \begin{RSframed} +% \begin{macrocode} +%%-- ENGLISH ------------------------------------ +% \end{macrocode} +% \begin{macrocode} +\newcommand\RSukenglish{% + \def\RSrngtxt{\space to~}%........... Range: figures 5 to 6 + \def\RSlsttwotxt{\space and~}%....... List two: figures 5 and 6 + \def\RSlsttxt{, and~}%............... List more: figures 5, 6, and 7 + \def\RSparttxt{Part~}%............... Part lowercase singular + \def\RSpartstxt{Parts~}%............. lowercase plural + \def\RSParttxt{Part~}%............... uppercase singular (sentence start) + \def\RSPartstxt{Parts~}%............. uppercase plural (sentence start) + \def\RSappendixname{appendix~}%...... Appendix lowercase singular + \def\RSappendicesname{appendices~}%.. lowercase plural + \def\RSAppendixname{Appendix~}%...... uppercase singular (sentence start) + \def\RSAppendicesname{Appendices~}%.. uppercase plural (sentence start) + \def\RSchaptername{chapter~}%........ Chapter lowercase singular + \def\RSchaptersname{chapters~}%...... lowercase plural + \def\RSChaptername{Chapter~}%........ uppercase singular (sentence start) + \def\RSChaptersname{Chapters~}%...... uppercase plural (sentence start) + \def\RSsectxt{section~}%............. Section lowercase singular + \def\RSsecstxt{sections~}%........... lowercase plural + \def\RSSectxt{Section~}%............. uppercase singular (sentence start) + \def\RSSecstxt{Sections~}%........... uppercase plural (sentence start) + \def\RSeqtxt{equation~}%............. Equation lowercase singular + \def\RSeqstxt{equations~}%........... lowercase plural + \def\RSEqtxt{Equation~}%............. uppercase singular (sentence start) + \def\RSEqstxt{Equations~}%........... uppercase plural (sentence start) + \def\RSfigtxt{figure~}%.............. Figure lowercase singular + \def\RSfigstxt{figures~}%............ lowercase plural + \def\RSFigtxt{Figure~}%.............. uppercase singular (sentence start) + \def\RSFigstxt{Figures~}%............ uppercase plural (sentence start) + \def\RStabtxt{table~}%............... Table lowercase singular + \def\RStabstxt{tables~}%............. lowercase plural + \def\RSTabtxt{Table~}%............... uppercase singular (sentence start) + \def\RSTabstxt{Tables~}%............. uppercase plural (sentence start) + \def\RSfootntxt{footnote~}%.......... Footnote lowercase singular + \def\RSfootnstxt{footnotes~}%........ lowercase plural + \def\RSFootntxt{Footnote~}%.......... uppercase singular (sentence start) + \def\RSFootnstxt{Footnotes~}%........ uppercase plural (sentence start) +} +% \end{macrocode} +% \begin{macrocode} +\newcommand\RSenglish{% + \def\RSrngtxt{\space to~}% + \def\RSlsttwotxt{\space and~}% + \def\RSlsttxt{\space and~}% + \def\RSparttxt{Part~}% + \def\RSpartstxt{Parts~}% + \def\RSParttxt{Part~}% + \def\RSPartstxt{Parts~}% + \def\RSappendixname{appendix~}% + \def\RSappendicesname{appendices~}% + \def\RSAppendixname{Appendix~}% + \def\RSAppendicesname{Appendices~}% + \def\RSchaptername{chapter~}% + \def\RSchaptersname{chapters~}% + \def\RSChaptername{Chapter~}% + \def\RSChaptersname{Chapters~}% + \def\RSsectxt{section~}% + \def\RSsecstxt{sections~}% + \def\RSSectxt{Section~}% + \def\RSSecstxt{Sections~}% + \def\RSeqtxt{equation~}% + \def\RSeqstxt{equations~}% + \def\RSEqtxt{Equation~}% + \def\RSEqstxt{Equations~}% + \def\RSfigtxt{figure~}% + \def\RSfigstxt{figures~}% + \def\RSFigtxt{Figure~}% + \def\RSFigstxt{Figures~}% + \def\RStabtxt{table~}% + \def\RStabstxt{tables~}% + \def\RSTabtxt{Table~}% + \def\RSTabstxt{Tables~}% + \def\RSfootntxt{footnote~}% + \def\RSfootnstxt{footnotes~}% + \def\RSFootntxt{Footnote~}% + \def\RSFootnstxt{Footnotes~}% +} +% \end{macrocode} +% \end{RSframed} +% \end{macro} +% +% \noindent Make English the default. +% \begin{RSframed} +% \begin{macrocode} +\RSenglish% Default +% \end{macrocode} +% \end{RSframed} +% +% \noindent Options +% \begin{RSframed} +% \begin{macrocode} +\DeclareLangOpt{english}{\RSenglish} +\DeclareLangOpt{USenglish}{\RSenglish} +\DeclareLangOpt{american}{\RSenglish} +\DeclareLangOpt{canadian}{\RSenglish} +\DeclareLangOpt{UKenglish}{\RSukenglish} +\DeclareLangOpt{british}{\RSukenglish} +% \end{macrocode} +% \end{RSframed} +% +% +% \subsubsection{Afrikaans} +% +% \begin{macro}{\RSafrikaans} +% Support provided by the author. +% \begin{RSframed} +% \begin{macrocode} +%%-- AFRIKAANS ---------------------------------- +% \end{macrocode} +% \begin{macrocode} +\newcommand\RSafrikaans{% + \def\RSrngtxt{\space tot~}% + \def\RSlsttwotxt{\space en~}% + \def\RSlsttxt{\space en~}% + \def\RSparttxt{Deel~}% + \def\RSpartstxt{Dele~}% + \def\RSParttxt{Deel~}% + \def\RSPartstxt{Dele~}% + \def\RSappendixname{bylae~}% + \def\RSappendicesname{bylaes~}% + \def\RSAppendixname{Bylae~}% + \def\RSAppendicesname{Bylaes~}% + \def\RSchaptername{hoofstuk~}% + \def\RSchaptersname{hoofstukke~}% + \def\RSChaptername{Hoofstuk~}% + \def\RSChaptersname{Hoofstukke~}% + \def\RSsectxt{afdeling~}% + \def\RSsecstxt{afdelings~}% + \def\RSSectxt{Afdeling~}% + \def\RSSecstxt{Afdelings~}% + \def\RSeqtxt{vergelyking~}% + \def\RSeqstxt{vergelykings~}% + \def\RSEqtxt{Vergelyking~}% + \def\RSEqstxt{Vergelyking~}% + \def\RSfigtxt{figuur~}% + \def\RSfigstxt{figure~}% + \def\RSFigtxt{Figuur~}% + \def\RSFigstxt{Figure~}% + \def\RStabtxt{tabel~}% + \def\RStabstxt{tabelle~}% + \def\RSTabtxt{Tabel~}% + \def\RSTabstxt{Tabelle~}% + \def\RSfootntxt{footnota~}% + \def\RSfootnstxt{footnotas~}% + \def\RSFootntxt{Footnota~}% + \def\RSFootnstxt{Footnotas~}% +} +% \end{macrocode} +% \end{RSframed} +% \end{macro} +% +% \noindent Options +% \begin{RSframed} +% \begin{macrocode} +\DeclareLangOpt{afrikaans}{\RSafrikaans} +% \end{macrocode} +% \end{RSframed} +% +% +% \subsubsection{Danish} +% +% \begin{macro}{\RSdanish} +% \changes{v0.2}{2003/07/30}{Add Danish language support} +% Thomas Widmann: \texttt{<\,thomas.widmann AT harpercollins DOT co DOT uk>} +% provided the definitions for Danish. +% \begin{RSframed} +% \begin{macrocode} +%%-- DANISH ------------------------------------- +% \end{macrocode} +% \begin{macrocode} +\newcommand\RSdanish{% + \def\RSrngtxt{\space til~}% + \def\RSlsttwotxt{\space og~}% + \def\RSlsttxt{\space og~}% + \def\RSparttxt{del~}% + \def\RSpartstxt{del~}% + \def\RSParttxt{Del~}% + \def\RSPartstxt{Del~}% + \def\RSappendixname{bilag~}% % 'appendiks' is also possible, + \def\RSappendicesname{bilag~}% % but 'bilag' is used in Babel + \def\RSAppendixname{Bilag~}% + \def\RSAppendicesname{Bilag~}% + \def\RSchaptername{kapitel~}% + \def\RSchaptersname{kapitel~}% + \def\RSChaptername{Kapitel~}% + \def\RSChaptersname{Kapitel~}% + \def\RSsectxt{afsnit~}% + \def\RSsecstxt{afsnit~}% + \def\RSSectxt{Afsnit~}% + \def\RSSecstxt{Afsnit~}% + \def\RSeqtxt{ligning~}% + \def\RSeqstxt{ligning~}% + \def\RSEqtxt{Ligning~}% + \def\RSEqstxt{Ligning~}% + \def\RSfigtxt{figur~}% + \def\RSfigstxt{figur~}% + \def\RSFigtxt{Figur~}% + \def\RSFigstxt{Figur~}% + \def\RStabtxt{tabel~}% + \def\RStabstxt{tablel~}% + \def\RSTabtxt{Tabel~}% + \def\RSTabstxt{Tabel~}% + \def\RSfootntxt{fodnote~}% + \def\RSfootnstxt{fodnote~}% + \def\RSFootntxt{Fodnote~}% + \def\RSFootnstxt{Fodnote~}% +} +% \end{macrocode} +% \end{RSframed} +% \end{macro} +% +% \noindent Options +% \begin{RSframed} +% \begin{macrocode} +\DeclareLangOpt{danish}{\RSdanish} +% \end{macrocode} +% \end{RSframed} +% +% +% \subsubsection{French} +% +% \begin{macro}{\RSfrench} +% \changes{v0.4}{2010/10/21}{Add French language support} +% Jean-Pierre Chr\'etien \texttt{<\,jeanpierre.chretien AT free DOT fr>} +% provided the definitions for French. +% \begin{RSframed} +% \begin{macrocode} +%%-- FRENCH ------------------------------------- +% \end{macrocode} +% \begin{macrocode} +\newcommand\RSfrench{% + \def\RSrngtxt{\space \`{a}~}% + \def\RSlsttwotxt{\space et~}% + \def\RSlsttxt{\space et~}% + \def\RSparttxt{partie~}% + \def\RSpartstxt{parties~}% + \def\RSParttxt{La partie~}% + \def\RSPartstxt{Les parties~}% + \def\RSappendixname{appendice~}% + \def\RSappendicesname{appendices~}% + \def\RSAppendixname{L'appendice~}% + \def\RSAppendicesname{Les appendices~}% + \def\RSchaptername{chapitre~}% + \def\RSchaptersname{chapitres~}% + \def\RSChaptername{Le chapitre~}% + \def\RSChaptersname{Les chapitres~}% + \def\RSsectxt{section~}% + \def\RSsecstxt{sections~}% + \def\RSSectxt{La section~}% + \def\RSSecstxt{Les sections~}% + \def\RSeqtxt{\'{e}quation~}% + \def\RSeqstxt{\'{e}quations~}% + \def\RSEqtxt{L'\'{e}quation~}% + \def\RSEqstxt{Les \'{e}quations~}% + \def\RSfigtxt{figure~}% + \def\RSfigstxt{figures~}% + \def\RSFigtxt{La figure~}% + \def\RSFigstxt{Les figures~}% + \def\RStabtxt{tableau~}% + \def\RStabstxt{tableaux~}% + \def\RSTabtxt{Le tableau~}% + \def\RSTabstxt{Les tableaux~}% + \def\RSfootntxt{note~}% + \def\RSfootnstxt{notes~}% + \def\RSFootntxt{La note~}% + \def\RSFootnstxt{Les notes~}% +} +% \end{macrocode} +% \end{RSframed} +% \end{macro} +% +% \noindent Options +% \begin{RSframed} +% \begin{macrocode} +\DeclareLangOpt{french}{\RSfrench} +% \end{macrocode} +% \end{RSframed} +% +% +% +% \subsubsection{German} +% +% \begin{macro}{\RSgerman} +% \changes{v0.2}{2003/07/30}{Add German language support} +% Harald Harders: \texttt{<\,h.harders AT tu-bs DOT de>} +% provided the definitions for German. +% \begin{RSframed} +% \begin{macrocode} +%%-- GERMAN ------------------------------------- +% \end{macrocode} +% \begin{macrocode} +\newcommand\RSgerman{% + \def\RSrngtxt{\space bis~}% + \def\RSlsttwotxt{\space und~}% + \def\RSlsttxt{\space und~}% + \def\RSparttxt{Teil~}% + \def\RSpartstxt{Teile~}% + \def\RSParttxt{Teil~}% + \def\RSPartstxt{Teile~}% + \def\RSappendixname{Anhang~}% + \def\RSappendicesname{Anh\"{a}nge~}% + \def\RSAppendixname{Anhang~}% + \def\RSAppendicesname{Anh\"{a}nge~}% + \def\RSchaptername{Kapitel~}% + \def\RSchaptersname{Kapitel~}% + \def\RSChaptername{Kapitel~}% + \def\RSChaptersname{Kapitel~}% + \def\RSsectxt{Abschnitt~}% + \def\RSsecstxt{Abschnitt~}% + \def\RSSectxt{Abschnitt~}% + \def\RSSecstxt{Abschnitt~}% + \def\RSeqtxt{Gleichung~}% + \def\RSeqstxt{Gleichungen~}% + \def\RSEqtxt{Gleichung~}% + \def\RSEqstxt{Gleichungen~}% + \def\RSfigtxt{Abbildung~}% + \def\RSfigstxt{Abbildung~}% + \def\RSFigtxt{Abbildung~}% + \def\RSFigstxt{Abbildung~}% + \def\RStabtxt{Tabelle~}% + \def\RStabstxt{Tabellen~}% + \def\RSTabtxt{Tabelle~}% + \def\RSTabstxt{Tabellen~}% + \def\RSfootntxt{Fu\ss note~}% + \def\RSfootnstxt{Fu\ss noten~}% + \def\RSFootntxt{Fu\ss note~}% + \def\RSFootnstxt{Fu\ss noten~}% +} +% \end{macrocode} +% \end{RSframed} +% \end{macro} +% +% \noindent Options +% \begin{RSframed} +% \begin{macrocode} +\DeclareLangOpt{german}{\RSgerman} +\DeclareLangOpt{ngerman}{\RSgerman} +\DeclareLangOpt{austrian}{\RSgerman} +\DeclareLangOpt{naustrian}{\RSgerman} +% \end{macrocode} +% \end{RSframed} +% +% +% \subsubsection{Italian} +% +% \begin{macro}{\RSitalian} +% \changes{v0.4}{2010/10/21}{Add Italian language support} +% Nicola Lunghi: \texttt{<\,nick83ola AT gmail DOT com>} +% provided the definitions for Italian. +% \begin{RSframed} +% \begin{macrocode} +%%-- ITALIAN ------------------------------------ +% \end{macrocode} +% \begin{macrocode} +\newcommand\RSitalian{% + \def\RSrngtxt{--}% + \def\RSlsttwotxt{\space e~}% + \def\RSlsttxt{\space e~}% + \def\RSparttxt{Parte~}% + \def\RSpartstxt{Parti~}% + \def\RSParttxt{Parte~}% + \def\RSPartstxt{Parti~}% + \def\RSappendixname{l'appendice~}% + \def\RSappendicesname{le appendici~}% + \def\RSAppendixname{l'Appendice~}% + \def\RSAppendicesname{le Appendici~}% + \def\RSchaptername{il capitolo~}% + \def\RSchaptersname{i capitoli~}% + \def\RSChaptername{il Capitolo~}% + \def\RSChaptersname{i Capitoli~}% + \def\RSsectxt{la sezione~}% + \def\RSsecstxt{le sezioni~}% + \def\RSSectxt{la Sezione~}% + \def\RSSecstxt{la Sezioni~}% + \def\RSeqtxt{l'equazione~}% + \def\RSeqstxt{le equazioni~}% + \def\RSEqtxt{l'Equazione~}% + \def\RSEqstxt{le Equazioni~}% + \def\RSfigtxt{la figura~}% + \def\RSfigstxt{le figure~}% + \def\RSFigtxt{la Figura~}% + \def\RSFigstxt{le Figure~}% + \def\RStabtxt{la tabella~}% + \def\RStabstxt{le tabelle~}% + \def\RSTabtxt{la Tabella~}% + \def\RSTabstxt{le Tabelle~}% + \def\RSfootntxt{la nota~}% + \def\RSfootnstxt{le note~}% + \def\RSFootntxt{la Nota~}% + \def\RSFootnstxt{le Note~}% +} +% \end{macrocode} +% \end{RSframed} +% \end{macro} +% +% \noindent Options +% \begin{RSframed} +% \begin{macrocode} +\DeclareLangOpt{italian}{\RSitalian} +% \end{macrocode} +% \end{RSframed} +% +% +% +% \subsubsection{Norwegian} +% +% \begin{macro}{\RSnorwegian} +% \changes{v0.3}{2006/09/07}{Add Norwegian language support} +% Karl Ove Hufthammer: \texttt{<\,karloh AT mi DOT uib DOT no>} +% provided the definitions for Norwegian. +% +% Norway has two official languages Norwegian Nynorsk and +% Norwegian Bokm{\aa}l (commonly 'nynorsk' and 'norsk' in LaTeX), +% but the \pkg{refstyle} definitions are identically in both variants. +% \begin{RSframed} +% \begin{macrocode} +%%-- NORWEGIAN ------------------------------------- +% \end{macrocode} +% \begin{macrocode} +\newcommand\RSnorwegian{% + \def\RSrngtxt{\space til~}% + \def\RSlsttwotxt{\space og~}% + \def\RSlsttxt{\space og~}% + \def\RSparttxt{del~}% + \def\RSpartstxt{del~}% + \def\RSParttxt{Del~}% + \def\RSPartstxt{Del~}% + \def\RSappendixname{tillegg~}% + \def\RSappendicesname{tillegg~}% + \def\RSAppendixname{Tillegg~}% + \def\RSAppendicesname{Tillegg~}% + \def\RSchaptername{kapittel~}% + \def\RSchaptersname{kapittel~}% + \def\RSChaptername{Kapittel~}% + \def\RSChaptersname{Kapittel~}% + \def\RSsectxt{avsnitt~}% + \def\RSsecstxt{avsnitt~}% + \def\RSSectxt{Avsnitt~}% + \def\RSSecstxt{Avsnitt~}% + \def\RSeqtxt{formel~}% + \def\RSeqstxt{formel~}% + \def\RSEqtxt{Formel~}% + \def\RSEqstxt{Formel~}% + \def\RSfigtxt{figur~}% + \def\RSfigstxt{figur~}% + \def\RSFigtxt{Figur~}% + \def\RSFigstxt{Figur~}% + \def\RStabtxt{tabell~}% + \def\RStabstxt{tabell~}% + \def\RSTabtxt{Tabell~}% + \def\RSTabstxt{Tabell~}% + \def\RSfootntxt{fotnote~}% + \def\RSfootnstxt{fotnote~}% + \def\RSFootntxt{Fotnote~}% + \def\RSFootnstxt{Fotnote~}% +} +% \end{macrocode} +% \end{RSframed} +% \end{macro} +% +% \noindent Options +% \begin{RSframed} +% \begin{macrocode} +\DeclareLangOpt{norwegian}{\RSnorwegian} +\DeclareLangOpt{nynorsk}{\RSnorwegian} +\DeclareLangOpt{bokmal}{\RSnorwegian}% Not in babel yet +\DeclareLangOpt{norsk}{\RSnorwegian} +% \end{macrocode} +% \end{RSframed} +% +% +% \subsubsection{Portuguese/Brazilian} +% +% \begin{macro}{\RSportuguese,\RSbrazilian} +% \changes{v0.4}{2010/10/21}{Add Portuguese language support} +% Bernhard Enders and Flavio Costa \texttt{<\,flaviocosta AT yahoo DOT com DOT br>} +% provided the definitions for Portuguese. +% \begin{RSframed} +% \begin{macrocode} +%%-- PORTUGUESE ----------------------------------- +% \end{macrocode} +% \begin{macrocode} +\newcommand\RSportuguese{% + \def\RSrngtxt{\space a~}% + \def\RSlsttwotxt{\space e~}% + \def\RSlsttxt{\space e~}% + \def\RSparttxt{Parte~}% + \def\RSpartstxt{Partes~}% + \def\RSParttxt{Parte~}% + \def\RSPartstxt{Partes~}% + \def\RSappendixname{ap\^{e}ndice~}% + \def\RSappendicesname{ap\^{e}ndices~}% + \def\RSAppendixname{Ap\^{e}ndice~}% + \def\RSAppendicesname{Ap\^{e}ndices~}% + \def\RSchaptername{cap\'{i}tulo~}% + \def\RSchaptersname{cap\'{i}tulos~}% + \def\RSChaptername{Cap\'{i}tulo~}% + \def\RSChaptersname{Cap\'{i}tulos~}% + \def\RSsectxt{se\c{c}\~{a}o~}% + \def\RSsecstxt{se\c{c}\~{o}es~}% + \def\RSSectxt{Se\c{c}\~{a}o~}% + \def\RSSecstxt{Se\c{c}\~{o}es~}% + \def\RSeqtxt{equa\c{c}\~{a}o~}% + \def\RSeqstxt{equa\c{c}\~{o}es~}% + \def\RSEqtxt{Equa\c{c}\~{a}o~}% + \def\RSEqstxt{Equa\c{c}\~{o}es~}% + \def\RSfigtxt{figura~}% + \def\RSfigstxt{figuras~}% + \def\RSFigtxt{Figura~}% + \def\RSFigstxt{Figuras~}% + \def\RStabtxt{tabela~}% + \def\RStabstxt{tabelas~}% + \def\RSTabtxt{Tabela~}% + \def\RSTabstxt{Tabelas~}% + \def\RSfootntxt{nota de rodap\'{e}~}% + \def\RSfootnstxt{notas de rodap\'{e}~}% + \def\RSFootntxt{Nota de rodap\'{e}~}% + \def\RSFootnstxt{Notas de rodap\'{e}~}% +} +% \end{macrocode} +% \begin{macrocode} +\newcommand\RSbrazilian{% + \def\RSrngtxt{\space a~}% + \def\RSlsttwotxt{\space e~}% + \def\RSlsttxt{\space e~}% + \def\RSparttxt{Parte~}% + \def\RSpartstxt{Partes~}% + \def\RSParttxt{Parte~}% + \def\RSPartstxt{Partes~}% + \def\RSappendixname{ap\^{e}ndice~}% + \def\RSappendicesname{ap\^{e}ndices~}% + \def\RSAppendixname{Ap\^{e}ndice~}% + \def\RSAppendicesname{Ap\^{e}ndices~}% + \def\RSchaptername{cap\'{i}tulo~}% + \def\RSchaptersname{cap\'{i}tulos~}% + \def\RSChaptername{Cap\'{i}tulo~}% + \def\RSChaptersname{Cap\'{i}tulos~}% + \def\RSsectxt{sec\c{c}\~{a}o~}%<--------------- + \def\RSsecstxt{sec\c{c}\~{o}es~}%<------------- + \def\RSSectxt{Sec\c{c}\~{a}o~}%<--------------- + \def\RSSecstxt{Sec\c{c}\~{o}es~}%<------------- + \def\RSeqtxt{equa\c{c}\~{a}o~}% + \def\RSeqstxt{equa\c{c}\~{o}es~}% + \def\RSEqtxt{Equa\c{c}\~{a}o~}% + \def\RSEqstxt{Equa\c{c}\~{o}es~}% + \def\RSfigtxt{figura~}% + \def\RSfigstxt{figuras~}% + \def\RSFigtxt{Figura~}% + \def\RSFigstxt{Figuras~}% + \def\RStabtxt{tabela~}% + \def\RStabstxt{tabelas~}% + \def\RSTabtxt{Tabela~}% + \def\RSTabstxt{Tabelas~}% + \def\RSfootntxt{nota de rodap\'{e}~}% + \def\RSfootnstxt{notas de rodap\'{e}~}% + \def\RSFootntxt{Nota de rodap\'{e}~}% + \def\RSFootnstxt{Notas de rodap\'{e}~}% +} +% \end{macrocode} +% \end{RSframed} +% \end{macro} +% +% \noindent Options +% \begin{RSframed} +% \begin{macrocode} +\DeclareLangOpt{portuges}{\RSportuguese} +\DeclareLangOpt{portuguese}{\RSportuguese} +\DeclareLangOpt{brazilian}{\RSbrazilian} +\DeclareLangOpt{brazil}{\RSbrazilian} +% \end{macrocode} +% \end{RSframed} +% +% +% +% \subsubsection{Swedish} +% +% \begin{macro}{\RSswedish} +% \changes{v0.2}{2003/07/30}{Add Swedish language support} +% Bj\"{o}rn Thors \texttt{<\,bjorn.thors AT alfvenlab DOT kth DOT se>} +% provided the definitions for Swedish. +% \begin{RSframed} +% \begin{macrocode} +%%-- SWEDISH ------------------------------------ +% \end{macrocode} +% \begin{macrocode} +\newcommand\RSswedish{% + \def\RSrngtxt{\space till~}% + \def\RSlsttwotxt{\space och~}% + \def\RSlsttxt{\space och~}% + \def\RSparttxt{del~}% + \def\RSpartstxt{del~}% + \def\RSParttxt{Del~}% + \def\RSPartstxt{Del~}% + \def\RSappendixname{appendix~}% + \def\RSappendicesname{appendix~}% + \def\RSAppendixname{Appendix~}% + \def\RSAppendicesname{Appendix~}% + \def\RSchaptername{kapitel~}% + \def\RSchaptersname{kapitel~}% + \def\RSChaptername{Kapitel~}% + \def\RSChaptersname{Kapitel~}% + \def\RSsectxt{sektion~}% + \def\RSsecstxt{sektion~}% + \def\RSSectxt{Sektion~}% + \def\RSSecstxt{Sektion~}% + \def\RSeqtxt{ekvation~}% + \def\RSeqstxt{ekvation~}% + \def\RSEqtxt{Ekvation~}% + \def\RSEqstxt{Ekvation~}% + \def\RSfigtxt{figur~}% + \def\RSfigstxt{figur~}% + \def\RSFigtxt{Figur~}% + \def\RSFigstxt{Figur~}% + \def\RStabtxt{tabell~}% + \def\RStabstxt{tabell~}% + \def\RSTabtxt{Tabell~}% + \def\RSTabstxt{Tabell~}% + \def\RSfootntxt{fotnot~}% + \def\RSfootnstxt{fotnot~}% + \def\RSFootntxt{Fotnot~}% + \def\RSFootnstxt{Fotnot~}% +} +% \end{macrocode} +% \end{RSframed} +% \end{macro} +% \noindent Options +% \begin{RSframed} +% \begin{macrocode} +\DeclareLangOpt{swedish}{\RSswedish} +% \end{macrocode} +% \end{RSframed} +% +% +% +% +% \subsection{Templates for the \RS Package} +% +% The user can also define his or her own templates and put it +% in a separate configuration file to ensure uniformity +% of reference formats in your documents. +% +% \subsubsection{Parts} +% +% References to parts are usually straight forward, except that the +% document division ``Part'' must be distinguished from the normal +% usage of the word ``part'' in a sentence. A personal preference +% is to use small caps. +% +% \begin{RSframed} +% \begin{macrocode} +%%-- TEMPLATE FOR PARTS ------------------------- +% \end{macrocode} +% \begin{macrocode} + \newref{part}{% + name = \RSparttxt, + names = \RSpartstxt, + Name = \RSPparttxt, + Names = \RSPartstxt, + rngtxt = \RSrngtxt, + lsttxt = \RSlsttxt} +% \end{macrocode} +% \end{RSframed} +% +% +% +% \subsubsection{Chapters and Appendices} +% +% A major problem with a reference to a chapter is that at the time +% when the reference label, |\label|\marg{chap-label}, is created, +% it is unknown whether it would eventually ends up in the main +% matter or the appendix part of a book or report. +% +% A simple solution is to use the prefix to the \meta{chapter} +% counter, |\p@chapter|, to write the definition of |\@chapapp| to +% the auxiliary file (|.aux|) together with information of the +% label. The command |\@chapapp| expands to either |\chaptername| or +% |\appendixname| depending on whether the reference label is +% defined in the main matter or after the |\appendix| was called. +% (Note that |\@chapapp| is not defined in the AMS book class.) +% +% \begin{Ipara} +% |\renewcommand*{\p@chapter}{\string\chname{\@chapapp}}|\\ +% |\newcommand*{\chname}[1]{}%<-make it harmless |\\ +% |\newcommand*{\chapref}[1]{{\renewcommand*{\chname}[1]{##1~}\ref{#1}}}| +% \end{Ipara} +% +% \noindent The reference to a chapter, |\chapref|\marg{chap-label}, +% will then be prefixed with |\chaptername| or |\appendixname| and +% it does not matter where it was defined or where it was called. +% +% To utilize the full functionality of the \RS package for +% references to chapters and appendices, a complex form of +% \cmd{\newref} needs to be implemented. +% The following is a template for a book or report classes. +% +% +% \begin{RSframed} +% \begin{macrocode} +%%-- TEMPLATE FOR CHAPTERS & APPENDIXES --------- +% \end{macrocode} +% Prevent crashes for non-book type classes. +% \begin{macrocode} +\providecommand*{\p@chapter}{} +% \end{macrocode} +% Add \cmd{\@chapapp} to \cmd{\p@chapter} for writeout to auxiliary file. +% If an AMS book class is loaded, then \cmd{\chaptername} must +% be used. +% \begin{macrocode} +\AtBeginDocument{% + \RS@ifundefined{chapter}{}{% + \RS@ifundefined{@chapapp}% + {\renewcommand*{\p@chapter}{\string\chpname{\chaptername}}}%AMS + {\renewcommand*{\p@chapter}{\string\chpname{\@chapapp}}}% Normal + }% + } +% \end{macrocode} +% Define \cmd{\chpname} to gobble its contents outside the +% reference commands. +% \begin{macrocode} +\newcommand*{\chpname}[1]{} +% \end{macrocode} +% Define the \cmd{\RSchpname} to typeset all the different +% perturbations of chapter and appendix names. +% Use the conditionals to switch between the +% different options. +% +% \begin{macrocode} +\newcommand*{\RS@chpname}[1]{% + \ifRSnameon + \edef\RS@tmpa{#1}% + \edef\RS@tmpb{\appendixname}% + \ifx\RS@tmpa\RS@tmpb\relax% + \ifRSplural + \ifRScapname \RSAppendicesname \else \RSappendicesname \fi + \else + \ifRScapname \RSAppendixname \else \RSappendixname \fi + \fi + \else + \ifRSplural + \ifRScapname \RSChaptersname \else \RSchaptersname \fi + \else + \ifRScapname \RSChaptername \else \RSchaptername \fi + \fi + \fi + \fi} +% \end{macrocode} +% Define the \cmd{\newref} for chapters. +% \begin{macrocode} + \newref{chap}{% + refcmd = {{\let\chpname=\RS@chpname\ref{#1}}}, + rngtxt = \RSrngtxt, + lsttwotxt = \RSlsttwotxt, + lsttxt = \RSlsttxt} +% \end{macrocode} +% \end{RSframed} +% +% +% \subsubsection{Sections and paragraphs}\seclabel{secTempl} +% +% A template for references to sections is given below. References +% to paragraphs are similar and is left as an exercise to the users. +% +% \begin{RSframed} +% \begin{macrocode} +%%-- TEMPLATE FOR SECTIONS ---------------------- +% \end{macrocode} +% \begin{macrocode} + \newref{sec}{% + name = \RSsectxt, + names = \RSsecstxt, + Name = \RSSectxt, + Names = \RSSecstxt, + refcmd = {\S\ref{#1}}, + rngtxt = \RSrngtxt, + lsttwotxt = \RSlsttwotxt, + lsttxt = \RSlsttxt} +% \end{macrocode} +% \end{RSframed} +% +% \subsubsection{Equations}\seclabel{EqTempl} +% +% The equation number in references to equations are traditionally +% written in an upright text, irrespective of the surrounding text. +% +% \begin{RSframed} +% \begin{macrocode} +%%-- TEMPLATE FOR EQUATIONS --------------------- +% \end{macrocode} +% The standard equation ref format if \pkg{amsmath.sty} is not loaded. +% \begin{macrocode} +\newcommand*{\RSeqrefform}[1]{\textup{(\ref{#1})}} +% \end{macrocode} +% If \pkg{amsmath.sty} is loaded, store \cmd{\eqref} +% and then undefine it before the template is created. +% \begin{macrocode} +\@ifpackageloaded{amsmath}% + {\let\AMSeqref\eqref + \let\eqref\relax}% + {} +% \end{macrocode} +% \begin{macrocode} +\newref{eq}{% + name = \RSeqtxt, + names = \RSeqstxt, + Name = \RSEqtxt, + Names = \RSEqstxt, + refcmd = \RSeqrefform{#1}, + rngtxt = \RSrngtxt, + lsttwotxt = \RSlsttwotxt, + lsttxt = \RSlsttxt} +% \end{macrocode} +% Make way for \pkg{amsmath.sty} definitions +% \begin{macrocode} +\let\RSeqref\eqref +\let\eqref\relax +% \end{macrocode} +% Some footwork to bring the AMS definition of +% \cmd{\eqref} back if \pkg{amsmath.sty} is loaded +% afterwards. +% \begin{macrocode} +\AtBeginDocument{% + \@ifpackageloaded{amsmath}% + {\RS@ifundefined{AMSeqref}{\let\AMSeqref\eqref}{}% + \let\RSeqrefform\AMSeqref}% + {}% + \let\eqref=\RSeqref + } +% \end{macrocode} +% \end{RSframed} +% +% +% \subsubsection{Figures and Tables}\seclabel{tabtemp} +% References to figures and tables are usually +% straight forward. +% \begin{RSframed} +% \begin{macrocode} +%%-- TEMPLATE FOR FIGURES ----------------------- +% \end{macrocode} +% \begin{macrocode} + \newref{fig}{% + name = \RSfigtxt, + names = \RSfigstxt, + Name = \RSFigtxt, + Names = \RSFigstxt, + rngtxt = \RSrngtxt, + lsttwotxt = \RSlsttwotxt, + lsttxt = \RSlsttxt} +% \end{macrocode} +% \end{RSframed} +% +% \begin{RSframed} +% \begin{macrocode} +%%-- TEMPLATE FOR TABLES ------------------------ +% \end{macrocode} +% \begin{macrocode} + \newref{tab}{% + name = \RStabtxt, + names = \RStabstxt, + Name = \RSTabtxt, + Names = \RSTabstxt, + rngtxt = \RSrngtxt, + lsttwotxt = \RSlsttwotxt, + lsttxt = \RSlsttxt} +% \end{macrocode} +% \end{RSframed} +% +% \pagebreak[2] +% \subsubsection{Footnotes}\seclabel{fnTempl} +% +% A reference to a footnote differs from other references in that +% it is only defined inside the footnote definition itself: +% \begin{Ipara} +% |\footnote{This is a footnote with ... \label{fn:xx}}| +% \end{Ipara} +% It can then be referred to with |\ref{fn:xx}|. +% +% A useful application of the \RS package is for references to +% footnotes, were you need a duplicate footnote mark that refers to +% a previously defined footnote.\footnote{^^A +% This is a footnote with \cmd{\fnlabel}\texttt{\{xx\}} ...\fnlabel{xx}} +% You can use the stared form of the reference +% command to format the reference as a footnote mark, while the +% reference commands without a star behave as normal. +% \begin{Itabb} +% \hspace*{2cm}\=\kill +% |\fnref*{xx}| \ArTab \fnref*{xx}\\ +% |\fnref{xx}| \ArTab \fnref{xx}\\ +% \end{Itabb} +% +% \begin{RSframed} +% \begin{macrocode} +%%-- TEMPLATE FOR FOOTNOTES --------------------- +% \end{macrocode} +% Define the \cmd{\RSfnmark} to reproduce the footnote mark. +% Use the |\ifRSstar| conditional to switch between a superscripted +% and a normal reference. +% \begin{macrocode} + \newcommand{\RSfnmark}[1]{% + \begingroup + \unrestored@protected@xdef\@thefnmark{\ref{#1}}% + \endgroup + \@footnotemark} +% \end{macrocode} +% \begin{macrocode} + \newref{fn}{% + name = \RSfootntxt, + names = \RSfootnstxt, + Name = \RSFootntxt, + Names = \RSFootnstxt, + refcmd = {\ifRSstar\RSfnmark{#1}\else(\ref{#1})\fi}, + rngtxt = \RSrngtxt, + lsttwotxt = \RSlsttwotxt, + lsttxt = \RSlsttxt} +% \end{macrocode} +% \end{RSframed} +% +% \subsubsection{Enumerated lists} +% +% A reference to an item in an enumerated list can be obtained +% by placing the labelling command after the \cmd{\item} command +% inside the list. The second level numbering of the \cmd{\ref} +% label in the standard \LaTeX{} is: 2a, 2b, etc. +% +% If you want to change the reference labels to 2(a), 2(b), +% etc., without effecting the display in the \env{enumerate} +% environment, you can make the following redefinition: +% \begin{Ipara} +% |\makeatletter|\\ +% |\renewcommand{\p@enumii}{\expandafter\p@@enumii}|\\ +% |\newcommand{\p@@enumii}[1]{\theenumi(#1)}|\\ +% |\makeatother| +% \end{Ipara} +% The contents of the \cmd{\@currentlable} is then +% \begin{Ipara} +% |{\expandafter\p@@enumii\theenumii}| ~$\rightarrow$~ +% |{\theenumi(\theenumii)}| +% \end{Ipara} +% +% Writing a template for enumerated lists is left to the user. +% +% +% \subsubsection{Theorems, lemmas, etc.}\seclabel{Thm} +% +% There exists many perturbations to the theorem environment such +% as, Theorem, Lemma, Exercise, etc., and it is left to the user as +% an exercise to construct his or her own templates. +% +% As an example to add reference for theorems to an exiting setup: +% +% \begin{Ipara} +% |\usepackage{refstyle} |\\ +% |\newref{thm}{ |\\ +% | name = {theorem~}, |\\ +% | names = {theorems~},|\\ +% | Name = {Theorem~}, |\\ +% | Names = {Theorems~},|\\ +% | rngtxt = \RSrngtxt,|\\ +% | lsttwotxt = \RSlsttxt,|\\ +% | lsttxt = \RSlsttxt}| +% \end{Ipara} +% +% If you want to add it to a specific language setup with \pkg{babel} then +% you can do the following, for example for a dual language document with +% English and Norwegian: +% \begin{Ipara} +% |\documentclass[english, norwegian]{article}% NB: Languages as global opts! |\\ +% |\usepackage{babel} %Use global languages |\\ +% |\usepackage{varioref} %Use global languages |\\ +% |\usepackage{refstyle} %Use global languages |\\ +% |\RSaddto{\RSnorwegian}{% |\\ +% | \def\RSthmtxt{teorem~}% |\\ +% | \def\RSthmstxt{teorem~}% |\\ +% | \def\RSThmtxt{Teorem~}% |\\ +% | \def\RSThmstxt{Teorem~}} |\\ +% |\RSaddto{\RSenglish}{% |\\ +% | \def\RSthmtxt{theorem~}% |\\ +% | \def\RSthmstxt{theorems~}% |\\ +% | \def\RSThmtxt{Theorem~}% |\\ +% | \def\RSThmstxt{Theorems~}} |\\ +% |\newref{thm}{ |\\ +% | name = \RSthmtxt, |\\ +% | names = \RSthmstxt, |\\ +% | Name = \RSThmtxt, |\\ +% | Names = \RSThmstxt, |\\ +% | rngtxt = \RSrngtxt, |\\ +% | lsttwotxt = \RSlsttxt, |\\ +% | lsttxt = \RSlsttwotxt} | +% \end{Ipara} +% +% \noindent All \pkg{babel} language changes will then activate +% the proper code setup. In this example the \pkg{refstyle} +% mechanism is used where the code is appended to the |\RSenglish| +% and |\RSnorwegian| container functions. These functions are added +% by the package +% to the \pkg{babel} containers |\extrasenglish| and |\extrasnorwegian|, +% that is called every time a language change occurs. +% Please see the contents of \pkg{refstyle.cfg} for the names of the +% \pkg{refstyle} containers associated with the different languages. +% +% Note that the extended definitions +% can also be added directly to the \pkg{babel} containers without using +% \pkg{refstyle}'s mechanism. +% +% \begin{macrocode} +% +% \end{macrocode} +% +% \Finale +\endinput diff --git a/macros/latex/contrib/refstyle/refconfig.pdf b/macros/latex/contrib/refstyle/refconfig.pdf new file mode 100644 index 0000000000..f4dcb8d15a Binary files /dev/null and b/macros/latex/contrib/refstyle/refconfig.pdf differ diff --git a/macros/latex/contrib/refstyle/refstyle.cfg b/macros/latex/contrib/refstyle/refstyle.cfg new file mode 100644 index 0000000000..2ca7d62dd2 --- /dev/null +++ b/macros/latex/contrib/refstyle/refstyle.cfg @@ -0,0 +1,571 @@ +%% +%% This is file `refstyle.cfg', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% refconfig.dtx (with options: `cfg') +%% +%% ------------------------------------------------------------------- +%% The refstyle package +%% for the formatting of references +%% ------------------------------------------------------------------- +%% This file may be customized to suit specific user requirements. +%% +%% Original by Danie Els +%% ------------------------------------------------------------------- +%% +\ProvidesFile{refstyle.cfg}[2010/11/02\space + 0.5\space + Configuration file for refstyle (DNJ Els)] +%%-- ENGLISH ------------------------------------ +\newcommand\RSukenglish{% + \def\RSrngtxt{\space to~}%........... Range: figures 5 to 6 + \def\RSlsttwotxt{\space and~}%....... List two: figures 5 and 6 + \def\RSlsttxt{, and~}%............... List more: figures 5, 6, and 7 + \def\RSparttxt{Part~}%............... Part lowercase singular + \def\RSpartstxt{Parts~}%............. lowercase plural + \def\RSParttxt{Part~}%............... uppercase singular (sentence start) + \def\RSPartstxt{Parts~}%............. uppercase plural (sentence start) + \def\RSappendixname{appendix~}%...... Appendix lowercase singular + \def\RSappendicesname{appendices~}%.. lowercase plural + \def\RSAppendixname{Appendix~}%...... uppercase singular (sentence start) + \def\RSAppendicesname{Appendices~}%.. uppercase plural (sentence start) + \def\RSchaptername{chapter~}%........ Chapter lowercase singular + \def\RSchaptersname{chapters~}%...... lowercase plural + \def\RSChaptername{Chapter~}%........ uppercase singular (sentence start) + \def\RSChaptersname{Chapters~}%...... uppercase plural (sentence start) + \def\RSsectxt{section~}%............. Section lowercase singular + \def\RSsecstxt{sections~}%........... lowercase plural + \def\RSSectxt{Section~}%............. uppercase singular (sentence start) + \def\RSSecstxt{Sections~}%........... uppercase plural (sentence start) + \def\RSeqtxt{equation~}%............. Equation lowercase singular + \def\RSeqstxt{equations~}%........... lowercase plural + \def\RSEqtxt{Equation~}%............. uppercase singular (sentence start) + \def\RSEqstxt{Equations~}%........... uppercase plural (sentence start) + \def\RSfigtxt{figure~}%.............. Figure lowercase singular + \def\RSfigstxt{figures~}%............ lowercase plural + \def\RSFigtxt{Figure~}%.............. uppercase singular (sentence start) + \def\RSFigstxt{Figures~}%............ uppercase plural (sentence start) + \def\RStabtxt{table~}%............... Table lowercase singular + \def\RStabstxt{tables~}%............. lowercase plural + \def\RSTabtxt{Table~}%............... uppercase singular (sentence start) + \def\RSTabstxt{Tables~}%............. uppercase plural (sentence start) + \def\RSfootntxt{footnote~}%.......... Footnote lowercase singular + \def\RSfootnstxt{footnotes~}%........ lowercase plural + \def\RSFootntxt{Footnote~}%.......... uppercase singular (sentence start) + \def\RSFootnstxt{Footnotes~}%........ uppercase plural (sentence start) +} +\newcommand\RSenglish{% + \def\RSrngtxt{\space to~}% + \def\RSlsttwotxt{\space and~}% + \def\RSlsttxt{\space and~}% + \def\RSparttxt{Part~}% + \def\RSpartstxt{Parts~}% + \def\RSParttxt{Part~}% + \def\RSPartstxt{Parts~}% + \def\RSappendixname{appendix~}% + \def\RSappendicesname{appendices~}% + \def\RSAppendixname{Appendix~}% + \def\RSAppendicesname{Appendices~}% + \def\RSchaptername{chapter~}% + \def\RSchaptersname{chapters~}% + \def\RSChaptername{Chapter~}% + \def\RSChaptersname{Chapters~}% + \def\RSsectxt{section~}% + \def\RSsecstxt{sections~}% + \def\RSSectxt{Section~}% + \def\RSSecstxt{Sections~}% + \def\RSeqtxt{equation~}% + \def\RSeqstxt{equations~}% + \def\RSEqtxt{Equation~}% + \def\RSEqstxt{Equations~}% + \def\RSfigtxt{figure~}% + \def\RSfigstxt{figures~}% + \def\RSFigtxt{Figure~}% + \def\RSFigstxt{Figures~}% + \def\RStabtxt{table~}% + \def\RStabstxt{tables~}% + \def\RSTabtxt{Table~}% + \def\RSTabstxt{Tables~}% + \def\RSfootntxt{footnote~}% + \def\RSfootnstxt{footnotes~}% + \def\RSFootntxt{Footnote~}% + \def\RSFootnstxt{Footnotes~}% +} +\RSenglish% Default +\DeclareLangOpt{english}{\RSenglish} +\DeclareLangOpt{USenglish}{\RSenglish} +\DeclareLangOpt{american}{\RSenglish} +\DeclareLangOpt{canadian}{\RSenglish} +\DeclareLangOpt{UKenglish}{\RSukenglish} +\DeclareLangOpt{british}{\RSukenglish} +%%-- AFRIKAANS ---------------------------------- +\newcommand\RSafrikaans{% + \def\RSrngtxt{\space tot~}% + \def\RSlsttwotxt{\space en~}% + \def\RSlsttxt{\space en~}% + \def\RSparttxt{Deel~}% + \def\RSpartstxt{Dele~}% + \def\RSParttxt{Deel~}% + \def\RSPartstxt{Dele~}% + \def\RSappendixname{bylae~}% + \def\RSappendicesname{bylaes~}% + \def\RSAppendixname{Bylae~}% + \def\RSAppendicesname{Bylaes~}% + \def\RSchaptername{hoofstuk~}% + \def\RSchaptersname{hoofstukke~}% + \def\RSChaptername{Hoofstuk~}% + \def\RSChaptersname{Hoofstukke~}% + \def\RSsectxt{afdeling~}% + \def\RSsecstxt{afdelings~}% + \def\RSSectxt{Afdeling~}% + \def\RSSecstxt{Afdelings~}% + \def\RSeqtxt{vergelyking~}% + \def\RSeqstxt{vergelykings~}% + \def\RSEqtxt{Vergelyking~}% + \def\RSEqstxt{Vergelyking~}% + \def\RSfigtxt{figuur~}% + \def\RSfigstxt{figure~}% + \def\RSFigtxt{Figuur~}% + \def\RSFigstxt{Figure~}% + \def\RStabtxt{tabel~}% + \def\RStabstxt{tabelle~}% + \def\RSTabtxt{Tabel~}% + \def\RSTabstxt{Tabelle~}% + \def\RSfootntxt{footnota~}% + \def\RSfootnstxt{footnotas~}% + \def\RSFootntxt{Footnota~}% + \def\RSFootnstxt{Footnotas~}% +} +\DeclareLangOpt{afrikaans}{\RSafrikaans} +%%-- DANISH ------------------------------------- +\newcommand\RSdanish{% + \def\RSrngtxt{\space til~}% + \def\RSlsttwotxt{\space og~}% + \def\RSlsttxt{\space og~}% + \def\RSparttxt{del~}% + \def\RSpartstxt{del~}% + \def\RSParttxt{Del~}% + \def\RSPartstxt{Del~}% + \def\RSappendixname{bilag~}% % 'appendiks' is also possible, + \def\RSappendicesname{bilag~}% % but 'bilag' is used in Babel + \def\RSAppendixname{Bilag~}% + \def\RSAppendicesname{Bilag~}% + \def\RSchaptername{kapitel~}% + \def\RSchaptersname{kapitel~}% + \def\RSChaptername{Kapitel~}% + \def\RSChaptersname{Kapitel~}% + \def\RSsectxt{afsnit~}% + \def\RSsecstxt{afsnit~}% + \def\RSSectxt{Afsnit~}% + \def\RSSecstxt{Afsnit~}% + \def\RSeqtxt{ligning~}% + \def\RSeqstxt{ligning~}% + \def\RSEqtxt{Ligning~}% + \def\RSEqstxt{Ligning~}% + \def\RSfigtxt{figur~}% + \def\RSfigstxt{figur~}% + \def\RSFigtxt{Figur~}% + \def\RSFigstxt{Figur~}% + \def\RStabtxt{tabel~}% + \def\RStabstxt{tablel~}% + \def\RSTabtxt{Tabel~}% + \def\RSTabstxt{Tabel~}% + \def\RSfootntxt{fodnote~}% + \def\RSfootnstxt{fodnote~}% + \def\RSFootntxt{Fodnote~}% + \def\RSFootnstxt{Fodnote~}% +} +\DeclareLangOpt{danish}{\RSdanish} +%%-- FRENCH ------------------------------------- +\newcommand\RSfrench{% + \def\RSrngtxt{\space \`{a}~}% + \def\RSlsttwotxt{\space et~}% + \def\RSlsttxt{\space et~}% + \def\RSparttxt{partie~}% + \def\RSpartstxt{parties~}% + \def\RSParttxt{La partie~}% + \def\RSPartstxt{Les parties~}% + \def\RSappendixname{appendice~}% + \def\RSappendicesname{appendices~}% + \def\RSAppendixname{L'appendice~}% + \def\RSAppendicesname{Les appendices~}% + \def\RSchaptername{chapitre~}% + \def\RSchaptersname{chapitres~}% + \def\RSChaptername{Le chapitre~}% + \def\RSChaptersname{Les chapitres~}% + \def\RSsectxt{section~}% + \def\RSsecstxt{sections~}% + \def\RSSectxt{La section~}% + \def\RSSecstxt{Les sections~}% + \def\RSeqtxt{\'{e}quation~}% + \def\RSeqstxt{\'{e}quations~}% + \def\RSEqtxt{L'\'{e}quation~}% + \def\RSEqstxt{Les \'{e}quations~}% + \def\RSfigtxt{figure~}% + \def\RSfigstxt{figures~}% + \def\RSFigtxt{La figure~}% + \def\RSFigstxt{Les figures~}% + \def\RStabtxt{tableau~}% + \def\RStabstxt{tableaux~}% + \def\RSTabtxt{Le tableau~}% + \def\RSTabstxt{Les tableaux~}% + \def\RSfootntxt{note~}% + \def\RSfootnstxt{notes~}% + \def\RSFootntxt{La note~}% + \def\RSFootnstxt{Les notes~}% +} +\DeclareLangOpt{french}{\RSfrench} +%%-- GERMAN ------------------------------------- +\newcommand\RSgerman{% + \def\RSrngtxt{\space bis~}% + \def\RSlsttwotxt{\space und~}% + \def\RSlsttxt{\space und~}% + \def\RSparttxt{Teil~}% + \def\RSpartstxt{Teile~}% + \def\RSParttxt{Teil~}% + \def\RSPartstxt{Teile~}% + \def\RSappendixname{Anhang~}% + \def\RSappendicesname{Anh\"{a}nge~}% + \def\RSAppendixname{Anhang~}% + \def\RSAppendicesname{Anh\"{a}nge~}% + \def\RSchaptername{Kapitel~}% + \def\RSchaptersname{Kapitel~}% + \def\RSChaptername{Kapitel~}% + \def\RSChaptersname{Kapitel~}% + \def\RSsectxt{Abschnitt~}% + \def\RSsecstxt{Abschnitt~}% + \def\RSSectxt{Abschnitt~}% + \def\RSSecstxt{Abschnitt~}% + \def\RSeqtxt{Gleichung~}% + \def\RSeqstxt{Gleichungen~}% + \def\RSEqtxt{Gleichung~}% + \def\RSEqstxt{Gleichungen~}% + \def\RSfigtxt{Abbildung~}% + \def\RSfigstxt{Abbildung~}% + \def\RSFigtxt{Abbildung~}% + \def\RSFigstxt{Abbildung~}% + \def\RStabtxt{Tabelle~}% + \def\RStabstxt{Tabellen~}% + \def\RSTabtxt{Tabelle~}% + \def\RSTabstxt{Tabellen~}% + \def\RSfootntxt{Fu\ss note~}% + \def\RSfootnstxt{Fu\ss noten~}% + \def\RSFootntxt{Fu\ss note~}% + \def\RSFootnstxt{Fu\ss noten~}% +} +\DeclareLangOpt{german}{\RSgerman} +\DeclareLangOpt{ngerman}{\RSgerman} +\DeclareLangOpt{austrian}{\RSgerman} +\DeclareLangOpt{naustrian}{\RSgerman} +%%-- ITALIAN ------------------------------------ +\newcommand\RSitalian{% + \def\RSrngtxt{--}% + \def\RSlsttwotxt{\space e~}% + \def\RSlsttxt{\space e~}% + \def\RSparttxt{Parte~}% + \def\RSpartstxt{Parti~}% + \def\RSParttxt{Parte~}% + \def\RSPartstxt{Parti~}% + \def\RSappendixname{l'appendice~}% + \def\RSappendicesname{le appendici~}% + \def\RSAppendixname{l'Appendice~}% + \def\RSAppendicesname{le Appendici~}% + \def\RSchaptername{il capitolo~}% + \def\RSchaptersname{i capitoli~}% + \def\RSChaptername{il Capitolo~}% + \def\RSChaptersname{i Capitoli~}% + \def\RSsectxt{la sezione~}% + \def\RSsecstxt{le sezioni~}% + \def\RSSectxt{la Sezione~}% + \def\RSSecstxt{la Sezioni~}% + \def\RSeqtxt{l'equazione~}% + \def\RSeqstxt{le equazioni~}% + \def\RSEqtxt{l'Equazione~}% + \def\RSEqstxt{le Equazioni~}% + \def\RSfigtxt{la figura~}% + \def\RSfigstxt{le figure~}% + \def\RSFigtxt{la Figura~}% + \def\RSFigstxt{le Figure~}% + \def\RStabtxt{la tabella~}% + \def\RStabstxt{le tabelle~}% + \def\RSTabtxt{la Tabella~}% + \def\RSTabstxt{le Tabelle~}% + \def\RSfootntxt{la nota~}% + \def\RSfootnstxt{le note~}% + \def\RSFootntxt{la Nota~}% + \def\RSFootnstxt{le Note~}% +} +\DeclareLangOpt{italian}{\RSitalian} +%%-- NORWEGIAN ------------------------------------- +\newcommand\RSnorwegian{% + \def\RSrngtxt{\space til~}% + \def\RSlsttwotxt{\space og~}% + \def\RSlsttxt{\space og~}% + \def\RSparttxt{del~}% + \def\RSpartstxt{del~}% + \def\RSParttxt{Del~}% + \def\RSPartstxt{Del~}% + \def\RSappendixname{tillegg~}% + \def\RSappendicesname{tillegg~}% + \def\RSAppendixname{Tillegg~}% + \def\RSAppendicesname{Tillegg~}% + \def\RSchaptername{kapittel~}% + \def\RSchaptersname{kapittel~}% + \def\RSChaptername{Kapittel~}% + \def\RSChaptersname{Kapittel~}% + \def\RSsectxt{avsnitt~}% + \def\RSsecstxt{avsnitt~}% + \def\RSSectxt{Avsnitt~}% + \def\RSSecstxt{Avsnitt~}% + \def\RSeqtxt{formel~}% + \def\RSeqstxt{formel~}% + \def\RSEqtxt{Formel~}% + \def\RSEqstxt{Formel~}% + \def\RSfigtxt{figur~}% + \def\RSfigstxt{figur~}% + \def\RSFigtxt{Figur~}% + \def\RSFigstxt{Figur~}% + \def\RStabtxt{tabell~}% + \def\RStabstxt{tabell~}% + \def\RSTabtxt{Tabell~}% + \def\RSTabstxt{Tabell~}% + \def\RSfootntxt{fotnote~}% + \def\RSfootnstxt{fotnote~}% + \def\RSFootntxt{Fotnote~}% + \def\RSFootnstxt{Fotnote~}% +} +\DeclareLangOpt{norwegian}{\RSnorwegian} +\DeclareLangOpt{nynorsk}{\RSnorwegian} +\DeclareLangOpt{bokmal}{\RSnorwegian}% Not in babel yet +\DeclareLangOpt{norsk}{\RSnorwegian} +%%-- PORTUGUESE ----------------------------------- +\newcommand\RSportuguese{% + \def\RSrngtxt{\space a~}% + \def\RSlsttwotxt{\space e~}% + \def\RSlsttxt{\space e~}% + \def\RSparttxt{Parte~}% + \def\RSpartstxt{Partes~}% + \def\RSParttxt{Parte~}% + \def\RSPartstxt{Partes~}% + \def\RSappendixname{ap\^{e}ndice~}% + \def\RSappendicesname{ap\^{e}ndices~}% + \def\RSAppendixname{Ap\^{e}ndice~}% + \def\RSAppendicesname{Ap\^{e}ndices~}% + \def\RSchaptername{cap\'{i}tulo~}% + \def\RSchaptersname{cap\'{i}tulos~}% + \def\RSChaptername{Cap\'{i}tulo~}% + \def\RSChaptersname{Cap\'{i}tulos~}% + \def\RSsectxt{se\c{c}\~{a}o~}% + \def\RSsecstxt{se\c{c}\~{o}es~}% + \def\RSSectxt{Se\c{c}\~{a}o~}% + \def\RSSecstxt{Se\c{c}\~{o}es~}% + \def\RSeqtxt{equa\c{c}\~{a}o~}% + \def\RSeqstxt{equa\c{c}\~{o}es~}% + \def\RSEqtxt{Equa\c{c}\~{a}o~}% + \def\RSEqstxt{Equa\c{c}\~{o}es~}% + \def\RSfigtxt{figura~}% + \def\RSfigstxt{figuras~}% + \def\RSFigtxt{Figura~}% + \def\RSFigstxt{Figuras~}% + \def\RStabtxt{tabela~}% + \def\RStabstxt{tabelas~}% + \def\RSTabtxt{Tabela~}% + \def\RSTabstxt{Tabelas~}% + \def\RSfootntxt{nota de rodap\'{e}~}% + \def\RSfootnstxt{notas de rodap\'{e}~}% + \def\RSFootntxt{Nota de rodap\'{e}~}% + \def\RSFootnstxt{Notas de rodap\'{e}~}% +} +\newcommand\RSbrazilian{% + \def\RSrngtxt{\space a~}% + \def\RSlsttwotxt{\space e~}% + \def\RSlsttxt{\space e~}% + \def\RSparttxt{Parte~}% + \def\RSpartstxt{Partes~}% + \def\RSParttxt{Parte~}% + \def\RSPartstxt{Partes~}% + \def\RSappendixname{ap\^{e}ndice~}% + \def\RSappendicesname{ap\^{e}ndices~}% + \def\RSAppendixname{Ap\^{e}ndice~}% + \def\RSAppendicesname{Ap\^{e}ndices~}% + \def\RSchaptername{cap\'{i}tulo~}% + \def\RSchaptersname{cap\'{i}tulos~}% + \def\RSChaptername{Cap\'{i}tulo~}% + \def\RSChaptersname{Cap\'{i}tulos~}% + \def\RSsectxt{sec\c{c}\~{a}o~}%<--------------- + \def\RSsecstxt{sec\c{c}\~{o}es~}%<------------- + \def\RSSectxt{Sec\c{c}\~{a}o~}%<--------------- + \def\RSSecstxt{Sec\c{c}\~{o}es~}%<------------- + \def\RSeqtxt{equa\c{c}\~{a}o~}% + \def\RSeqstxt{equa\c{c}\~{o}es~}% + \def\RSEqtxt{Equa\c{c}\~{a}o~}% + \def\RSEqstxt{Equa\c{c}\~{o}es~}% + \def\RSfigtxt{figura~}% + \def\RSfigstxt{figuras~}% + \def\RSFigtxt{Figura~}% + \def\RSFigstxt{Figuras~}% + \def\RStabtxt{tabela~}% + \def\RStabstxt{tabelas~}% + \def\RSTabtxt{Tabela~}% + \def\RSTabstxt{Tabelas~}% + \def\RSfootntxt{nota de rodap\'{e}~}% + \def\RSfootnstxt{notas de rodap\'{e}~}% + \def\RSFootntxt{Nota de rodap\'{e}~}% + \def\RSFootnstxt{Notas de rodap\'{e}~}% +} +\DeclareLangOpt{portuges}{\RSportuguese} +\DeclareLangOpt{portuguese}{\RSportuguese} +\DeclareLangOpt{brazilian}{\RSbrazilian} +\DeclareLangOpt{brazil}{\RSbrazilian} +%%-- SWEDISH ------------------------------------ +\newcommand\RSswedish{% + \def\RSrngtxt{\space till~}% + \def\RSlsttwotxt{\space och~}% + \def\RSlsttxt{\space och~}% + \def\RSparttxt{del~}% + \def\RSpartstxt{del~}% + \def\RSParttxt{Del~}% + \def\RSPartstxt{Del~}% + \def\RSappendixname{appendix~}% + \def\RSappendicesname{appendix~}% + \def\RSAppendixname{Appendix~}% + \def\RSAppendicesname{Appendix~}% + \def\RSchaptername{kapitel~}% + \def\RSchaptersname{kapitel~}% + \def\RSChaptername{Kapitel~}% + \def\RSChaptersname{Kapitel~}% + \def\RSsectxt{sektion~}% + \def\RSsecstxt{sektion~}% + \def\RSSectxt{Sektion~}% + \def\RSSecstxt{Sektion~}% + \def\RSeqtxt{ekvation~}% + \def\RSeqstxt{ekvation~}% + \def\RSEqtxt{Ekvation~}% + \def\RSEqstxt{Ekvation~}% + \def\RSfigtxt{figur~}% + \def\RSfigstxt{figur~}% + \def\RSFigtxt{Figur~}% + \def\RSFigstxt{Figur~}% + \def\RStabtxt{tabell~}% + \def\RStabstxt{tabell~}% + \def\RSTabtxt{Tabell~}% + \def\RSTabstxt{Tabell~}% + \def\RSfootntxt{fotnot~}% + \def\RSfootnstxt{fotnot~}% + \def\RSFootntxt{Fotnot~}% + \def\RSFootnstxt{Fotnot~}% +} +\DeclareLangOpt{swedish}{\RSswedish} +%%-- TEMPLATE FOR PARTS ------------------------- + \newref{part}{% + name = \RSparttxt, + names = \RSpartstxt, + Name = \RSPparttxt, + Names = \RSPartstxt, + rngtxt = \RSrngtxt, + lsttxt = \RSlsttxt} +%%-- TEMPLATE FOR CHAPTERS & APPENDIXES --------- +\providecommand*{\p@chapter}{} +\AtBeginDocument{% + \RS@ifundefined{chapter}{}{% + \RS@ifundefined{@chapapp}% + {\renewcommand*{\p@chapter}{\string\chpname{\chaptername}}}%AMS + {\renewcommand*{\p@chapter}{\string\chpname{\@chapapp}}}% Normal + }% + } +\newcommand*{\chpname}[1]{} +\newcommand*{\RS@chpname}[1]{% + \ifRSnameon + \edef\RS@tmpa{#1}% + \edef\RS@tmpb{\appendixname}% + \ifx\RS@tmpa\RS@tmpb\relax% + \ifRSplural + \ifRScapname \RSAppendicesname \else \RSappendicesname \fi + \else + \ifRScapname \RSAppendixname \else \RSappendixname \fi + \fi + \else + \ifRSplural + \ifRScapname \RSChaptersname \else \RSchaptersname \fi + \else + \ifRScapname \RSChaptername \else \RSchaptername \fi + \fi + \fi + \fi} + \newref{chap}{% + refcmd = {{\let\chpname=\RS@chpname\ref{#1}}}, + rngtxt = \RSrngtxt, + lsttwotxt = \RSlsttwotxt, + lsttxt = \RSlsttxt} +%%-- TEMPLATE FOR SECTIONS ---------------------- + \newref{sec}{% + name = \RSsectxt, + names = \RSsecstxt, + Name = \RSSectxt, + Names = \RSSecstxt, + refcmd = {\S\ref{#1}}, + rngtxt = \RSrngtxt, + lsttwotxt = \RSlsttwotxt, + lsttxt = \RSlsttxt} +%%-- TEMPLATE FOR EQUATIONS --------------------- +\newcommand*{\RSeqrefform}[1]{\textup{(\ref{#1})}} +\@ifpackageloaded{amsmath}% + {\let\AMSeqref\eqref + \let\eqref\relax}% + {} +\newref{eq}{% + name = \RSeqtxt, + names = \RSeqstxt, + Name = \RSEqtxt, + Names = \RSEqstxt, + refcmd = \RSeqrefform{#1}, + rngtxt = \RSrngtxt, + lsttwotxt = \RSlsttwotxt, + lsttxt = \RSlsttxt} +\let\RSeqref\eqref +\let\eqref\relax +\AtBeginDocument{% + \@ifpackageloaded{amsmath}% + {\RS@ifundefined{AMSeqref}{\let\AMSeqref\eqref}{}% + \let\RSeqrefform\AMSeqref}% + {}% + \let\eqref=\RSeqref + } +%%-- TEMPLATE FOR FIGURES ----------------------- + \newref{fig}{% + name = \RSfigtxt, + names = \RSfigstxt, + Name = \RSFigtxt, + Names = \RSFigstxt, + rngtxt = \RSrngtxt, + lsttwotxt = \RSlsttwotxt, + lsttxt = \RSlsttxt} +%%-- TEMPLATE FOR TABLES ------------------------ + \newref{tab}{% + name = \RStabtxt, + names = \RStabstxt, + Name = \RSTabtxt, + Names = \RSTabstxt, + rngtxt = \RSrngtxt, + lsttwotxt = \RSlsttwotxt, + lsttxt = \RSlsttxt} +%%-- TEMPLATE FOR FOOTNOTES --------------------- + \newcommand{\RSfnmark}[1]{% + \begingroup + \unrestored@protected@xdef\@thefnmark{\ref{#1}}% + \endgroup + \@footnotemark} + \newref{fn}{% + name = \RSfootntxt, + names = \RSfootnstxt, + Name = \RSFootntxt, + Names = \RSFootnstxt, + refcmd = {\ifRSstar\RSfnmark{#1}\else(\ref{#1})\fi}, + rngtxt = \RSrngtxt, + lsttwotxt = \RSlsttwotxt, + lsttxt = \RSlsttxt} +\endinput +%% +%% End of file `refstyle.cfg'. 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} +% +% +% +%<*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]{%<- \ + \texttt{\bslash}\meta{#1}} +\DeclareRobustCommand{\cmarg}[1]{%<- {\} + \texttt{\lcbrack}\cmeta{#1}\texttt{\rcbrack}} +\DeclareRobustCommand{\coarg}[1]{%<- [\] + \texttt{[}\cmeta{#1}\texttt{]}} +\DeclareRobustCommand{\argcmd}[2]{%<- \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} + +% +% \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}"{""}"} +% \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{} \\ ~,~ \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{} \\ ~,~ \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{"{"$_1$"}{"$_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{"{"$_1$"}{"$_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{"{""}"} +% \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} +% +% \end{macrocode} +% +% \Finale +\endinput diff --git a/macros/latex/contrib/refstyle/refstyle.ins b/macros/latex/contrib/refstyle/refstyle.ins new file mode 100644 index 0000000000..ced9ef9722 --- /dev/null +++ b/macros/latex/contrib/refstyle/refstyle.ins @@ -0,0 +1,97 @@ +% refstyle.ins +% 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 +% ------------------------------------------------------------------- +% This file will generate fast loadable files and documentation +% driver files from the doc files in this package when run through +% LaTeX or TeX. +% ------------------------------------------------------------------- + +\def\batchfile{refstyle.ins} +\def\filedate{2010/10/21} +\input docstrip.tex +\keepsilent + +\declarepreamble\package + +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). +------------------------------------------------------------------- + +\endpreamble + +\generate{% + \askforoverwritefalse + \usepreamble\package + \file{refstyle.sty}{\from{refstyle.dtx}{pkg}}} + + + + +\declarepreamble\config + +------------------------------------------------------------------- + The refstyle package + for the formatting of references +------------------------------------------------------------------- +This file may be customized to suit specific user requirements. + +Original by Danie Els +------------------------------------------------------------------- + +\endpreamble +\generate{% + \askforoverwritefalse + \usepreamble\config + \file{refstyle.cfg}{\from{refconfig.dtx}{cfg}}} + + +\obeyspaces +\Msg{**********************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the *} +\Msg{* following files into a directory searched by TeX: *} +\Msg{* *} +\Msg{* refstyle.sty *} +\Msg{* refstyle.cfg *} +\Msg{* *} +\Msg{* To produce the documentation run the file ustitle.dtx *} +\Msg{* through LaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{**********************************************************} +\endbatchfile diff --git a/macros/latex/contrib/refstyle/refstyle.pdf b/macros/latex/contrib/refstyle/refstyle.pdf new file mode 100644 index 0000000000..0e94b7db28 Binary files /dev/null and b/macros/latex/contrib/refstyle/refstyle.pdf differ diff --git a/macros/latex/contrib/refstyle/refstyle.sty b/macros/latex/contrib/refstyle/refstyle.sty new file mode 100644 index 0000000000..11f0c3606b --- /dev/null +++ b/macros/latex/contrib/refstyle/refstyle.sty @@ -0,0 +1,327 @@ +%% +%% This is file `refstyle.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% refstyle.dtx (with options: `pkg') +%% +%% 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). +%% ------------------------------------------------------------------- +%% +\newcommand*{\RefstyleFileDate}{2010/11/02} +\newcommand*{\RefstyleFileVersion}{v0.5} + +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{refstyle}[\RefstyleFileDate\space + \RefstyleFileVersion\space + Reference formatting (DNJ Els)] +\newcommand*{\RS@pkgname}{refstyle} +\RequirePackage{keyval} +\def\RS@setkeys#1#2{% + \def\KV@prefix{KV@#1@}% + \let\@tempc\relax + \KV@do#2,\relax,} +\@ifundefined{vref@space}{\let\vref@space\space}{} +\providecommand*{\@safe@activestrue}{} +\providecommand*{\@safe@activesfalse}{} +\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 }} +\def\RS@ifundefined#1{% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname#1\endcsname\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +\newcommand*{\RS@removedef}[1]{% + \RS@namelet{#1}\@undefined% + \RS@ifundefined{#1 }{}{\RS@namelet{#1 }\@undefined}} +\newcommand*{\RS@testednamedef}[1]{% + \RS@ifnamedefinable{#1}\RS@namedef{#1}} +\newcommand*{\RS@testedrobustnamedef}[1]{% + \RS@ifnamedefinable{#1}\RS@robustnamedef{#1}} +\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} +\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.}% + } +\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}} +\def\RS@firstcap#1#2\@nil{% + \iffalse{\fi + \uppercase{\edef\RS@cap{\iffalse}\fi#1}#2}}% +\newif\ifRS@keyactive +\@ifpackagewith{\@currname}{nokeyprefix}% + {\RS@keyactivefalse}% + {\RS@keyactivetrue} +\DeclareOption{nokeyprefix}{\OptionNotUsed} +\newif\ifRSstar\RSstarfalse +\newif\ifRSnameon\RSnameontrue +\newif\ifRScapname\RScapnamefalse +\newif\ifRSplural\RSpluralfalse +\newif\ifRSlsttwo\RSlsttwofalse +\newcommand*{\newref}[1]{% + \lowercase{\def\RS@tempa{#1}}% + \expandafter\RS@newref\expandafter{\RS@tempa}} +\newcommand*{\RS@newref}[2]{% + \RS@clearref{#1}% + \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}}% + \RS@setkeys{RS@#1}{key, + s=false, + name,names,Name,Names, + rngtxt,lsttwotxt,lsttxt, + refcmd, + xr, + vref=false}% + \RS@setkeys{RS@#1}{#2}% + \RS@buildref{#1}% + } +\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}% + }% + } +\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}} + } +\newcommand*{\RS@cmd}[2]{% + \@ifstar{\RSstartrue\RSnameonfalse\RS@@cmd{#1}{#2}}% + {\RSstarfalse\RSnameontrue\RS@@cmd{#1}{#2}}} +\newcommand*{\RS@@cmd}[2]{% + \@ifnextchar[% + {\RS@nameuse{RS@#1}{#2}}% + {\RS@nameuse{RS@#1}{#2}[]}} +\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} +\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} +\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} +\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} +\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} +\newcommand*{\RS@true}{true} +\newcommand*{\RS@false}{false} +\newcommand*{\RS@far}{far} +\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} +\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 + } +\newcommand*{\RS@lbl}[2]{% + \RS@nameuse{RS@#1@xr}\RS@nameuse{RS@#1@key}#2% + } +\newcommand{\RS@makeref}[2]{% + \RS@nameuse{RS@#1@rcmd}{\RS@lbl{#1}{#2}}% + } +\newcommand{\RS@makevpageref}[2]{% + \RS@ifvref{#1}% + {\vpageref[\unskip]{\RS@lbl{#1}{#2}}}% + { \reftextfaraway{\RS@lbl{#1}{#2}}}% + {}% + } +\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}}}% + {}% + } +\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}} + } +\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} +\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}}}% + } +\newcommand*{\RS@cfgfile}{refstyle.cfg} +\newcommand*{\RS@reffile}{refstyle.def} +\@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}}}} +\DeclareOption{noconfig}{\OptionNotUsed}% +\ProcessOptions*\relax +\endinput +%% +%% End of file `refstyle.sty'. -- cgit v1.2.3