%%
%% This is file `varioref.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% varioref.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% The source is maintained by the LaTeX Project team and bug
%% reports for it can be opened at https://latex-project.org/bugs/
%% (but please observe conditions on bug reports sent to that address!)
%% 
%% Copyright (C) 1993-2025
%% The LaTeX Project and any individual authors listed elsewhere
%% in this file.
%% 
%% This file was generated from file(s) of the Standard LaTeX `Tools Bundle'.
%% --------------------------------------------------------------------------
%% 
%% It 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
%%    https://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 file may only be distributed together with a copy of the LaTeX
%% `Tools Bundle'. You may however distribute the LaTeX `Tools Bundle'
%% without such generated files.
%% 
%% The list of all files belonging to the LaTeX `Tools Bundle' is
%% given in the file `manifest.txt'.
%% 
%% Package varioref to use with LaTeX2e
%% Copyright (C) 1992-2020  Frank Mittelbach, all rights reserved.
%%
%% For additions or updates to the language options please contact
%% the author at
%%
%%   frank.mittelbach@latex-project.org
%%
%% or open an issue at https://github.com/latex3/latex2e.
%%
\NeedsTeXFormat{LaTeX2e}[1995/05/16]

\DeclareRelease{}{1994-06-01}{varioref-2016-02-16.sty}
\DeclareRelease{}{2016-02-16}{varioref-2016-02-16.sty}
\DeclareCurrentRelease{}{2019-10-01}

\ProvidesPackage{varioref}
    [2025/01/14 v1.6g package for extended references (FMi)]
%%


\def\vref@addto#1#2{%
  #2%
  \@temptokena{#2}%
  \ifx#1\undefined
     \edef#1{\the\@temptokena}%
  \else
     \toks@\expandafter{#1}%
     \edef#1{\the\toks@\the\@temptokena}%
  \fi
  \@temptokena{}\toks@\@temptokena
}
\@onlypreamble\vref@addto
\def\vref@excuse#1{%
  \PackageWarningNoLine{varioref}{Sorry, language `#1'
            not supported%
            \MessageBreak
            in this version.
            English strings used by default.
            \MessageBreak
            Please modify \protect\reftext... commands manually.%
            \MessageBreak\MessageBreak
            If you can suggest translations for
            this language,%
            \MessageBreak
            please mail them
            to the author of this package}}
\@onlypreamble\vref@excuse
\def\vref@stringwarning#1{%
  \PackageWarningNoLine{varioref}{Sorry, there is no proper
            translation for the string\MessageBreak
            produced by \protect#1\on@line.\MessageBreak
            English string used instead.\MessageBreak
            \MessageBreak
            If you can suggest translations for
            the current\MessageBreak
            language, please mail them
            to the author of this\MessageBreak package}}
\DeclareOption{afrikaans}
  {\vref@addto\extrasafrikaans{%
    \def\reftextfaceafter {op die \reftextvario{regterbladsy}%
                                               {bladsy langsaan}}%
    \def\reftextfacebefore{op die \reftextvario{linkerbladsy}%
                                                {bladsy langsaan}}%
    \def\reftextafter     {op die \reftextvario{volgende bladsy}%
                                               {bladsy hierna}}%
    \def\reftextbefore    {op die \reftextvario{vorige bladsy}%
                                               {bladsy hiervoor}}%
    \def\reftextcurrent   {op \reftextvario{hierdie}%
                                           {die huidige} bladsy}%
    \def\reftextfaraway#1{op bladsy~\pageref{#1}}%
    \def\reftextpagerange#1#2{op bladsye~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} tot~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{american}
  {\vref@addto\extrasamerican{%
    \def\reftextfaceafter {on the \reftextvario{facing}{next} page}%
    \def\reftextfacebefore{on the \reftextvario{facing}{preceding}
                           page}%
    \def\reftextafter     {on the \reftextvario{following}{next} page}%
    \def\reftextbefore    {on the \reftextvario{preceding}{previous} page}%
    \def\reftextcurrent   {on \reftextvario{this}{the current} page}%
    \def\reftextfaraway#1{on page~\pageref{#1}}%
    \def\reftextpagerange#1#2{on pages~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} to~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{arabic}
  {\vref@addto\extrasarabic{%
    \def\reftextfaceafter {بالصفحة \reftextvario{المقابلة}{اللاحقة}}%
    \def\reftextfacebefore{بالصفحة \reftextvario{المقابلة}{المُنْصَرِمَةٌ}}%
    \def\reftextafter     {بالصفحة \reftextvario{اللاحقة}{التالية}}%
    \def\reftextbefore    {بالصفحة \reftextvario{السابقة}{المُنْصَرِمَةٌ}}%
    \def\reftextcurrent   {ب\reftextvario{الصفحة الحالية}{هذه الصفحة}}%
    \def\reftextfaraway#1{بالصفحة رقم~\pageref{#1}}%
    \def\reftextpagerange#1#2{بالصفحات~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} حتى~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{austrian}
  {\vref@addto\extrasaustrian{%
    \def\reftextfaceafter {auf der n\"achsten Seite}%
    \def\reftextfacebefore{auf der vorherigen Seite}%
    \let\reftextafter     \reftextfaceafter
    \let\reftextbefore    \reftextfacebefore
    \def\reftextcurrent   {auf dieser Seite}%
    \def\reftextfaraway#1{auf Seite~\pageref{#1}}%
    \def\reftextpagerange#1#2{auf Seiten~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}%
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{naustrian}
  {\vref@addto\extrasnaustrian{%
    \def\reftextfaceafter {auf der n\"achsten Seite}%
    \def\reftextfacebefore{auf der vorherigen Seite}%
    \let\reftextafter     \reftextfaceafter
    \let\reftextbefore    \reftextfacebefore
    \def\reftextcurrent   {auf dieser Seite}%
    \def\reftextfaraway#1{auf Seite~\pageref{#1}}%
    \def\reftextpagerange#1#2{auf Seiten~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{basque}
  {\vref@addto\extrasbasque{%
    \def\reftextfaceafter {hurrengo orrialdean}%
    \def\reftextfacebefore{aurreko orrialdean}%
    \let\reftextafter     \reftextfaceafter
    \let\reftextbefore    \reftextfacebefore
    \def\reftextcurrent   {uneko orrialdean}%
    \def\reftextfaraway#1{~\pageref{#1}. orrialdean}%
    \def\reftextpagerange#1#2{~\pageref{#1}--\pageref{#2} orrialdeetan}%
    \def\reftextlabelrange#1#2{\ref{#1}.etik \ref{#2}.eraino}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{bahasam}
  {\vref@addto\extrasbahasam{%
    \def\reftextfaceafter {pada muka surat \reftextvario{bertentangan}{berikutnya}}%
    \def\reftextfacebefore{pada muka surat \reftextvario{bertentangan}{sebelumnya} }%
    \def\reftextafter     {pada muka surat berikutnya}%
    \def\reftextbefore    {pada muka surat sebelumnya}%
    \def\reftextcurrent   {pada muka surat ini}%
    \def\reftextfaraway#1{pada muka surat~\pageref{#1}}%
    \def\reftextpagerange#1#2{pada muka surat~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1}--\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{brazil}
  {\vref@addto\extrasbrazil{%
    \def\reftextfaceafter {na \reftextvario{p\'agina oposta}{pr\'oxima
                           p\'agina}}%
    \def\reftextfacebefore{na p\'agina \reftextvario{oposta}{anterior}}%
    \def\reftextafter     {na \reftextvario{p\'agina seguinte}{pr\'oxima
                           p\'agina}}%
    \def\reftextbefore{na p\'agina \reftextvario{anterior}{precedente}}%
    \def\reftextcurrent   {\reftextvario{nesta p\'agina}{na p\'agina
                           corrente}}%
    \def\reftextfaraway#1{na p\'agina~\pageref{#1}}%
    \def\reftextpagerange#1#2{nas p\'aginas~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{breton}
  {\vref@excuse{breton}%
   \vref@addto\extrasbreton{%
    \def\reftextfaceafter {war ar bajenn \reftextvario{a-dal}{da heul}}%
    \def\reftextfacebefore{war ar bajenn \reftextvario{a-dal}{a-raok}}%
    \def\reftextafter     {war ar bajenn da heul}%
    \def\reftextbefore    {war ar bajenn a-raok}%
    \def\reftextcurrent   {war ar \reftextvario{bajenn-ma\~n}%
                                               {bajenn war-wel}}%
    \def\reftextfaraway#1{war ar bajenn~\pageref{#1}}%
    \def\reftextpagerange#1#2{\vref@stringwarning\reftextpagerange
                              on pages~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\vref@stringwarning\reflabelpagerange
                               \ref{#1} to~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{bulgarian}%
 {\vref@addto\extrasbulgarian{%
   \def\reftextfaceafter{\cyrn\cyra\
         \reftextvario{\cyrs\cyrery\cyrs\cyre\cyrd\cyrn\cyra\cyrt\cyra}%
                      {\cyrs\cyrl\cyre\cyrd\cyrv\cyra\cyrshch\cyra\cyrt\cyra}
         \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
   \def\reftextfacebefore{\cyrn\cyra\
         \reftextvario{\cyrs\cyrery\cyrs\cyre\cyrd\cyrn\cyra\cyrt\cyra}%
                      {\cyrp\cyrr\cyre\cyrd\cyrn\cyra\cyrt\cyra}
         \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
   \def\reftextafter{\cyrn\cyra\
         \reftextvario{\cyrs\cyrl\cyre\cyrd\cyrv\cyra\cyrshch\cyra\cyrt\cyra}%
                      {\cyrs\cyrl\cyre\cyrd\cyrv\cyra\cyrshch\cyra\cyrt\cyra}
         \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
   \def\reftextbefore{\cyrn\cyra\
         \reftextvario{\cyrp\cyrr\cyre\cyrd\cyrn\cyra\cyrt\cyra}%
                      {\cyrp\cyrr\cyre\cyrd\cyri\cyrsh\cyrn\cyra\cyrt\cyra}
         \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
   \def\reftextcurrent{\cyrn\cyra\
         \reftextvario{\cyrt\cyra\cyrz\cyri}%
                      {\cyrt\cyre\cyrk\cyru\cyrshch\cyra\cyrt\cyra}
         \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
   \def\reftextfaraway#1{\cyrn\cyra\ \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra
                         ~\pageref{#1}}%
   \def\reftextpagerange#1#2{\cyrn\cyra\
                        \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyri
                        ~\pageref{#1}--\pageref{#2}}%
   \def\reftextlabelrange#1#2{\ref{#1} \cyrd\cyro~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
 }}
\DeclareOption{catalan}
  {\vref@addto\extrascatalan{%
    \def\reftextfaceafter {a la p\`agina seg\"uent}%
    \def\reftextfacebefore{a la p\`agina anterior}%
    \let\reftextafter     \reftextfaceafter
    \let\reftextbefore    \reftextfacebefore
    \def\reftextcurrent   {en aquesta p\`agina}%
    \def\reftextfaraway#1{a la p\`agina~\pageref{#1}}%
    \def\reftextpagerange#1#2{a les
                     p\`agines~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{croatian}
   {\vref@addto\extrascroatian{%
     \def\reftextfaceafter {na sljede\'coj stranici}%
     \def\reftextfacebefore{na prethodnoj stranici}%
     \let\reftextafter     \reftextfaceafter
     \let\reftextbefore    \reftextfacebefore
     \def\reftextcurrent   {na ovoj stranici}%
     \def\reftextfaraway#1{na stranici~\pageref{#1}}%
     \def\reftextpagerange#1#2{na stranicama~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} do~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
   }}
\DeclareOption{czech}
  {%\vref@excuse{czech}%
   \vref@addto\extrasczech{%
    \def\reftextfaceafter {na n\'a\-sle\-du\-j\'\i c\'\i\ stran\v{e}}%
    \def\reftextfacebefore{na p\v{r}ed\-choz\'\i\ stran\v{e}}%
    \def\reftextafter     {na n\'a\-sle\-du\-j\'\i c\'\i\ stran\v{e}}%
    \def\reftextbefore    {na p\v{r}ed\-choz\'\i\ stran\v{e}}%
    \def\reftextcurrent   {na t\'eto stran\v{e}}%
    \def\reftextfaraway#1{na stran\v{e}~\pageref{#1}}%
    \def\reftextpagerange#1#2{na stran\'ach~\pageref{#1}\--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} a\v{z}~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{danish}
  {\vref@addto\extrasdanish{%
    \def\reftextfaceafter {p\aa{} \reftextvario{modst\aa ende}%
                                               {n\ae ste} side}%
    \def\reftextfacebefore{p\aa{} \reftextvario{modst\aa ende}%
                                               {forrige} side}%
    \def\reftextafter     {p\aa{} \reftextvario{den f\o lgende}%
                                               {n\ae ste} side}%
    \def\reftextbefore    {p\aa{} \reftextvario{forrige side}
                                               {foreg\aa ende side}}%
    \def\reftextcurrent   {p\aa{} denne side}%
    \def\reftextfaraway#1{p\aa{} side~\pageref{#1}}%
    \def\reftextpagerange#1#2{p\aa{} side~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{dutch}
  {\vref@addto\extrasdutch{%
    \def\refpagename{pagina}%
    \def\reftextfaceafter {op de \reftextvario{rechter \refpagename}%
                                          {\refpagename\ hiernaast}}%
    \def\reftextfacebefore{op de \reftextvario{linker \refpagename}%
                                         {\refpagename\ hiernaast}}%
    \def\reftextafter     {op de \reftextvario{volgende \refpagename}%
                                              {\refpagename\ hierna}}%
    \def\reftextbefore    {op de \reftextvario{vorige \refpagename}%
                                          {\refpagename\ hiervoor}}%
    \def\reftextcurrent   {op deze \refpagename}%
    \def\reftextfaraway#1{op \refpagename~\pageref{#1}}%
    \def\reftextpagerange#1#2{op pagina's~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1}--\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{english}
  {\vref@addto\extrasenglish{%
    \def\reftextfaceafter {on the \reftextvario{facing}{next} page}%
    \def\reftextfacebefore{on the \reftextvario{facing}{preceding}
                           page}%
    \def\reftextafter     {on the \reftextvario{following}{next} page}%
    \def\reftextbefore    {on the \reftextvario{preceding}{previous} page}%
    \def\reftextcurrent   {on \reftextvario{this}{the current} page}%
    \def\reftextfaraway#1{on page~\pageref{#1}}%
    \def\reftextpagerange#1#2{on pages~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} to~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{esperanto}
  {\vref@addto\extrasesperanto{%
    \def\reftextfaceafter{en la
        \reftextvario{flanka}{sekva} pa\^go}%
    \def\reftextfacebefore{en la
        \reftextvario{flanka}{anta\u ua} pa\^go}%
    \def\reftextafter{en la sekva pa\^go}%
    \def\reftextbefore{en la anta\u ua pa\^go}%
    \def\reftextcurrent{\reftextvario{\^ci-pa\^ge}%
        {en \^ci tiu pa\^go}}%
    \def\reftextfaraway#1{en pa\^go~\pageref{#1}}%
    \def\reftextpagerange#1#2{en pa\^goj~\pageref{#1} \^gis \pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} \^gis~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{finnish}
  {\vref@addto\extrasfinnish{%
    \def\reftextfaceafter {\reftextvario{viereisell\"a}%
                                        {seuraavalla} sivulla}%
    \def\reftextfacebefore{\reftextvario{viereisell\"a}%
                                        {edellisell\"a} sivulla}%
    \def\reftextafter     {seuraavalla sivulla}%
    \def\reftextbefore    {edellisell\"a sivulla}%
    \def\reftextcurrent   {t\"all\"a sivulla}%
    \def\reftextfaraway#1{sivulla~\pageref{#1}}%
     \def\reftextpagerange#1#2{sivuilla~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1}--\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{french}
  {\vref@addto\extrasfrench{%
    \def\reftextfaceafter {page \reftextvario{ci-contre}{suivante}}%
    \def\reftextfacebefore{page \reftextvario{ci-contre}%
                          {pr\'ec\'edente}}%
    \def\reftextafter     {page suivante}%
    \def\reftextbefore    {page pr\'ec\'edente}%
    \def\reftextcurrent   {de la pr\'esente page}%
    \def\reftextfaraway#1{page~\pageref{#1}}%
    \def\reftextpagerange#1#2{pages~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} \`a~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{galician}
  {\vref@addto\extrasgalician{%
    \def\reftextfaceafter {na p\'axina oposta}%
    \def\reftextfacebefore\reftextfaceafter
    \def\reftextafter     {na p\'axina seguinte}%
    \def\reftextbefore    {na p\'axina anterior}%
    \def\reftextcurrent   {nesta p\'axina}%
    \def\reftextfaraway#1{na p\'axina~\pageref{#1}}%
     \def\reftextpagerange#1#2{%
                nas p\'axinas~\pageref{#1}-\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{german}
  {\vref@addto\extrasgerman{%
    \def\reftextfaceafter {auf der n\"achsten Seite}%
    \def\reftextfacebefore{auf der vorherigen Seite}%
    \let\reftextafter     \reftextfaceafter
    \let\reftextbefore    \reftextfacebefore
    \def\reftextcurrent   {auf dieser Seite}%
    \def\reftextfaraway#1{auf Seite~\pageref{#1}}%
    \def\reftextpagerange#1#2{auf den Seiten~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{ngerman}
  {\vref@addto\extrasngerman{%
    \def\reftextfaceafter {auf der n\"achsten Seite}%
    \def\reftextfacebefore{auf der vorherigen Seite}%
    \let\reftextafter     \reftextfaceafter
    \let\reftextbefore    \reftextfacebefore
    \def\reftextcurrent   {auf dieser Seite}%
    \def\reftextfaraway#1{auf Seite~\pageref{#1}}%
    \def\reftextpagerange#1#2{auf den Seiten~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{greek}
  {\vref@addto\extrasgreek{%
    \def\reftextfaceafter {sthn \reftextvario{paro'usa}%
                           {ep'omenh} sel'ida}%
    \def\reftextfacebefore{sthn \reftextvario{paro'usa}{prohgo'umenh}
                           sel'ida}%
    \def\reftextafter     {sthn ep'omenh sel'ida}%
    \def\reftextbefore    {sthn prohgo'umenh sel'ida}%
    \def\reftextcurrent   {s'' aut'h th sel'ida}%
    \def\reftextfaraway#1{sth sel'ida\nobreakspace\pageref{#1}}%
    \def\reftextpagerange#1#2{stis sel'ides\nobreakspace
                          \pageref{#1}---\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} ws\nobreakspace\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{icelandic}
  {\vref@addto\extrasicelandic{%
    \def\reftextfaceafter {\'{a} \reftextvario{n{\ae}stu}%
                                              {n{\ae}stu} s\'{i}{\dh}u}%
    \def\reftextfacebefore{\'{a} \reftextvario{fyrri}%
                                              {fyrri} s\'{i}{\dh}u}%
    \def\reftextafter     {\'{a} \reftextvario{n{\ae}stu}%
                                              {n{\ae}stu} s\'{i}{\dh}u}%
    \def\reftextbefore    {\'{a} \reftextvario{fyrri}{fyrri} s\'{i}{\dh}u}%
    \def\reftextcurrent   {\'{a} \reftextvario{{\th}essari}%
                                              {{\th}essari} s\'{i}{\dh}u}%
    \def\reftextfaraway#1{\'{a} s\'{i}{\dh}u~\pageref{#1}}%
    \def\reftextpagerange#1#2{\'{a} s\'{i}{\dh}um~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{italian}
  {\vref@addto\extrasitalian{%
    \def\reftextfaceafter {\reftextvario{a fronte}%
                           {nella pagina successiva}}%
    \def\reftextfacebefore{\reftextvario{a fronte}%
                           {nella pagina precedente}}%
    \def\reftextafter     {nella pagina \reftextvario{seguente}%
                           {successiva}}%
    \def\reftextbefore    {nella pagina precedente}%
    \def\reftextcurrent   {in questa pagina}%
    \def\reftextfaraway#1{a pagina~\pageref{#1}}%
    \def\reftextpagerange#1#2{nelle pagine~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{da~\ref{#1} a~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{japanese}
  {\vref@addto\extrasjapanese{%
    \def\reftextfaceafter {\reftextvario{見開き}{次}ページ}%
    \def\reftextfacebefore{\reftextvario{見開き}{前}ページ}%
    \def\reftextafter     {\reftextvario{直後の}{次}ページ}%
    \def\reftextbefore    {\reftextvario{直前の}{前}ページ}%
    \def\reftextcurrent   {\reftextvario{この}{現}ページ}%
    \def\reftextfaraway#1{\pageref{#1}ページ}%
    \def\reftextpagerange#1#2{\pageref{#1}から\pageref{#2}ページ}%
    \def\reftextlabelrange#1#2{\ref{#1}から\ref{#2}}%
    \def\vrefformat#1#2{\ref{#2}（\vpageref[#1]{#2}）}%
    \def\Vrefformat#1#2{\Ref{#2}（\vpageref[#1]{#2}）}%
    \def\fullrefformat#1{\ref{#1}（\reftextfaraway{#1}）}%
    \def\vrefrangeformat#1#2#3{\reftextlabelrange{#2}{#3}%
                               （\vpagerefrange[{#1}]{#2}{#3}）}%
  }}
\DeclareOption{magyar}
  {\vref@addto\extrasmagyar{%
    \def\reftextafter {a k\"o\-vet\-kez\H{o} ol\-da\-lon}%
    \def\reftextbefore{az el\H{o}\-z\H{o} ol\-da\-lon}%
    \def\reftextfaceafter {\reftextvario{a t\'ul\-ol\-da\-lon}%
                          {a k\"o\-vet\-kez\H{o} ol\-da\-lon}}%
    \def\reftextfacebefore{\reftextvario{a t\'ul\-ol\-da\-lon}%
                          {az el\H{o}\-z\H{o} ol\-da\-lon}}%
    \def\reftextcurrent   {ezen az ol\-da\-lon}%
    \def\reftextfaraway#1{\aza{\pageref{#1}} \pageref{#1}.~ol\-da\-lon}%
    \def\reftextpagerange#1#2{\vref@stringwarning\reftextpagerange
                              on pages~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\vref@stringwarning\reflabelpagerange
                               \ref{#1} to~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
   }%
   \AtBeginDocument{\providecommand\aza[1]{a/az%
       \PackageError{varioref}{%
         Proper definition for command \noexpand\aza missing}%
        {You need to (re)define the command \noexpand\aza that
         takes one argument (a number or a \noexpand\pageref command)
         and produces the string `a' or `az' depending on the argument
         value. It should also accept an optional argument (default `l')
         to denote whether or not the string should be lowercase or
         uppercase.}}}%
  }
\DeclareOption{norsk}
  {\vref@addto\extrasnorsk{%
    \def\reftextfaceafter {p\aa{} neste side}%
    \def\reftextfacebefore{p\aa{} forrige side}%
    \def\reftextafter     {p\aa{} neste side}%
    \def\reftextbefore    {p\aa{} forrige side}%
    \def\reftextcurrent   {p\aa{} denne siden}%
    \def\reftextfaraway#1{p\aa{} side~\pageref{#1}}%
    \def\reftextpagerange#1#2{p\aa{} side~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{nynorsk}
  {\vref@addto\extrasnynorsk{%
    \def\reftextfaceafter {p\aa{} neste side}%
    \def\reftextfacebefore{p\aa{} f\o{}rre side}%
    \def\reftextafter     {p\aa{} neste side}%
    \def\reftextbefore    {p\aa{} f\o{}rre side}%
    \def\reftextcurrent   {p\aa{} denne sida}%
    \def\reftextfaraway#1{p\aa{} side~\pageref{#1}}%
    \def\reftextpagerange#1#2{p\aa{} side~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{polish}
  {\vref@addto\extraspolish{%
    \def\reftextfaceafter {na \reftextvario{s\aob{}siedniej}%
                                   {nast\eob{}pnej} stronie}%
    \def\reftextfacebefore{na \reftextvario{s\aob{}siedniej}%
                                   {poprzedniej} stronie}%
    \def\reftextafter     {na nast\eob{}pnej stronie}%
    \def\reftextbefore    {na poprzedniej stronie}%
    \def\reftextcurrent   {na \reftextvario{tej
                           samej}{bie\zkb{}\aob{}cej} stronie}%
    \def\reftextfaraway#1{na stronie~\pageref{#1}}%
    \def\reftextpagerange#1#2{na stronach~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{od~\ref{#1} do~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{portuges}
  {\vref@addto\extrasportuges{%
    \def\reftextfaceafter {na \reftextvario{p\'agina ao lado}{pr\'oxima
                           p\'agina}}%
    \def\reftextfacebefore{na p\'agina \reftextvario{ao lado}{anterior}}%
    \def\reftextafter     {na \reftextvario{p\'agina seguinte}{pr\'oxima
                           p\'agina}}%
    \def\reftextbefore{na p\'agina \reftextvario{anterior}{precedente}}%
    \def\reftextcurrent   {nesta p\'agina}%
    \def\reftextfaraway#1{na p\'agina~\pageref{#1}}%
     \def\reftextpagerange#1#2{nas p\'aginas~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{romanian}
  {\vref@addto\extrasromanian{%
    \def\reftextfaceafter {pe pagina \reftextvario{opus\u{a}}{urm\u{a}toarei}}%
    \def\reftextfacebefore{pe pagina \reftextvario{opus\u{a}}{precedentei}}%
    \def\reftextafter     {\reftextvario{pe pagina urm\u{a}toare}%
                                        {pe urm\u{a}toarea pagin\u{a}}}%
    \def\reftextbefore    {pe pagina \reftextvario{precedent\u{a}}%
                                                  {precedentei}}%
    \def\reftextcurrent   {pe aceast\u{a} pagin\u{a}}%
    \def\reftextfaraway#1{pe pagina~\pageref{#1}}%
    \def\reftextpagerange#1#2{pe paginile~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} la~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{russian}
  {\vref@addto\extrasrussian{%
    \def\reftextfaceafter{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyro
      \cyrt\cyri\cyrv\cyro\cyrp\cyro\cyrl\cyro\cyrzh\cyrn\cyro\cyrishrt}%
      {\cyrs\cyrl\cyre\cyrd\cyru\cyryu\cyrshch\cyre\cyrishrt}\ \cyrs\cyrt
      \cyrr\cyra\cyrn\cyri\cyrc\cyre}%
    \def\reftextfacebefore{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyro
      \cyrt\cyri\cyrv\cyro\cyrp\cyro\cyrl\cyro\cyrzh\cyrn\cyro\cyrishrt}%
      {\cyrp\cyrr\cyre\cyrd\cyrery\cyrd\cyru\cyrshch\cyre\cyrishrt}\
      \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyre}%
    \def\reftextafter{\cyrn\cyra\ \cyrs\cyrl\cyre\cyrd\cyru\cyryu\cyrshch
      \cyre\cyrishrt\ \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyre}%
    \def\reftextbefore{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyre\cyrd
      \cyrsh\cyre\cyrs\cyrt\cyrv\cyru\cyryu\cyrshch\cyre\cyrishrt}%
      {\cyrp\cyrr\cyre\cyrd\cyrery\cyrd\cyru\cyrshch\cyre\cyrishrt}%
      \ \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyre}%
    \def\reftextcurrent{\cyrn\cyra\ \reftextvario{\cyrerev\cyrt\cyro
      \cyrishrt}{\cyrd\cyra\cyrn\cyrn\cyro\cyrishrt}\ \cyrs\cyrt\cyrr
      \cyra\cyrn\cyri\cyrc\cyre}%
    \def\reftextfaraway#1{\cyrn\cyra\ \cyrs.~\pageref{#1}}%
    \def\reftextpagerange#1#2{\cyrn\cyra\ \cyrs\cyrt\cyrr\cyra\cyrn
      \cyri\cyrc\cyra\cyrh~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\cyrs~\ref{#1}\ \cyrp\cyro~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{slovak}
  {\vref@addto\extrasslovak{%
    \def\reftextfaceafter {na \reftextvario{proti\v lahlej}%
                          {nasleduj\'ucej} strane}%
    \def\reftextfacebefore{na \reftextvario{proti\v lahlej}%
                          {predch\'adzaj\'ucej} strane}%
    \def\reftextafter     {na \reftextvario{nasleduj\'ucej}%
                          {\v dal\v sej} strane}%
    \def\reftextbefore    {na \reftextvario{predch\'adzaj\'ucej}%
                          {predo\v slej} strane}%
    \def\reftextcurrent   {na tejto strane}%
    \def\reftextfaraway#1{na strane~\pageref{#1}}%
    \def\reftextpagerange#1#2{na stran\'ach~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} a\v z~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{slovene}
  {\vref@addto\extrasslovene{%
    \def\reftextfaceafter {na naslednji strani}%
    \def\reftextfacebefore{na prej\v{s}nji strani}%
    \let\reftextafter     \reftextfaceafter
    \let\reftextbefore    \reftextfacebefore
    \def\reftextcurrent   {na \reftextvario{tej}{trenutni} strani}%
    \def\reftextfaraway#1{na strani~\pageref{#1}}%
    \def\reftextpagerange#1#2{na straneh~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{od~\ref{#1} do~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{spanish}
  {\vref@addto\extrasspanish{%
    \def\reftextfaceafter {en la p\'agina siguiente}%
    \def\reftextfacebefore{en la p\'agina anterior}%
    \let\reftextafter     \reftextfaceafter
    \let\reftextbefore    \reftextfacebefore
    \def\reftextcurrent   {en esta p\'agina}%
    \def\reftextfaraway#1{en la p\'agina~\pageref{#1}}%
    \def\reftextpagerange#1#2{en las p\'aginas~\pageref{#1}%
                                             -\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{swedish}
  {\vref@addto\extrasswedish{%
     \def\reftextfaceafter {p\aa\ \reftextvario{motst\aa ende}%
                                             {n\"{a}sta} sida}%
     \def\reftextfacebefore{p\aa\ \reftextvario{motst\aa ende}%
                                      {f\"{o}reg\aa ende} sida}%
     \def\reftextafter     {p\aa\ \reftextvario{f\"{o}ljande}%
                                            {n\"{a}sta} sida}%
     \def\reftextbefore    {p\aa\ f\"{o}reg\aa ende sida}%
     \def\reftextcurrent   {p\aa\ denna sida}%
     \def\reftextfaraway#1{p\aa\ sidan~\pageref{#1}}%
     \def\reftextpagerange#1#2{p\aa\
                               sidorna~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} till~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{turkish}
  {\vref@excuse{turkish}%
   \vref@addto\extrasturkish{%
    \def\reftextfaceafter {on the \reftextvario{facing}{next} page}%
    \def\reftextfacebefore{on the \reftextvario{facing}{preceding}
                           page}%
    \def\reftextafter     {on the \reftextvario{following}{next} page}%
    \def\reftextbefore    {on the \reftextvario{preceding}{previous} page}%
    \def\reftextcurrent   {on \reftextvario{this}{the current} page}%
    \def\reftextfaraway#1{on page~\pageref{#1}}%
    \def\reftextpagerange#1#2{on pages~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} to~\ref{#2}}%
    \let\vrefrangeformat\vrefrangedefaultformat
  }}
\DeclareOption{ukrainian}
   {\vref@addto\extrasukrainian{%
     \def\reftextfaceafter{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyro
       \cyrt\cyri\cyrl\cyre\cyrzh\cyrn\cyrii\cyrishrt}%
       {\cyrn\cyra\cyrs\cyrt\cyru\cyrp\cyrn\cyrii\cyrishrt}\ \cyrs\cyrt
       \cyro\cyrr\cyri\cyrn\cyrc\cyrii}%
     \def\reftextfacebefore{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyro
       \cyrt\cyri\cyrl\cyre\cyrzh\cyrn\cyrii\cyrishrt}%
       {\cyrp\cyro\cyrp\cyre\cyrr\cyre\cyrd\cyrn\cyrii\cyrishrt}\
       \cyrs\cyrt\cyro\cyrr\cyrii\cyrn\cyrc\cyrii}%
     \def\reftextafter{\cyrn\cyra\ \cyrn\cyra\cyrs\cyrt\cyru\cyrp\cyrn
       \cyrii\cyrishrt\ \cyrs\cyrt\cyro\cyrr\cyrii\cyrn\cyrc\cyrii}%
     \def\reftextbefore{\cyrn\cyra\ \cyrp\cyro\cyrp\cyre\cyrr\cyre\cyrd
       \cyrn\cyrii\cyrishrt\ \cyrs\cyrt\cyro\cyrr\cyrii\cyrn\cyrc\cyrii}%
     \def\reftextcurrent{\cyrn\cyra\ \reftextvario{\cyrc\cyrii\cyrishrt}%
       {\cyrd\cyra\cyrn\cyrii\cyrishrt}\ \cyrs\cyrt\cyro\cyrr\cyrii\cyrn
       \cyrc\cyrii}%
     \def\reftextfaraway#1{\cyrn\cyra\ \cyrs.~\pageref{#1}}%
     \def\reftextpagerange#1#2{\cyrn\cyra\ \cyrs\cyrt\cyro\cyrr\cyrii
       \cyrn\cyrk\cyra\cyrh~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\cyrz~\ref{#1}\ \cyrd\cyro~\ref{#2}}%
    \let\vrefformat\vrefdefaultformat
    \let\Vrefformat\Vrefdefaultformat
    \let\fullrefformat\fullrefdefaultformat
    \let\vrefrangeformat\vrefrangedefaultformat
   }}
\DeclareOption{francais}{%
   \typeout{Please use `french' instead of `francais'}%
   \ExecuteOptions{french}}
\DeclareOption{germanb}{%
   \typeout{Please use `german' instead of `germanb'}%
   \ExecuteOptions{german}}
\DeclareOption{draft}{\AtEndOfPackage\vrefwarning}
\DeclareOption{final}{\AtEndOfPackage\vrefshowerrors} % the default
\newif\if@vrefhandlespace
\DeclareOption{space}  {\@vrefhandlespacetrue}
\DeclareOption{nospace}{\@vrefhandlespacefalse}
\ExecuteOptions{english,final,space}
\newcounter{vrcnt}
\DeclareRobustCommand\vpageref{\@ifstar
     {\let\vref@maybe@space\@empty\vp@gerefstar}%
     {\let\vref@maybe@space\space \vp@geref}}
\def\vp@geref{\@ifnextchar[%
  \@vpageref{\@vpageref[\reftextcurrent]}%
}
\let\vref@space\space
\let\vref@maybe@space\space
\def\@vpageref[#1]{\@ifnextchar[%
  {\@@vpageref{#1}}{\@@vpageref{#1}[]}}
\def\@@vpageref#1[#2]#3{%
  \leavevmode
  \@tempskipa\lastskip \unskip
  \global\advance\c@vrcnt\@ne
  \vref@pagenum\@tempa{\the\c@vrcnt @vr}%
  \vref@pagenum\@tempb{\the\c@vrcnt @xvr}%
  \vref@label{\the\c@vrcnt @xvr}%
  \if@vrefhandlespace
    \vref@maybe@space
  \else
    \ifdim\@tempskipa=\z@ \else
      \hskip\@tempskipa
    \fi
  \fi
  \ifx\@tempa\@tempb
    \let\vref@may@loop\relax
  \else
    \edef\vref@may@loop{%
      \noexpand\vref@err{\noexpand\vref or \noexpand\vpageref
              at page boundary
              \@tempb-\@tempa\space (may loop)%
              }%
      }%
   \fi
  \vrefpagenum\thevpagerefnum{#3}%
  \ifx\@tempa\thevpagerefnum
    \def\@tempc{#1}%
    \ifx\@tempc\@empty
       \unskip
    \else
       #1%
    \fi
  \else
    \def\@tempc{#2}%
    \ifx\@tempc\@empty \else
      #2\vref@space
    \fi
    \is@pos@number\thevpagerefnum
       {%
        \is@pos@number\@tempa
         {\@tempcnta\@tempa
          \advance\@tempcnta\@ne
         }%
         {\@tempcnta\maxdimen}%
        \ifnum \thevpagerefnum =\@tempcnta
         \ifodd\@tempcnta
           \if@twoside
             \reftextfaceafter
           \else
             \reftextafter
           \fi
         \else
           \reftextafter
         \fi
        \else
          \advance\@tempcnta-2
          \ifnum \thevpagerefnum =\@tempcnta
            \ifodd\@tempcnta
              \reftextbefore
            \else
              \if@twoside
                \reftextfacebefore
              \else
                \reftextbefore
              \fi
            \fi
          \else
          \let\vref@may@loop\relax % added
          \reftextfaraway{#3}%
          \fi
        \fi
       }%
       {%
         \let\vref@may@loop\relax %added
         \reftextfaraway{#3}}%
  \fi
   \vref@label{\the\c@vrcnt @vr}%
   \vref@may@loop
}
\let\vp@gerefstar\vp@geref

\def\vref@label#1{\@bsphack
  \protected@write\@auxout{}%
         {\string\newlabel{#1}{{}{\thepage}}}%
  \@esphack}
\let\thevpagerefnum\@empty
\def\vrefwarning{\def\vref@err{\PackageWarning{varioref}}}
\def\vrefshowerrors{\def\vref@err##1{\PackageError{varioref}{##1}%
    {Please check the pages in question. You might need to replace
     the \string\vref\MessageBreak
     or \noexpand\vpageref by a normal \noexpand\(page)ref to
     stop LaTeX running forever.}}}
\DeclareRobustCommand\vref{\@ifstar
   {\vref@star}{\vr@f}}

\newcommand\vref@star[1][]{\vrefformat{#1}}
\def\vrefdefaultformat#1#2{%
  \ref{#2}
  \vpageref[#1]{#2}}
\let\vrefformat\vrefdefaultformat

\def\vr@f{%
  \leavevmode
  \if@vrefhandlespace
    \unskip \nobreakspace
  \fi
  \vref@star                    % in hyperref this needs to be explicit
}
\def\is@pos@number#1{\is@pos@num0#1\space\@nil}
\def\is@pos@num{\afterassignment\is@pos@num@ \count@}
\def\is@pos@num@#1\@nil{%
  \ifx\@nil#1\@nil
    \expandafter\@firstoftwo \else
    \expandafter\@secondoftwo  \fi}
\def\reftextvario#1#2{\ifodd\c@vrcnt #1\else#2\fi}
\newcommand\fullref{\fullrefformat}
\def\fullrefdefaultformat#1{%
  \ref{#1} \reftextfaraway{#1}}
\let\fullrefformat\fullrefdefaultformat
\def\vref@pagenum#1#2{%
  \@ifundefined{r@#2}{\@namedef{r@#2}{{??}{??}{}{}{}}}{}%
  \expandafter\expandafter\expandafter\vref@@pagenum
  \csname r@#2\endcsname{}{}\@nil#1%
}
\def\vref@@pagenum#1#2#3\@nil#4{%
  \def#4{#2}%
}
\def\vrefpagenum#1#2{%
  \@ifundefined{r@#2}%
    {\G@refundefinedtrue
     \@latex@warning{Reference `#2' on page \thepage \space
             undefined}}{}%
  \vref@pagenum{#1}{#2}}
\newcommand\@svpagerefrange[3][\reftextcurrent]{%
  \vrefpagenum\@tempa{#2}%
  \vrefpagenum\@tempb{#3}%
  \ifx\@tempa\@tempb
    \vpageref*[{#1}]{#2}%
  \else
    \reftextpagerange{#2}{#3}%
  \fi
}
\newcommand\@vpagerefrange[3][\reftextcurrent]{%
  \vrefpagenum\@tempa{#2}%
  \vrefpagenum\@tempb{#3}%
  \ifx\@tempa\@tempb
    \vpageref[{#1}]{#2}%
  \else
    \reftextpagerange{#2}{#3}%
  \fi
}
\newcommand\vpagerefrange{\@ifstar\@svpagerefrange\@vpagerefrange}
\newcommand\vrefrange[1][\reftextcurrent]{\vrefrangeformat{#1}}
\def\vrefrangedefaultformat#1#2#3{%
  \reftextlabelrange{#2}{#3} \vpagerefrange[{#1}]{#2}{#3}}
\let\vrefrangeformat\vrefrangedefaultformat
\DeclareRobustCommand\Vref{\@ifstar
   {\Vref@star}%
   {\Vr@f}}
\newcommand\Vref@star[1][]{\Vrefformat{#1}}
\def\Vrefdefaultformat#1#2{%
  \Ref{#2}
  \vpageref[#1]{#2}}
\let\Vrefformat\Vrefdefaultformat
\def\Vr@f{%
  \if@vrefhandlespace
    \unskip \vref@space
  \fi
  \Vref@star                  % in hyperref this needs to be explicit
}

\DeclareRobustCommand\vpagerefcompare[2]{%  label1, label2, TRUE, FALSE
  \vrefpagenum\@tempa{#1}%
  \vrefpagenum\@tempb{#2}%
  \ifx\@tempa\@tempb
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
\DeclareRobustCommand\vpagerefnearby[1]{%  label, TRUE, FALSE
  \leavevmode
  \@tempskipa\lastskip \unskip
  \global\advance\c@vrcnt\tw@    % keep oddness to not disturb \vrefvario
  \vref@label{\the\c@vrcnt @vn}%
  \ifdim\@tempskipa=\z@ \else
    \hskip\@tempskipa
  \fi
  \vref@pagenum\@tempa{\the\c@vrcnt @vn}%
  \is@pos@number\@tempa
      {%
        \vrefpagenum\@tempb{#1}%
        \is@pos@number\@tempb
            {%
              \ifcase\numexpr \@tempa -\@tempb+1\relax
              \or \or \else \expandafter \@thirdofthree \fi
              \@firstoftwo
            }%
            {\@secondoftwo}%
      }%
      {\@secondoftwo}%
}

\DeclareRobustCommand\vpagerefcomparenearby[2]{%  label1, label2, TRUE, FALSE
  \vrefpagenum\@tempa{#1}%
  \is@pos@number\@tempa
      {%
        \vrefpagenum\@tempb{#2}%
        \is@pos@number\@tempb
            {%
              \ifcase\numexpr \@tempa -\@tempb+1\relax
              \or \or \else \expandafter \@thirdofthree \fi
              \@firstoftwo
            }%
            {\@secondoftwo}%
      }%
      {\@secondoftwo}%
}

\ifx\labelformat\@undefined  % assume we are in an older kernel
  \def\labelformat#1{\expandafter\def\csname p@#1\endcsname##1}
  \DeclareRobustCommand\Ref[1]{\protected@edef\@tempa{\ref{#1}}%
     \expandafter\MakeUppercase\@tempa}
  \def\refstepcounter#1{\stepcounter{#1}%
      \protected@edef\@currentlabel
         {\csname p@#1\expandafter\endcsname\csname the#1\endcsname}}
\fi
\ProcessOptions*
\endinput
%%
%% End of file `varioref.sty'.
