<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%%
%% This is file `refstyle.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% refstyle.dtx  (with options: `pkg')
%% 
%% Copyright (C) 2002--2024 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 2008/12/01 or later.
%% 
%% This work has the LPPL maintenance status 'maintained'.
%% 
%% This Current Maintainer of this work is Danie Els (dnjels@gmail.com)
%% -------------------------------------------------------------------
%% 
\newcommand*{\RefstyleFileDate}{2024/02/01}
\newcommand*{\RefstyleFileVersion}{v0.6b}

\NeedsTeXFormat{LaTeX2e}
\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'.
</pre></body></html>