1 % \iffalse meta-comment
5 % The LaTeX3 Project and any individual authors listed elsewhere
8 % This file is part of the Standard LaTeX `Tools Bundle'.
9 % -------------------------------------------------------
11 % It may be distributed and/or modified under the
12 % conditions of the LaTeX Project Public License, either version 1.3c
13 % of this license or (at your option) any later version.
14 % The latest version of this license is in
15 % http://www.latex-project.org/lppl.txt
16 % and version 1.3c or later is part of all distributions of LaTeX
17 % version 2005/12/01 or later.
19 % The list of all files belonging to the LaTeX `Tools Bundle' is
20 % given in the file `manifest.txt'.
24 %% Package varioref to use with LaTeX2e
25 %% Copyright (C) 1992-2016 Frank Mittelbach, all rights reserved.
27 %% For additions or updates to the language options please contact
30 %% frank.mittelbach@latex-project.org
32 %% In case of bugs, please use "latexbug.tex" (category tools) to report them.
35 %<package>\NeedsTeXFormat{LaTeX2e}[1995/05/16]
36 %<package>\ProvidesPackage{varioref}
37 %<package> [2016/02/16 v1.5c package for extended references (FMi)]
43 % \changes{v1.0a}{1993/12/06}{Upgrade to LaTeX2e}
44 % \changes{v1.0g}{1994/05/27}{Use \cmd\DeclareRobustCommand}
45 % \changes{v1.5c}{2016/02/09}{Revamped some of the documentation to better
46 % explain how varioref could be used in a multi-lingual context}
49 % \newcommand\NewIn[1]{\marginpar{\fbox{\fbox{\sffamily\tabular{l}New in\\#1\endtabular}}}}
51 % \title{The \texttt{varioref} package\thanks{This file
52 % has version number \fileversion, last
53 % revised \filedate.}}
54 % \author{Frank Mittelbach}
57 % \MaintainedByLaTeXTeam{tools}
62 % This package defines the commands |\vref|, |\vpageref|,
63 % |\vrefrange|, and |\vpagerefrange| for
64 % \LaTeXe. |\vref| is similar to |\ref| but adds an additional
65 % page reference, like `on the facing page' or `on page 27' whenever
66 % the corresponding |\label| is not on the same page. The command
67 % |\vpageref| is a variation to |\pageref| with a similar
68 % functionality. The |\v...range| commands take two labels as arguments
69 % and produce strings which depend on whether or not these labels
70 % fall onto a single page or on different pages.
71 % Generated strings are customizable so that these
72 % commands are usable with various languages.
76 % \columnsep=2\columnsep
77 % \begin{multicols}{2}
81 % \section{Introduction}
83 % In many cases it is helpful when referring to a figure or table to
84 % put both a |\ref| and a |\pageref| command into the document
85 % especially when there are one or more pages between the reference
86 % and the object. Therefore some people use a command like
88 % \newcommand{\fullref}[1]{\ref{#1} on page~\pageref{#1}}
90 % which reduces the number of key strokes, necessary to make such a
91 % complete reference. But since one never knows where the referenced
92 % object finally falls, using such a device may result in a page
93 % reference to the current page which is disturbing and therefore
98 % \section{The user interface}
100 %\DescribeMacro\vref The implementation of |\vref| below produces only
101 % a |\ref| when reference and |\label| are on the same page. It will
102 % additionally produce one of the strings `on the facing page', `on
103 % the preceding page', or `on the following page', if label and
104 % reference differ by one and it will produce both |\ref| and
105 % |\pageref| when the difference is larger. The word `facing' is used
106 % when label and reference both fall onto a double spread. However,
107 % if a special page numbering scheme is used instead of the usual
108 % arabic numbering (e.g., |\pagenumbering{roman}|) then there will be
109 % no distinction between one or many pages off.
111 %\DescribeMacro\vpageref Sometimes one wants to refer only to page
112 % number and again such a reference should normally be suppressed if
113 % we are referring to the current page. For this purpose the package
114 % defines the |\vpageref| command. It will produce the same strings as
115 % |\vref| except that it doesn't start with the |\ref| and except that
116 % it will produce the string that is saved in |\reftextcurrent| if
117 % label and reference fall onto the same page. By defining
118 % |\reftextcurrent| to produce ``on this page'' or something similar,
121 % ... see the example \vpageref{ex:foo} which shows ...
123 % comes out as ``\ldots~see the example which shows~\ldots'', which
124 % could be misleading.
126 % You can put a space in front of |\vpageref| it will be ignored if
127 % the command doesn't produce any text at all.
129 % But in fact |\vpageref| allows even more control. If has two
130 % optional arguments. With the first one, one can specify the text
131 % that should be used if label and reference fall on the same page.
132 % This is very helpful if both are near to each other, so that they
133 % may or may not be separated by a page break. In such a case we
134 % usually know (!) whether the reference is before or after the label
135 % so that we can say something like
137 % ... see the example \vpageref[above]{ex:foo} which shows ...
139 % which will then come out as ``\ldots~see the example above which
140 % shows~\ldots'' if we are still on the same page, but as ``\ldots~see
141 % the example on the page before which shows~\ldots'' (or something
142 % similar depending on the settings of the |\reftext..before|
143 % commands) when there was a page break in the meantime. One warning
144 % however, if you use |\vpageref| with the optional argument to refer
145 % to a figure or table, keep in mind that depending on the float
146 % placement parameters the float may show up on top of the current
147 % page and therefore before the reference even if it came after it in
150 % But maybe you prefer to say ``\ldots~see the above example'' if
151 % example and reference fall onto the same page, i.e., reverse the
152 % word order. In fact, in some languages the word order automatically
153 % changes in that case. To allow for this variation the second
154 % optional argument can be used. It specifies the text preceding the
155 % generated reference if object and reference do not fall onto the
156 % same page. Thus one would write
158 % ... see the \vpageref[above example][example]{ex:foo}
161 % to achieve the desired effect.
164 % \DescribeMacro\vrefrange
166 % This command is similar to |\vref| but it
167 % takes two mandatory arguments denoting a range to refer to (e.g., a
168 % sequences of figures or a sequence of equations, etc.). So if
169 % |fig:a| is your first figure in the sequence and |fig:c| your last
172 % ... see figures \vrefrange{fig:a}{fig:c} ...
174 % which would then be formatted as
176 % \ldots\ see figures 3.4 to 3.6 on pages 23--24 \ldots
178 % or, if they happen to all fall onto the next page, as
180 % \ldots\ see figures 3.4 to 3.6 on the following page \ldots
182 % i.e., the command is deciding what to say depending on where the two
183 % labels are placed in relation to each other; it is essentially
184 % implemented using |\vpagerefrange| described below.
185 % The optional argument the command may take is the text to use in case
186 % both labels are placed on the current page.
189 % \DescribeMacro\vpagerefrange This command is similar to |\vpageref|
190 % but takes two mandatory arguments which are two labels denoting a
191 % range. If both labels fall onto the same page, the command acts
192 % exactly like |\vpageref| (with a single label), otherwise it produces
193 % something like ``on pages~15--18'' (see customization possibilities
194 % below). The optional argument it may take is the text to use in case
195 % both labels are placed on the current page.
197 % \DescribeMacro\vrefpagenum This macro is provided to allow the user
198 % to write their own small commands which implement functions similar
199 % to those provided by the two previous commands. It takes two
200 % arguments: the second is a label (i.e., as used in |\label| or
201 % |\ref|) and the first is an arbitrary command name (make sure you
202 % use our own) that receives the page number related to this label.
203 % So if you have two (or more) labels you could retrieve their page
204 % numbers, compare them and then decide what to print. For example,
205 % the following not very serious definition (also using the
206 % \texttt{ifthen} package)
208 % \newcommand\amusingversion[2]{%
209 % \vrefpagenum\firstnum{#1}%
210 % \vrefpagenum\secondnum{#2}%
212 % \ifthenelse{\equal\firstnum\secondnum}%
213 % {s of \ref{#1} and \ref{#2} \vpageref{#1}}%
214 % { of \ref{#1} \vpageref{#1} and of \ref{#2} \vpageref{#2}}%
217 % ...\amusingversion{foo}{bar}
219 % will print something like
221 % \ldots the definitions of 3 and 4 on the previous page
223 % in the case both labels are on the same page but something like
225 % \ldots the definition of 3 on the next page and of 4 on page~13
227 % in case the are on different pages.
230 % The user commands |\vref|, |\vpageref|, and |\vpagerefrange| all
232 % work by first removing any space on their left and then inserting
233 % some space of their own (|\vref|, for example, a nonbreakable
234 % space). That seemed like a good idea back then, but it has the
235 % disadvantage that you can't use these macros in situations where you
236 % definitely do not want any space before the generated text. E.g., in
237 % situations like |(\vref{foo} ...)| you end up with a space after the
240 % \DescribeMacro{\vref*}
241 % \DescribeMacro{\vpageref*}
242 % \DescribeMacro{\vpagerefrange*}
243 % Since it is too late to change the default behaviour I've added star
244 % versions of the macros which do not add any space before the
245 % generated text (they do nevertheless remove space at the left).
249 % \DescribeMacro\labelformat
251 % A reference via |\ref| produces by default the data associated with
252 % the corresponding |\label| command (typically a number); any
253 % additional formatting has to be provided by the user. If, for
254 % example, references to equations are always to be typeset as
255 % ``equation (\textit{number})'', one has to code
256 % ``\verb=equation (\ref{=\textit{key}\verb=})=''. With |\labelformat|
257 % the \texttt{varioref} package offers a possibility to generate such
258 % frills automatically. The command takes two arguments: the first is
259 % the name of a counter and the second is its representation when
260 % referenced. This means that for a successful usage, one has to know
261 % the counter name being used for generating the label, though in
262 % practice this should not pose a problem. The current counter number
263 % is picked up as an argument.
264 % Here are two examples:
266 % \labelformat{section}{section~#1}
267 % \labelformat{equation}{equation~(#1)}}
271 % \DescribeMacro\Vref
273 % A side effect of using |\labelformat| is that, depending on the
274 % defined formatting, it becomes impossible to use |\ref| at the
275 % beginning of a sentence (if its replacement text starts with a
276 % lowercase letter). To overcome this problem \texttt{varioref}
277 % introduces the commands |\Ref| and |\Vref| that behave like
278 % |\ref| and |\{vref| except that they uppercase the first token
279 % of the generated string.
281 % To make |\Ref| or |\Vref| work properly the very first token in
282 % the second argument of |\labelformat| has to be a simple \textsc{ascii}
283 % letter, otherwise the capitalization will fail or worse, you will end
284 % up with some error messages. If you actually need something more
285 % complicated in this place (e.g., an accented letter)
286 % you have to explicitly surround it with braces, to
287 % identify the part that needs to be capitalized. For example, for
288 % figure references in the Hungarian language you might want to write
289 % |\labelformat{figure}{{\'a}bra~\thefigure}|.
291 % \DescribeMacro\vpagerefnum
292 % If you like to have |\vref| suppress the page number on pages where
293 % label and reference fall onto the same page, but prefer reference to
294 % page numbers otherwise then |\vpagerefnum| can be used. This macro
295 % hold the current page ``number'' when |\vpageref| and friends are
296 % executed. Thus, by defining, for example
298 %\renewcommand\reftextfaceafter {on page~\thevpagerefnum}
299 %\renewcommand\reftextfacebefore{on page~\thevpagerefnum}
300 %\renewcommand\reftextafter {on page~\thevpagerefnum}
301 %\renewcommand\reftextbefore {on page~\thevpagerefnum}
303 % textual references can be suppressed.
305 % \section{Multi-lingual usage}
307 % The package works well together with the babel system if it is
308 % loaded \textit{after} the babel package, e.g., a document in English
309 % (default), French and German text could load the packages as
312 % \usepackage[ngerman,french,english]{babel,varioref}
314 % (or in two separate lines if you prefer one |\usepackage| line per
315 % package). Depending on the current babel language |\vref| and
316 % friends would then generate strings in different languages. If the
317 % language options are given as global options to the document class
318 % then it is enough to use
320 % \usepackage{babel,varioref}
322 % to achieve the same effect.
324 % If more than one language is specified with \texttt{varioref} then
325 % it will start using the last language selected. Switching of
326 % languages is managed through Babel; nevertheless all languages of
327 % interest need to be specified when \texttt{varioref} is loaded so
328 % that it can integrate their strings into the Babel system.
331 % \section{Customization}
333 % The package supports all options defined by the babel package to
334 % translate the fixed strings into other languages than English.
335 % (Some languages need updating, however---help is appreciated.) It
336 % also supports languages currently not in babel (those can only be
337 % used standalone, obviously); check the section on options later~on.
342 % You can also modify some or all of the strings by redefining the
343 % following commands after the package has been loaded.
344 %\DescribeMacro\reftextbefore
345 %\DescribeMacro\reftextfacebefore
346 %\DescribeMacro\reftextafter
347 %\DescribeMacro\reftextfaceafter Backward references use
348 % |\reftextbefore| if the label is on the preceding page but invisible
349 % and |\reftextfacebefore| if it is one the facing page (i.e., if the
350 % current page number is odd). Similarly |\reftextafter| is used
351 % when the label comes on the next page but one has to turn the page
352 % and |\reftextfaceafter| if it is on the following but facing page.
354 % In fact, |\reftextface...| is used only if the user or the document
355 % class specified two-sided printing.
357 %\DescribeMacro\reftextfaraway Finally we have |\reftextfaraway| which
358 % is used whenever label and reference differ by more than one or when
359 % they aren't numeric. This macro is a bit different because it takes
360 % one argument, the symbolic reference string so that one cane make
361 % use of |\pageref| in its replacement text.
364 %\DescribeMacro\reftextvario To allow a bit random variation in the
365 % generated strings one can use the command |\reftextvario| inside the
366 % string macros. It takes two arguments and selects one or the other
367 % for printing depending on the number of already seens |\vref| or
368 % |\vpageref| commands. As an example see the definitions of
369 % |\reftextbefore| etc.\ \vpageref[below]{reftextbefore}.
371 % The commands |\vrefrange| and |\vpagerefrange| produce their text
373 % using two macros described below. By redefining them one can modify
374 % the results to accommodate special requirements.
377 % They both take two mandatory arguments denoting the first and the
378 % last label of the range.
381 % \DescribeMacro\reftextpagerange This macro produces text that
382 % describes the page range of the two labels, e.g., the default
383 % for English is ``|on pages~\pageref{#1}--\pageref{#2}}|''.
386 % \DescribeMacro\reftextlabelrange This macro produces text that
387 % describes the range of figures, tables, or whatever the labels refer
388 % to, the default for English is ``|\ref{#1} to~\ref{#2}|''.
390 % \subsection{\ldots\ if Babel is used}
392 % \begin{itshape} If babel is being used then the above commands need to be
393 % changed using the Babel mechanism, e.g.,
395 % \addto\extrasngerman{%
396 % \renewcommand\reftextfaceafter {auf der n\"achsten Seite}%
399 % Otherwise babel will reintroduce its own defaults whenever the language is
400 % changed (which happens in particular during |\begin{document}| where the
401 % main language is selected).
409 % As mentioned above the package supports all standard options offered
410 % by the Babel system to customize the strings produced, it may also
411 % have a few not supported by babel, for a full list look
412 % in section\vref{sec:impoptions}. In addition it offers the option
413 % \texttt{draft} to turn error messages into warnings during
414 % development. The default \texttt{final} produces error message when
415 % a generated string falls onto a page boundary (see next section).
418 % \section{A few warnings}
420 % Defining commands like the ones described above poses some
421 % interesting problems. Suppose, for example, that a generated text
422 % like `on the next page' gets broken across pages. If this happens it
423 % is very difficult to find an acceptable solution and in fact can
424 % even result in a document that will always change from one state to
425 % another (i.e., inserting one string, finding that this is wrong,
426 % inserting another string on the next run which makes the first
427 % string correct again, inserting \ldots). The current implementation
428 % of \texttt{varioref} therefore issues an error message whenever the
429 % generated text is broken across page boundaries, e.g.,
431 % table 5 on the current \meta{page break} page
433 % would would result in an error, which needs to be resolved by the
434 % user by replacing the |\vref| command with an ordinary |\ref| just
435 % before the final run. This is not
436 % completely satisfactory but in such case no solution really is.
437 % \DescribeMacro\vrefwarning
438 % During document preparation, while one is still changing the text,
439 % such error messages can be turned into warnings by placing a
440 % |\vrefwarning| command in the preamble. This is equivalent to
441 % specifying ``draft'' as an option to the package.
442 % \DescribeMacro\vrefshowerrors
443 % |\vrefshowerrors| ensures that varioref stops when detecting a
444 % possible loop. This is the default and equivalent to specifying
445 % ``final'' as an option.
447 % At the end final a warning: every use of |\vref| will internally
448 % generate two macro names to keep track of the string positions
449 % within the document. As a result you may run out of name space or
450 % main memory if you make heavy use of this macro on a small \TeX{}
452 %\DescribeMacro\fullref For this reason the primitive command
453 % |\fullref| is also provided. This command can be used whenever you
454 % know for sure that label and reference can't fall onto nearby pages.
456 % \StopEventually{\PrintIndex\PrintChanges}
459 % \section{The documentation driver file}
461 % The next bit of code contains the documentation driver file for
462 % \TeX{}, i.e., the file that will produce the documentation you are
463 % currently reading. It will be extracted from this file by the
464 % \texttt{docstrip} program.
467 \documentclass{ltxdoc}
468 \usepackage{multicol,varioref}
469 \GetFileInfo{varioref.sty}
470 \setlength\hfuzz{1pt} % ignore slight overfulls
472 %\DisableCrossrefs % Say \DisableCrossrefs if index is ready
474 \RecordChanges % Gather update information
475 %\OnlyDescription % comment out for implementation details
477 \DocInput{varioref.dtx}
483 % \section{The implementation}
485 % The main implementation idea is to generate an internal label
486 % command for every |\vpageref| and compare the page reference of this
487 % label with the page reference of the user-requested label. Since
488 % this means one additional macro name for each use of |\vpageref| or
489 % |vref| (which is implemented in terms of |\vpageref|) the memory
490 % requirements of this package may be high in terms of main and macro
491 % name memory. Since the information held in the internal labels is
492 % used only once one could envision a different scheme if suitable
493 % primitives for this kind of ``one place information'' would be
494 % provided by \LaTeX. This type of data structure is planned for
495 % \LaTeX3 but for the moment we have to live with the memory
498 % We start by checking if this file was already loaded. If not we
499 % identify the current version. This is actually done at the top
500 % of the file, so we comment it out here
501 % \changes{v0.1h}{1993/08/15}{Small documentation changes}
504 %\NeedsTeXFormat{LaTeX2e}[1994/06/01]
505 %\ProvidesPackage{varioref}[\filedate\space\fileversion\space
506 % LaTeX2e package for extended references (FMi)]
510 % \begin{macro}{\vref@addto}
511 % \changes{v1.0b}{1994/01/31}{Avoid using babel `addto}
512 % \changes{v1.0b}{1994/01/31}{The babel commands are starting
514 % To support the use of babel we want to add the additional strings
515 % to the |\extras|\meta{language} commands. Since |\addto| in the
516 % current implementation of babel has a bug that does not allow to
517 % use arguments containing hashmarks we do this by hand.
519 \def\vref@addto#1#2{%
523 \edef#1{\the\@temptokena}%
525 \toks@\expandafter{#1}%
526 \edef#1{\the\toks@\the\@temptokena}%
528 \@temptokena{}\toks@\@temptokena
530 \@onlypreamble\vref@addto
535 % \subsection{Options}\label{sec:impoptions}
537 % \begin{macro}{\vref@excuse}
538 % Excuse that we don't know the strings for a certain language.
539 % \changes{v1.0q}{1995/04/06}{Use `PackageWarning}
542 \PackageWarningNoLine{varioref}{Sorry, language `#1'
546 English strings used by default.
548 Please modify \protect\reftext... commands manually.%
549 \MessageBreak\MessageBreak
550 If you can suggest translations for
554 to the author of this package}}
555 \@onlypreamble\vref@excuse
559 % \begin{macro}{\vref@stringwarning}
560 % And we sometimes just don't know some strings~\ldots
561 % \changes{v1.2a}{1998/08/01}{Macro added}
563 \def\vref@stringwarning#1{%
564 \PackageWarningNoLine{varioref}{Sorry, there is no proper
565 translation for the string\MessageBreak
566 produced by \protect#1\on@line.\MessageBreak
567 English string used instead.\MessageBreak
569 If you can suggest translations for
570 the current\MessageBreak
571 language, please mail them
572 to the author of this\MessageBreak package}}
577 % \begin{macro}{\reftextfaceafter}
578 % \begin{macro}{\reftextfacebefore}
579 % \begin{macro}{\reftextafter}
580 % \begin{macro}{\reftextbefore}
581 % \begin{macro}{\reftextcurrent}
582 % \label{reftextbefore} The options do set the macros that
583 % generate the textual strings. Note, that they do not start with a
584 % space, the space is already added in the main macro below.
585 % \changes{v1.2a}{1998/08/22}{Added american defaults for
586 % \cs{reftextpagerange} and \cs{reftextlabelrange}}
587 % \changes{v1.4d}{2002/11/11}{Changed default for \cs{reftextbefore}}
589 % Afrikaans option contributed by Danie Els
590 % (\texttt{dnjels@sun.ac.za}).
591 % \changes{v1.4g}{2003/03/29}{Added afrikaans option}
593 \DeclareOption{afrikaans}
594 {\vref@addto\extrasafrikaans{%
595 \def\reftextfaceafter {op die \reftextvario{regterbladsy}%
597 \def\reftextfacebefore{op die \reftextvario{linkerbladsy}%
599 \def\reftextafter {op die \reftextvario{volgende bladsy}%
601 \def\reftextbefore {op die \reftextvario{vorige bladsy}%
603 \def\reftextcurrent {op \reftextvario{hierdie}%
604 {die huidige} bladsy}%
605 \def\reftextfaraway#1{op bladsy~\pageref{#1}}%
606 \def\reftextpagerange#1#2{op bladsye~\pageref{#1}--\pageref{#2}}%
607 \def\reftextlabelrange#1#2{\ref{#1} tot~\ref{#2}}%
612 \DeclareOption{american}
613 {\vref@addto\extrasamerican{%
614 \def\reftextfaceafter {on the \reftextvario{facing}{next} page}%
615 \def\reftextfacebefore{on the \reftextvario{facing}{preceding}
617 \def\reftextafter {on the \reftextvario{following}{next} page}%
618 \def\reftextbefore {on the \reftextvario{preceding}{previous} page}%
619 \def\reftextcurrent {on \reftextvario{this}{the current} page}%
620 \def\reftextfaraway#1{on page~\pageref{#1}}%
621 \def\reftextpagerange#1#2{on pages~\pageref{#1}--\pageref{#2}}%
622 \def\reftextlabelrange#1#2{\ref{#1} to~\ref{#2}}%
625 % \changes{v1.2a}{1998/11/27}{Added austrian defaults (identical to german)}
626 % The austrian defaults are the same as the german ones.
628 \DeclareOption{austrian}
629 {\vref@addto\extrasaustrian{%
630 \def\reftextfaceafter {auf der n\"achsten Seite}%
631 \def\reftextfacebefore{auf der vorherigen Seite}%
632 \let\reftextafter \reftextfaceafter
633 \let\reftextbefore \reftextfacebefore
634 \def\reftextcurrent {auf dieser Seite}%
635 \def\reftextfaraway#1{auf Seite~\pageref{#1}}%
636 \def\reftextpagerange#1#2{auf Seiten~\pageref{#1}--\pageref{#2}}%
637 \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}%
640 % \changes{v1.2d}{2000/01/11}{Added naustrian defaults (identical to german)}
641 % The naustrian defaults are the same but needed for ``Neue Rechtschreibung''.
643 \DeclareOption{naustrian}
644 {\vref@addto\extrasnaustrian{%
645 \def\reftextfaceafter {auf der n\"achsten Seite}%
646 \def\reftextfacebefore{auf der vorherigen Seite}%
647 \let\reftextafter \reftextfaceafter
648 \let\reftextbefore \reftextfacebefore
649 \def\reftextcurrent {auf dieser Seite}%
650 \def\reftextfaraway#1{auf Seite~\pageref{#1}}%
651 \def\reftextpagerange#1#2{auf Seiten~\pageref{#1}--\pageref{#2}}%
652 \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}%
655 % Text for basque defaults was contributed by
656 % I\~naki Larra\~naga Murgoitio (aka dooteo)
657 % (|<dooteo@euskalgnu.org>|).
658 % \changes{v1.4k}{2005/04/09}{Basque defaults added.}
660 \DeclareOption{basque}
661 {\vref@addto\extrasbasque{%
662 \def\reftextfaceafter {hurrengo orrialdean}%
663 \def\reftextfacebefore{aurreko orrialdean}%
664 \let\reftextafter \reftextfaceafter
665 \let\reftextbefore \reftextfacebefore
666 \def\reftextcurrent {uneko orrialdean}%
667 \def\reftextfaraway#1{~\pageref{#1}. orrialdean}%
668 \def\reftextpagerange#1#2{~\pageref{#1}--\pageref{#2} orrialdeetan}%
669 \def\reftextlabelrange#1#2{\ref{#1}.etik \ref{#2}.eraino}%
672 % Text for the Bahasa Malaysia defaults was contributed by
673 % Bob Margolis 2005-12-02.
675 % Notes: pada muka surat translates as ``on the page'' though BM has no
676 % definite (or indefinite) article; adjectives and other modifiers follow
677 % the noun (clause); bertentangan is ``opposite'' in the sense of
678 % ``facing''; berikutnya is ``next'' (in this context - actually
679 % next-to-this, literally); berikutnya also translates as ``following
680 % this'' sebelumnya is ``preceding''; also ``previous'' ``ini'' translates,
681 % literally, as ``this'' but is also used in the sense of current page.
682 % \changes{v1.4o}{2005/12/02}{Bahasa Malaysia defaults added.}
684 \DeclareOption{bahasam}
685 {\vref@addto\extrasbahasam{%
686 \def\reftextfaceafter {pada muka surat \reftextvario{bertentangan}{berikutnya}}%
687 \def\reftextfacebefore{pada muka surat \reftextvario{bertentangan}{sebelumnya} }%
688 \def\reftextafter {pada muka surat berikutnya}%
689 \def\reftextbefore {pada muka surat sebelumnya}%
690 \def\reftextcurrent {pada muka surat ini}%
691 \def\reftextfaraway#1{pada muka surat~\pageref{#1}}%
692 \def\reftextpagerange#1#2{pada muka surat~\pageref{#1}--\pageref{#2}}%
693 \def\reftextlabelrange#1#2{\ref{#1}--\ref{#2}}%
696 % Text for brazil defaults was contributed by
697 % Alcino Dall Igna Junior\\
698 % (|adij@di.ufpe.br|).
699 % \changes{v1.0g}{1994/05/18}{Brazil defaults added.}
700 % \changes{v1.4o}{2005/11/07}{Added a few more brazil strings}
701 % \changes{v1.4r}{2007/05/26}{Misspelling of \cs{extrasbrazil}}
703 \DeclareOption{brazil}
704 {\vref@addto\extrasbrazil{%
705 \def\reftextfaceafter {na \reftextvario{p\'agina oposta}{pr\'oxima
707 \def\reftextfacebefore{na p\'agina \reftextvario{oposta}{anterior}}%
708 \def\reftextafter {na \reftextvario{p\'agina seguinte}{pr\'oxima
710 \def\reftextbefore{na p\'agina \reftextvario{anterior}{precedente}}%
711 \def\reftextcurrent {\reftextvario{nesta p\'agina}{na p\'agina
713 \def\reftextfaraway#1{na p\'agina~\pageref{#1}}%
714 \def\reftextpagerange#1#2{nas p\'aginas~\pageref{#1}--\pageref{#2}}%
715 \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
718 % Text for Breton defaults was contributed by
719 % Christian ROLLAND\\
720 % (|Christian.Rolland@univ-brest.fr|).
721 % \changes{v1.0o}{1994/09/27}{Added defaults for breton}
723 \DeclareOption{breton}
724 {\vref@excuse{breton}%
725 \vref@addto\extrasbreton{%
726 \def\reftextfaceafter {war ar bajenn \reftextvario{a-dal}{da heul}}%
727 \def\reftextfacebefore{war ar bajenn \reftextvario{a-dal}{a-raok}}%
728 \def\reftextafter {war ar bajenn da heul}%
729 \def\reftextbefore {war ar bajenn a-raok}%
730 \def\reftextcurrent {war ar \reftextvario{bajenn-ma\~n}%
732 \def\reftextfaraway#1{war ar bajenn~\pageref{#1}}%
733 \def\reftextpagerange#1#2{\vref@stringwarning\reftextpagerange
734 on pages~\pageref{#1}--\pageref{#2}}%
735 \def\reftextlabelrange#1#2{\vref@stringwarning\reflabelpagerange
736 \ref{#1} to~\ref{#2}}%
739 % Text for Bulgarian defaults was contributed by
740 % Georgi Boshnakov\\ (|georgi.boshnakov@gmail.com|).
741 % \changes{v1.4q}{2006/05/23}{Added defaults for bulgarian}
743 \DeclareOption{bulgarian}%
744 {\vref@addto\extrasbulgarian{%
745 \def\reftextfaceafter{\cyrn\cyra\
746 \reftextvario{\cyrs\cyrery\cyrs\cyre\cyrd\cyrn\cyra\cyrt\cyra}%
747 {\cyrs\cyrl\cyre\cyrd\cyrv\cyra\cyrshch\cyra\cyrt\cyra}
748 \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
749 \def\reftextfacebefore{\cyrn\cyra\
750 \reftextvario{\cyrs\cyrery\cyrs\cyre\cyrd\cyrn\cyra\cyrt\cyra}%
751 {\cyrp\cyrr\cyre\cyrd\cyrn\cyra\cyrt\cyra}
752 \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
753 \def\reftextafter{\cyrn\cyra\
754 \reftextvario{\cyrs\cyrl\cyre\cyrd\cyrv\cyra\cyrshch\cyra\cyrt\cyra}%
755 {\cyrs\cyrl\cyre\cyrd\cyrv\cyra\cyrshch\cyra\cyrt\cyra}
756 \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
757 \def\reftextbefore{\cyrn\cyra\
758 \reftextvario{\cyrp\cyrr\cyre\cyrd\cyrn\cyra\cyrt\cyra}%
759 {\cyrp\cyrr\cyre\cyrd\cyri\cyrsh\cyrn\cyra\cyrt\cyra}
760 \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
761 \def\reftextcurrent{\cyrn\cyra\
762 \reftextvario{\cyrt\cyra\cyrz\cyri}%
763 {\cyrt\cyre\cyrk\cyru\cyrshch\cyra\cyrt\cyra}
764 \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
765 \def\reftextfaraway#1{\cyrn\cyra\ \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra
767 \def\reftextpagerange#1#2{\cyrn\cyra\
768 \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyri
769 ~\pageref{#1}--\pageref{#2}}%
770 \def\reftextlabelrange#1#2{\ref{#1} \cyrd\cyro~\ref{#2}}%
773 % Text for catalan defaults was contributed by Robert Fuster\\
774 % (\verb=rfuster@mat.upv.es=).
775 % \changes{v1.1c}{1997/06/12}{Added defaults for catalan}
776 % \changes{v1.2g}{2000/08/22}{Updated defaults for catalan}
778 \DeclareOption{catalan}
779 {\vref@addto\extrascatalan{%
780 \def\reftextfaceafter {a la p\`agina seg\"uent}%
781 \def\reftextfacebefore{a la p\`agina anterior}%
782 \let\reftextafter \reftextfaceafter
783 \let\reftextbefore \reftextfacebefore
784 \def\reftextcurrent {en aquesta p\`agina}%
785 \def\reftextfaraway#1{a la p\`agina~\pageref{#1}}%
786 \def\reftextpagerange#1#2{a les
787 p\`agines~\pageref{#1}--\pageref{#2}}%
788 \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
791 % Text for croatian defaults was contributed by \v{S}ime Ungar
792 % (\verb=ungar@math.hr=).
793 % \changes{v1.4p}{2006/05/13}{Added defaults for croatian}
795 \DeclareOption{croatian}
796 {\vref@addto\extrascroatian{%
797 \def\reftextfaceafter {na sljede\'coj stranici}%
798 \def\reftextfacebefore{na prethodnoj stranici}%
799 \let\reftextafter \reftextfaceafter
800 \let\reftextbefore \reftextfacebefore
801 \def\reftextcurrent {na ovoj stranici}%
802 \def\reftextfaraway#1{na stranici~\pageref{#1}}%
803 \def\reftextpagerange#1#2{na stranicama~\pageref{#1}--\pageref{#2}}%
804 \def\reftextlabelrange#1#2{\ref{#1} do~\ref{#2}}%
807 % Defaults for the Czech option provided by Milan Vancura
808 % \verb=<milan@suse.cz>=.
809 % \changes{v1.2e}{2000/04/04}{Added czech defaults}
811 \DeclareOption{czech}
812 {%\vref@excuse{czech}%
813 \vref@addto\extrasczech{%
814 \def\reftextfaceafter {na n\'a\-sle\-du\-j\'\i c\'\i\ stran\v{e}}%
815 \def\reftextfacebefore{na p\v{r}ed\-choz\'\i\ stran\v{e}}%
816 \def\reftextafter {na n\'a\-sle\-du\-j\'\i c\'\i\ stran\v{e}}%
817 \def\reftextbefore {na p\v{r}ed\-choz\'\i\ stran\v{e}}%
818 \def\reftextcurrent {na t\'eto stran\v{e}}%
819 \def\reftextfaraway#1{na stran\v{e}~\pageref{#1}}%
820 \def\reftextpagerange#1#2{na stran\'ach~\pageref{#1}\--\pageref{#2}}%
821 \def\reftextlabelrange#1#2{\ref{#1} a\v{z}~\ref{#2}}%
824 % Defaults for Danish provided by Torsten Martinsen
825 % (\verb=tmar91@kom.auc.dk=). Further defaults by Ole Laursen
826 % (\verb=olau@hardworking.dk=).
827 % \changes{v1.0n}{1994/09/25}{Added Danish defaults}
828 % \changes{v1.2h}{2000/12/30}{Updates to Danish defaults}
830 \DeclareOption{danish}
831 {\vref@addto\extrasdanish{%
832 \def\reftextfaceafter {p\aa{} \reftextvario{modst\aa ende}%
834 \def\reftextfacebefore{p\aa{} \reftextvario{modst\aa ende}%
836 \def\reftextafter {p\aa{} \reftextvario{den f\o lgende}%
838 \def\reftextbefore {p\aa{} \reftextvario{forrige side}
839 {foreg\aa ende side}}%
840 \def\reftextcurrent {p\aa{} denne side}%
841 \def\reftextfaraway#1{p\aa{} side~\pageref{#1}}%
842 \def\reftextpagerange#1#2{p\aa{} side~\pageref{#1}--\pageref{#2}}%
843 \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}%
846 % Default string for dutch have been contributed by Frank Poppe
847 % (\verb=POPPE@SWOV.NL=).
848 % This option currently supports one additional string macro
849 % |\refpagename| so that you can easily change to |bladzijde|
850 % instead of |pagina| if you prefer this word for ``page''.
851 % However, I will not guarantee that this will survive future
852 % versions of this package, so use it on your own risk (you can
853 % always update the full strings to be on the safe side).
854 % \changes{v1.0l}{1994/07/07}{Added dutch defaults}
855 % \changes{v1.2a}{1998/08/22}{Added dutch defaults for
856 % \cs{reftextpagerange} and \cs{reftextlabelrange}}
858 \DeclareOption{dutch}
859 {\vref@addto\extrasdutch{%
860 \def\refpagename{pagina}%
861 \def\reftextfaceafter {op de \reftextvario{rechter \refpagename}%
862 {\refpagename\ hiernaast}}%
863 \def\reftextfacebefore{op de \reftextvario{linker \refpagename}%
864 {\refpagename\ hiernaast}}%
865 \def\reftextafter {op de \reftextvario{volgende \refpagename}%
866 {\refpagename\ hierna}}%
867 \def\reftextbefore {op de \reftextvario{vorige \refpagename}%
868 {\refpagename\ hiervoor}}%
869 \def\reftextcurrent {op deze \refpagename}%
870 \def\reftextfaraway#1{op \refpagename~\pageref{#1}}%
872 % Concerning the next defaults I received the following comment by
873 % Frederik Fouvry \texttt{<fouvry@coli.uni-sb.de>}:
874 % ``In the Dutch options (where I can exert a proper language
875 % judgement ;-), `t/m' is not used in formal (scientific) texts. I
876 % would either use `--' or `tot en met' (the abbreviation written
878 % \changes{v1.4d}{2002/11/11}{Changed default for \cs{reftextlabelrange}}
879 % \changes{v1.4m}{2005/06/09}{Fixed \cs{reftextlabelrange} (pr/3791)}
881 \def\reftextpagerange#1#2{op pagina's~\pageref{#1}--\pageref{#2}}%
882 \def\reftextlabelrange#1#2{\ref{#1}--\ref{#2}}%
885 % \changes{v1.2a}{1998/08/22}{Added english defaults for
886 % \cs{reftextpagerange} and \cs{reftextlabelrange}}
887 % \changes{v1.4d}{2002/11/11}{Changed default for \cs{reftextbefore}}
889 \DeclareOption{english}
890 {\vref@addto\extrasenglish{%
891 \def\reftextfaceafter {on the \reftextvario{facing}{next} page}%
892 \def\reftextfacebefore{on the \reftextvario{facing}{preceding}
894 \def\reftextafter {on the \reftextvario{following}{next} page}%
895 \def\reftextbefore {on the \reftextvario{preceding}{previous} page}%
896 \def\reftextcurrent {on \reftextvario{this}{the current} page}%
897 \def\reftextfaraway#1{on page~\pageref{#1}}%
898 \def\reftextpagerange#1#2{on pages~\pageref{#1}--\pageref{#2}}%
899 \def\reftextlabelrange#1#2{\ref{#1} to~\ref{#2}}%
903 % The esperanto strings were suggested by Albert Reiner
904 % (\verb=areiner@tph.tuwien.ac.at=).
905 % \changes{v1.4x}{2010/08/04}{Defaults for esperanto added}
907 \DeclareOption{esperanto}
908 {\vref@addto\extrasesperanto{%
909 \def\reftextfaceafter{en la
910 \reftextvario{flanka}{sekva} pa\^go}%
911 \def\reftextfacebefore{en la
912 \reftextvario{flanka}{anta\u ua} pa\^go}%
913 \def\reftextafter{en la sekva pa\^go}%
914 \def\reftextbefore{en la anta\u ua pa\^go}%
915 \def\reftextcurrent{\reftextvario{\^ci-pa\^ge}%
916 {en \^ci tiu pa\^go}}%
917 \def\reftextfaraway#1{en pa\^go~\pageref{#1}}%
918 \def\reftextpagerange#1#2{en pa\^goj~\pageref{#1} \^gis \pageref{#2}}%
919 \def\reftextlabelrange#1#2{\ref{#1} \^gis~\ref{#2}}%
922 % The finnish strings were suggested by Matti Rintala
923 % (\verb=bitti@cs.tut.fi=) and Hillevi Gavel
924 % \verb=Hillevi.Gavel@mdh.se=.
925 % \changes{v1.0m}{1994/09/23}{Added finnish strings}
926 % \changes{v1.4o}{2005/11/07}{Added a few more finnish strings}
928 \DeclareOption{finnish}
929 {\vref@addto\extrasfinnish{%
930 \def\reftextfaceafter {\reftextvario{viereisell\"a}%
931 {seuraavalla} sivulla}%
932 \def\reftextfacebefore{\reftextvario{viereisell\"a}%
933 {edellisell\"a} sivulla}%
934 \def\reftextafter {seuraavalla sivulla}%
935 \def\reftextbefore {edellisell\"a sivulla}%
936 \def\reftextcurrent {t\"all\"a sivulla}%
937 \def\reftextfaraway#1{sivulla~\pageref{#1}}%
938 \def\reftextpagerange#1#2{sivuilla~\pageref{#1}--\pageref{#2}}%
940 % Can't combine numbers with the necessary suffix well.
942 \def\reftextlabelrange#1#2{\ref{#1}--\ref{#2}}%
945 % French defaults are provided by Daniel Flippo
946 % (\verb=Daniel.Flipo@univ-lille1.fr=).
947 % \changes{v1.0j}{1994/06/21}{Added french defaults}
948 % \changes{v1.2a}{1998/08/22}{Added french defaults for
949 % \cs{reftextpagerange} and \cs{reftextlabelrange}}
951 \DeclareOption{french}
952 {\vref@addto\extrasfrench{%
953 \def\reftextfaceafter {page \reftextvario{ci-contre}{suivante}}%
954 \def\reftextfacebefore{page \reftextvario{ci-contre}%
956 \def\reftextafter {page suivante}%
957 \def\reftextbefore {page pr\'ec\'edente}%
958 \def\reftextcurrent {de la pr\'esente page}%
959 \def\reftextfaraway#1{page~\pageref{#1}}%
960 \def\reftextpagerange#1#2{pages~\pageref{#1}--\pageref{#2}}%
961 \def\reftextlabelrange#1#2{\ref{#1} \`a~\ref{#2}}%
964 % Galician defaults are provided by Matthias Moebius\\
965 % (\texttt{Matthias.Moebius@uni-konstanz.de}).
966 % \changes{v1.1f}{1998/04/25}{Added galician defaults}
967 % \changes{v1.4o}{2005/11/10}{Added further galician defaults}
968 % \changes{v1.4o}{2005/11/26}{Some further corrections}
969 % \changes{v1.5b}{2015/09/22}{Fixed blunder from 2005 -
970 % galician option clearly never used}
972 \DeclareOption{galician}
973 {\vref@addto\extrasgalician{%
974 \def\reftextfaceafter {na p\'axina oposta}%
975 \def\reftextfacebefore\reftextfaceafter
976 \def\reftextafter {na p\'axina seguinte}%
977 \def\reftextbefore {na p\'axina anterior}%
978 \def\reftextcurrent {nesta p\'axina}%
979 \def\reftextfaraway#1{na p\'axina~\pageref{#1}}%
980 \def\reftextpagerange#1#2{%
981 nas p\'axinas~\pageref{#1}-\pageref{#2}}%
982 \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
985 % There are no good variants for German (I think and still think but
986 % this is a matter of taste :-).
987 % \changes{v1.0b}{1994/01/31}{Replace in incorrect `def by `let}
988 % The following definitions were recently suggested to me but since
989 % the original are in for a long time i don't want to change them
990 % now since that could make a lot of documents change their formatting.
991 % If you fancy them, add a redefinition of the corresponding macro(s)
992 % to the preamble of your document.
994 % \def\reftextfaceafter {auf der \reftextvario
995 % {gegen\"uberliegenden}{anderen} Seite}%
996 % \def\reftextfacebefore {auf der \reftextvario
997 % {gegen\"uberliegenden}{anderen} Seite}%
998 % \def\reftextafter {auf der \reftextvario
999 % {n\"achsten}{folgenden} Seite}%
1000 % \def\reftextbefore {auf der \reftextvario
1001 % {vorigen}{vorhergehenden} Seite}%
1002 % \def\reftextcurrent {\reftextvario
1003 % {auf dieser}{diese} Seite}%
1005 % \changes{v1.4n}{2005/07/24}{Small change}
1007 \DeclareOption{german}
1008 {\vref@addto\extrasgerman{%
1009 \def\reftextfaceafter {auf der n\"achsten Seite}%
1010 \def\reftextfacebefore{auf der vorherigen Seite}%
1011 \let\reftextafter \reftextfaceafter
1012 \let\reftextbefore \reftextfacebefore
1013 \def\reftextcurrent {auf dieser Seite}%
1014 \def\reftextfaraway#1{auf Seite~\pageref{#1}}%
1015 \def\reftextpagerange#1#2{auf den Seiten~\pageref{#1}--\pageref{#2}}%
1016 \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}%
1019 % \changes{v1.2d}{2000/01/11}{Added ngerman defaults (identical to german)}
1020 % \changes{v1.4n}{2005/07/24}{Small change}
1021 % The ngerman defaults are the same but needed for ``Neue Rechtschreibung''
1022 % (i.e., a different set of hyphenation patterns).
1024 \DeclareOption{ngerman}
1025 {\vref@addto\extrasngerman{%
1026 \def\reftextfaceafter {auf der n\"achsten Seite}%
1027 \def\reftextfacebefore{auf der vorherigen Seite}%
1028 \let\reftextafter \reftextfaceafter
1029 \let\reftextbefore \reftextfacebefore
1030 \def\reftextcurrent {auf dieser Seite}%
1031 \def\reftextfaraway#1{auf Seite~\pageref{#1}}%
1032 \def\reftextpagerange#1#2{auf den Seiten~\pageref{#1}--\pageref{#2}}%
1033 \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}%
1036 % Defaults for greek suggested by Apostolos Syropoulos\\
1037 % (\verb=apostolo@obelix.ee.duth.gr=).
1038 % \changes{v1.2a}{1998/08/22}{Added defaults for greek}
1040 \DeclareOption{greek}
1041 {\vref@addto\extrasgreek{%
1042 \def\reftextfaceafter {sthn \reftextvario{paro'usa}%
1043 {ep'omenh} sel'ida}%
1044 \def\reftextfacebefore{sthn \reftextvario{paro'usa}{prohgo'umenh}
1046 \def\reftextafter {sthn ep'omenh sel'ida}%
1047 \def\reftextbefore {sthn prohgo'umenh sel'ida}%
1048 \def\reftextcurrent {s'' aut'h th sel'ida}%
1049 \def\reftextfaraway#1{sth sel'ida\nobreakspace\pageref{#1}}%
1050 \def\reftextpagerange#1#2{stis sel'ides\nobreakspace
1051 \pageref{#1}---\pageref{#2}}%
1052 \def\reftextlabelrange#1#2{\ref{#1} ws\nobreakspace\ref{#2}}%
1055 % Icelandic defaults suggested by Thorhallur Sverrisson
1056 % (\verb=thorhs@basis.is=).
1057 % \changes{v1.4t}{2007/09/07}{Added defaults for icelandic}
1059 \DeclareOption{icelandic}
1060 {\vref@addto\extrasicelandic{%
1061 \def\reftextfaceafter {\'{a} \reftextvario{n{\ae}stu}%
1062 {n{\ae}stu} s\'{i}{\dh}u}%
1063 \def\reftextfacebefore{\'{a} \reftextvario{fyrri}%
1064 {fyrri} s\'{i}{\dh}u}%
1065 \def\reftextafter {\'{a} \reftextvario{n{\ae}stu}%
1066 {n{\ae}stu} s\'{i}{\dh}u}%
1067 \def\reftextbefore {\'{a} \reftextvario{fyrri}{fyrri} s\'{i}{\dh}u}%
1068 \def\reftextcurrent {\'{a} \reftextvario{{\th}essari}%
1069 {{\th}essari} s\'{i}{\dh}u}%
1070 \def\reftextfaraway#1{\'{a} s\'{i}{\dh}u~\pageref{#1}}%
1071 \def\reftextpagerange#1#2{\'{a} s\'{i}{\dh}um~\pageref{#1}--\pageref{#2}}%
1072 \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}%
1075 % Defaults for Italian suggested by Giovanni Pensa
1076 % (\verb=pensa@dsi.unimi.it=) with i{\TeX}nici.
1077 % \changes{v1.1b}{1995/10/19}{Added defaults for Italian}
1078 % \changes{v1.2a}{1998/08/22}{Removed incorrect warning}
1079 % \changes{v1.4k}{2004/10/30}{Added missing defaults supplied by Lapo Mori}
1080 % \changes{v1.4n}{2005/07/24}{Small change}
1081 % \changes{v1.4u}{2009/03/21}{Correction for \cs{reftextfaraway} suggested
1082 % by Lorenzo Pantieri}
1084 \DeclareOption{italian}
1085 {\vref@addto\extrasitalian{%
1086 \def\reftextfaceafter {\reftextvario{a fronte}%
1087 {nella pagina successiva}}%
1088 \def\reftextfacebefore{\reftextvario{a fronte}%
1089 {nella pagina precedente}}%
1090 \def\reftextafter {nella pagina \reftextvario{seguente}%
1092 \def\reftextbefore {nella pagina precedente}%
1093 \def\reftextcurrent {in questa pagina}%
1094 \def\reftextfaraway#1{a pagina~\pageref{#1}}%
1095 \def\reftextpagerange#1#2{nelle pagine~\pageref{#1}--\pageref{#2}}%
1096 \def\reftextlabelrange#1#2{da~\ref{#1} a~\ref{#2}}%
1099 % Defaults for Hungarian by Jeff Goldberg
1100 % (\verb=jeffrey@goldmark.org=).
1101 % There is a problem with the use of the definite article
1102 % \textit{a} or \textit{az} in Hungarian before expansions
1103 % of |\vref| or |\ref|. The problem is that the word
1104 % should be \textit{az} if the number following would begin with
1105 % a vowel if spelled out, and \textit{a} if the number would begin
1108 % The option assumes that there is a command |\aza| defined which
1109 % helps resolving this problem.\footnote{This information is actually quite
1110 % old but unfortunately never made it into varioref. In case any work
1111 % has been undertaken to resolve this please inform the author about it.}
1112 % \changes{v1.2a}{1998/08/22}{Added defaults for magyar}
1113 % \changes{v1.4j}{2005/01/22}{Defined \cs{reftextfaceafter} and
1114 % \cs{reftextfacebefore} instead of \cs{reftextafter} and \cs{reftextbefore}}
1116 \DeclareOption{magyar}
1117 {\vref@addto\extrasmagyar{%
1118 \def\reftextafter {a k\"o\-vet\-kez\H{o} ol\-da\-lon}%
1119 \def\reftextbefore{az el\H{o}\-z\H{o} ol\-da\-lon}%
1120 \def\reftextfaceafter {\reftextvario{a t\'ul\-ol\-da\-lon}%
1121 {a k\"o\-vet\-kez\H{o} ol\-da\-lon}}%
1122 \def\reftextfacebefore{\reftextvario{a t\'ul\-ol\-da\-lon}%
1123 {az el\H{o}\-z\H{o} ol\-da\-lon}}%
1124 \def\reftextcurrent {ezen az ol\-da\-lon}%
1126 % The following suggested patch has not been added yet (pending changes
1129 % \def\reftextfaraway#1{a~\csname @@magyar@az@lowxu\endcsname
1130 % {\pageref{#1}}.~ol\-da\-lon}%
1131 % \def\reftextpagerange#1#2{a~\csname @@magyar@az@lowxu\endcsname
1133 % --\pageref{#2}.~ol\-da\-la\-kon}%
1134 % \def\reftextlabelrange#1#2{{}\csname @@magyar@told\endcsname\ref{#1}+tol
1135 % \ref{#2}-ig}% Dat: `{}' is here for anti-\capitalize
1138 \def\reftextfaraway#1{\aza{\pageref{#1}} \pageref{#1}.~ol\-da\-lon}%
1139 \def\reftextpagerange#1#2{\vref@stringwarning\reftextpagerange
1140 on pages~\pageref{#1}--\pageref{#2}}%
1141 \def\reftextlabelrange#1#2{\vref@stringwarning\reflabelpagerange
1142 \ref{#1} to~\ref{#2}}%
1145 % The |\AtBeginDocument| needs to be executed when the option is
1146 % processed and not inside the babel interface.
1147 % \changes{v1.4i}{2004/02/27}{Moved \cs{AtBeginDocument}}
1149 \AtBeginDocument{\providecommand\aza[1]{a/az%
1150 \PackageError{varioref}{%
1151 Proper definition for command \noexpand\aza missing}%
1152 {You need to (re)define the command \noexpand\aza that
1153 takes one argument (a number or a \noexpand\pageref command)
1154 and produces the string `a' or `az' depending on the argument
1155 value. It should also accept an optional argument (default `l')
1156 to denote whether or not the string should be lowercase or
1160 % The Norwegian and `nynorsk' translations have been provided by
1161 % Dag F Langmyhr \verb=<dag@ifi.uio.no>= and Karl Ove Hufthammer
1162 % \verb=<huftis@bigfoot.com>=.
1163 % \changes{v1.0q}{1995/04/06}{Added defaults for norsk}
1164 % \changes{v1.0q}{1995/04/06}{Added defaults for nynorsk}
1165 % \changes{v1.2a}{1998/08/22}{Updated defaults for norsk}
1166 % \changes{v1.2a}{1998/08/22}{Updated defaults for nynorsk}
1167 % \changes{v1.2a}{1998/08/22}{Added norsk defaults for
1168 % \cs{reftextpagerange} and \cs{reftextlabelrange}}
1169 % \changes{v1.2a}{1998/08/22}{Added nynorsk defaults for
1170 % \cs{reftextpagerange} and \cs{reftextlabelrange}}
1171 % \changes{v1.2i}{2001/01/12}{Updated nynorsk defaults}
1173 \DeclareOption{norsk}
1174 {\vref@addto\extrasnorsk{%
1175 \def\reftextfaceafter {p\aa{} neste side}%
1176 \def\reftextfacebefore{p\aa{} forrige side}%
1177 \def\reftextafter {p\aa{} neste side}%
1178 \def\reftextbefore {p\aa{} forrige side}%
1179 \def\reftextcurrent {p\aa{} denne siden}%
1180 \def\reftextfaraway#1{p\aa{} side~\pageref{#1}}%
1181 \def\reftextpagerange#1#2{p\aa{} side~\pageref{#1}--\pageref{#2}}%
1182 \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}%
1184 \DeclareOption{nynorsk}
1185 {\vref@addto\extrasnynorsk{%
1186 \def\reftextfaceafter {p\aa{} neste side}%
1187 \def\reftextfacebefore{p\aa{} f\o{}rre side}%
1188 \def\reftextafter {p\aa{} neste side}%
1189 \def\reftextbefore {p\aa{} f\o{}rre side}%
1190 \def\reftextcurrent {p\aa{} denne sida}%
1191 \def\reftextfaraway#1{p\aa{} side~\pageref{#1}}%
1192 \def\reftextpagerange#1#2{p\aa{} side~\pageref{#1}--\pageref{#2}}%
1193 \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}%
1196 % The polish translations have been provided by
1197 % Tomasz Michniewski \\
1198 % \verb=<tomekm@ias.wat.waw.pl>=.
1199 % The use of the command \verb=\eob= and \verb=aob= etc.\
1200 % requires appropriate definitions as provided, for example, by
1201 % the babel system. This should probably be handled differently
1202 % but it would require modifications in babel's language support.
1203 % \changes{v1.1d}{1997/12/06}{Added defaults for polish}
1204 % \changes{v1.2a}{1998/08/22}{Added polish defaults for
1205 % \cs{reftextpagerange} and \cs{reftextlabelrange}}
1206 % \changes{v1.4n}{2005/09/14}{Changed default for \cs{reftextfaraway}}
1208 \DeclareOption{polish}
1209 {\vref@addto\extraspolish{%
1210 \def\reftextfaceafter {na \reftextvario{s\aob{}siedniej}%
1211 {nast\eob{}pnej} stronie}%
1212 \def\reftextfacebefore{na \reftextvario{s\aob{}siedniej}%
1213 {poprzedniej} stronie}%
1214 \def\reftextafter {na nast\eob{}pnej stronie}%
1215 \def\reftextbefore {na poprzedniej stronie}%
1216 \def\reftextcurrent {na \reftextvario{tej
1217 samej}{bie\zkb{}\aob{}cej} stronie}%
1218 \def\reftextfaraway#1{na stronie~\pageref{#1}}%
1219 \def\reftextpagerange#1#2{na stronach~\pageref{#1}--\pageref{#2}}%
1220 \def\reftextlabelrange#1#2{od~\ref{#1} do~\ref{#2}}%
1223 % The portuguese default text has been provided by
1224 % Jos\'e Carlos Oliveira Santos \verb=jcsantos@fc.up.pt=.
1225 % \changes{v1.2b}{1999/11/25}{Added portuguese defaults}
1226 % \changes{v1.2c}{1999/12/02}{Added more portuguese defaults}
1227 % \changes{v1.4r}{2007/05/26}{Misspelling of \cs{extrasportuges}}
1229 \DeclareOption{portuges}
1230 {\vref@addto\extrasportuges{%
1231 \def\reftextfaceafter {na \reftextvario{p\'agina ao lado}{pr\'oxima
1233 \def\reftextfacebefore{na p\'agina \reftextvario{ao lado}{anterior}}%
1234 \def\reftextafter {na \reftextvario{p\'agina seguinte}{pr\'oxima
1236 \def\reftextbefore{na p\'agina \reftextvario{anterior}{precedente}}%
1237 \def\reftextcurrent {nesta p\'agina}%
1238 \def\reftextfaraway#1{na p\'agina~\pageref{#1}}%
1239 \def\reftextpagerange#1#2{nas p\'aginas~\pageref{#1}--\pageref{#2}}%
1240 \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
1243 % Updates to the default text for Romanian have been suggested by Florin Oprina
1244 % (\verb=<florin.oprina@gmail.com>=).
1245 % \changes{v1.4v}{2009/06/13}{Incorrect text in \cs{reftextafter} (pr/4070)}
1246 % \changes{v1.5a}{2014/07/03}{Correct text in \cs{reftextbefore}}
1248 \DeclareOption{romanian}
1249 {\vref@addto\extrasromanian{%
1250 \def\reftextfaceafter {pe pagina \reftextvario{opus\u{a}}{urm\u{a}toarei}}%
1251 \def\reftextfacebefore{pe pagina \reftextvario{opus\u{a}}{precedentei}}%
1252 \def\reftextafter {\reftextvario{pe pagina urm\u{a}toare}%
1253 {pe urm\u{a}toarea pagin\u{a}}}%
1254 \def\reftextbefore {pe pagina \reftextvario{precedent\u{a}}%
1256 \def\reftextcurrent {pe aceast\u{a} pagin\u{a}}%
1257 \def\reftextfaraway#1{pe pagina~\pageref{#1}}%
1258 \def\reftextpagerange#1#2{pe paginile~\pageref{#1}--\pageref{#2}}%
1259 \def\reftextlabelrange#1#2{\ref{#1} la~\ref{#2}}%
1262 % The text for russian was taken from the book in Russian by
1263 % I.~A.~Kotelnikov and P.~Z.~Chebotaev, and adapted
1264 % to the encoding-independent form by Vladimir Volovich
1265 % (\verb=vvv@vsu.ru=).
1266 % \changes{v1.2a}{1998/11/23}{Added russian strings}
1267 % \changes{v1.2a}{1998/11/24}{Added defaults for
1268 % \cs{reftextpagerange} and \cs{reftextlabelrange}}
1270 \DeclareOption{russian}
1271 {\vref@addto\extrasrussian{%
1272 \def\reftextfaceafter{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyro
1273 \cyrt\cyri\cyrv\cyro\cyrp\cyro\cyrl\cyro\cyrzh\cyrn\cyro\cyrishrt}%
1274 {\cyrs\cyrl\cyre\cyrd\cyru\cyryu\cyrshch\cyre\cyrishrt}\ \cyrs\cyrt
1275 \cyrr\cyra\cyrn\cyri\cyrc\cyre}%
1276 \def\reftextfacebefore{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyro
1277 \cyrt\cyri\cyrv\cyro\cyrp\cyro\cyrl\cyro\cyrzh\cyrn\cyro\cyrishrt}%
1278 {\cyrp\cyrr\cyre\cyrd\cyrery\cyrd\cyru\cyrshch\cyre\cyrishrt}\
1279 \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyre}%
1280 \def\reftextafter{\cyrn\cyra\ \cyrs\cyrl\cyre\cyrd\cyru\cyryu\cyrshch
1281 \cyre\cyrishrt\ \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyre}%
1282 \def\reftextbefore{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyre\cyrd
1283 \cyrsh\cyre\cyrs\cyrt\cyrv\cyru\cyryu\cyrshch\cyre\cyrishrt}%
1284 {\cyrp\cyrr\cyre\cyrd\cyrery\cyrd\cyru\cyrshch\cyre\cyrishrt}%
1285 \ \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyre}%
1286 \def\reftextcurrent{\cyrn\cyra\ \reftextvario{\cyrerev\cyrt\cyro
1287 \cyrishrt}{\cyrd\cyra\cyrn\cyrn\cyro\cyrishrt}\ \cyrs\cyrt\cyrr
1288 \cyra\cyrn\cyri\cyrc\cyre}%
1289 \def\reftextfaraway#1{\cyrn\cyra\ \cyrs.~\pageref{#1}}%
1290 \def\reftextpagerange#1#2{\cyrn\cyra\ \cyrs\cyrt\cyrr\cyra\cyrn
1291 \cyri\cyrc\cyra\cyrh~\pageref{#1}--\pageref{#2}}%
1292 \def\reftextlabelrange#1#2{\cyrs~\ref{#1}\ \cyrp\cyro~\ref{#2}}%
1295 % The text for slovak defaults was contributed by Miroslav Sedivy\\
1296 % (\verb=<miro@slovensko.com>=).
1297 % \changes{v1.4b}{2002/03/11}{Contributed defaults added}
1299 \DeclareOption{slovak}
1300 {\vref@addto\extrasslovak{%
1301 \def\reftextfaceafter {na \reftextvario{proti\v lahlej}%
1302 {nasleduj\'ucej} strane}%
1303 \def\reftextfacebefore{na \reftextvario{proti\v lahlej}%
1304 {predch\'adzaj\'ucej} strane}%
1305 \def\reftextafter {na \reftextvario{nasleduj\'ucej}%
1306 {\v dal\v sej} strane}%
1307 \def\reftextbefore {na \reftextvario{predch\'adzaj\'ucej}%
1308 {predo\v slej} strane}%
1309 \def\reftextcurrent {na tejto strane}%
1310 \def\reftextfaraway#1{na strane~\pageref{#1}}%
1311 \def\reftextpagerange#1#2{na stran\'ach~\pageref{#1}--\pageref{#2}}%
1312 \def\reftextlabelrange#1#2{\ref{#1} a\v z~\ref{#2}}%
1315 % The text for slovene defaults was contributed by Roman Maurer\\
1316 % (\verb=<roman.maurer@amis.net>=).
1317 % \changes{v1.4a}{2002/03/05}{Contributed defaults added}
1319 \DeclareOption{slovene}
1320 {\vref@addto\extrasslovene{%
1321 \def\reftextfaceafter {na naslednji strani}%
1322 \def\reftextfacebefore{na prej\v{s}nji strani}%
1323 \let\reftextafter \reftextfaceafter
1324 \let\reftextbefore \reftextfacebefore
1325 \def\reftextcurrent {na \reftextvario{tej}{trenutni} strani}%
1326 \def\reftextfaraway#1{na strani~\pageref{#1}}%
1327 \def\reftextpagerange#1#2{na straneh~\pageref{#1}--\pageref{#2}}%
1328 \def\reftextlabelrange#1#2{od~\ref{#1} do~\ref{#2}}%
1331 % Text for spanish defaults was contributed by Julio Sanchez
1332 % (\verb=jsanchez@gmv.es=) and Fernando Dobladez (\verb=<ferd@fuego.com>=).
1333 % \changes{v1.0f}{1994/03/16}{Inserted missing hash mark}
1334 % \changes{v1.0k}{1994/06/05}{Corrected misspelled cmd `extrasspanish}
1335 % \changes{v1.4a}{2002/03/05}{Missing defaults added}
1336 % \changes{v1.4o}{2005/11/26}{Single hyphen in range}
1338 \DeclareOption{spanish}
1339 {\vref@addto\extrasspanish{%
1340 \def\reftextfaceafter {en la p\'agina siguiente}%
1341 \def\reftextfacebefore{en la p\'agina anterior}%
1342 \let\reftextafter \reftextfaceafter
1343 \let\reftextbefore \reftextfacebefore
1344 \def\reftextcurrent {en esta p\'agina}%
1345 \def\reftextfaraway#1{en la p\'agina~\pageref{#1}}%
1346 \def\reftextpagerange#1#2{en las p\'aginas~\pageref{#1}%
1348 \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
1351 % The text for swedish was contributed by Mats Dahlgren
1352 % (\verb=matsd@sssk.se=).
1353 % \changes{v1.0p}{1995/01/10}{Added swedish strings}
1354 % \changes{v1.2a}{1998/08/22}{Added swedish defaults for
1355 % \cs{reftextpagerange} and \cs{reftextlabelrange}}
1357 \DeclareOption{swedish}
1358 {\vref@addto\extrasswedish{%
1359 \def\reftextfaceafter {p\aa\ \reftextvario{motst\aa ende}%
1361 \def\reftextfacebefore{p\aa\ \reftextvario{motst\aa ende}%
1362 {f\"{o}reg\aa ende} sida}%
1363 \def\reftextafter {p\aa\ \reftextvario{f\"{o}ljande}%
1365 \def\reftextbefore {p\aa\ f\"{o}reg\aa ende sida}%
1366 \def\reftextcurrent {p\aa\ denna sida}%
1367 \def\reftextfaraway#1{p\aa\ sidan~\pageref{#1}}%
1368 \def\reftextpagerange#1#2{p\aa\
1369 sidorna~\pageref{#1}--\pageref{#2}}%
1370 \def\reftextlabelrange#1#2{\ref{#1} till~\ref{#2}}%
1372 \DeclareOption{turkish}
1373 {\vref@excuse{turkish}%
1374 \vref@addto\extrasturkish{%
1375 \def\reftextfaceafter {on the \reftextvario{facing}{next} page}%
1376 \def\reftextfacebefore{on the \reftextvario{facing}{preceding}
1378 \def\reftextafter {on the \reftextvario{following}{next} page}%
1379 \def\reftextbefore {on the \reftextvario{preceding}{previous} page}%
1380 \def\reftextcurrent {on \reftextvario{this}{the current} page}%
1381 \def\reftextfaraway#1{on page~\pageref{#1}}%
1382 \def\reftextpagerange#1#2{on pages~\pageref{#1}--\pageref{#2}}%
1383 \def\reftextlabelrange#1#2{\ref{#1} to~\ref{#2}}%
1386 % The text for Ukrainian defaults was contributed by Mykola Lyakhovych\\
1387 % (\verb=<lyakhovych@mail.ru>=).
1388 % \changes{v1.4l}{2005/04/24}{Contributed defaults added}
1390 \DeclareOption{ukrainian}
1391 {\vref@addto\extrasukrainian{%
1392 \def\reftextfaceafter{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyro
1393 \cyrt\cyri\cyrl\cyre\cyrzh\cyrn\cyrii\cyrishrt}%
1394 {\cyrn\cyra\cyrs\cyrt\cyru\cyrp\cyrn\cyrii\cyrishrt}\ \cyrs\cyrt
1395 \cyro\cyrr\cyri\cyrn\cyrc\cyrii}%
1396 \def\reftextfacebefore{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyro
1397 \cyrt\cyri\cyrl\cyre\cyrzh\cyrn\cyrii\cyrishrt}%
1398 {\cyrp\cyro\cyrp\cyre\cyrr\cyre\cyrd\cyrn\cyrii\cyrishrt}\
1399 \cyrs\cyrt\cyro\cyrr\cyrii\cyrn\cyrc\cyrii}%
1400 \def\reftextafter{\cyrn\cyra\ \cyrn\cyra\cyrs\cyrt\cyru\cyrp\cyrn
1401 \cyrii\cyrishrt\ \cyrs\cyrt\cyro\cyrr\cyrii\cyrn\cyrc\cyrii}%
1402 \def\reftextbefore{\cyrn\cyra\ \cyrp\cyro\cyrp\cyre\cyrr\cyre\cyrd
1403 \cyrn\cyrii\cyrishrt\ \cyrs\cyrt\cyro\cyrr\cyrii\cyrn\cyrc\cyrii}%
1404 \def\reftextcurrent{\cyrn\cyra\ \reftextvario{\cyrc\cyrii\cyrishrt}%
1405 {\cyrd\cyra\cyrn\cyrii\cyrishrt}\ \cyrs\cyrt\cyro\cyrr\cyrii\cyrn
1407 \def\reftextfaraway#1{\cyrn\cyra\ \cyrs.~\pageref{#1}}%
1408 \def\reftextpagerange#1#2{\cyrn\cyra\ \cyrs\cyrt\cyro\cyrr\cyrii
1409 \cyrn\cyrk\cyra\cyrh~\pageref{#1}--\pageref{#2}}%
1410 \def\reftextlabelrange#1#2{\cyrz~\ref{#1}\ \cyrd\cyro~\ref{#2}}%
1413 % We support francais as an alternative to french since people
1414 % might be used to it, but we discurrage it.
1416 \DeclareOption{francais}{%
1417 \typeout{Please use `french' instead of `francais'}%
1418 \ExecuteOptions{french}}
1419 \DeclareOption{germanb}{%
1420 \typeout{Please use `german' instead of `germanb'}%
1421 \ExecuteOptions{german}}
1429 % During document preparation errors due to |\vref| are usually of
1430 % not much interest. For this reason the draft option turns them into
1431 % warnings by issuing a |\vrefwarning| command. The final option
1432 % (default) stops with an error message when varioref detects a possible
1434 % \changes{v1.1h}{1998/08/01}{Added draft and final options}
1436 \DeclareOption{draft}{\AtEndOfPackage\vrefwarning}
1437 \DeclareOption{final}{\AtEndOfPackage\vrefshowerrors} % the default
1440 % After all options are declared we execute the default option
1441 % \texttt{english} to set up the defaults and then call
1442 % |\ProcessOptions*| to handle any option passed to the package.
1443 % The star form is used since we want to execute the options in the
1444 % order they are given (in case this isn't used together with the
1445 % \texttt{babel} package).
1447 \ExecuteOptions{english,final}
1452 % \subsection{Defining the main macros}
1454 % \begin{macro}{\vr@cnt}
1455 % To generate new labels we use a counter and construct the
1456 % internal label names by prefixing the current counter value with
1457 % the string |vr@|. We need a \LaTeX{} counter to get |\include|s
1458 % handled correctly.
1459 % \changes{v0.1e}{1992/11/15}{use LaTeX counter}
1465 % \begin{macro}{\vpageref}
1466 % \changes{v1.3a}{2001/04/12}{Scan for star form}
1467 % \begin{macro}{\vp@geref}
1468 % The command |\vpageref| generates the appropriate string by first
1469 % parsing the optional arguments (if any) and then compares the
1470 % internal and the user label. This command should be robust since
1471 % the user might put it anywhere.
1473 % We now start by scanning for a star which means: do not add a
1474 % space in front of the generated text---ever.
1476 \DeclareRobustCommand\vpageref{\@ifstar
1477 {\let\vref@space\relax\vp@geref}%
1478 {\let\vref@space\space\vp@geref}}
1482 \def\vp@geref{\@ifnextchar[%
1484 % The default for the first optional argument is the string hidden
1485 % in the macro |\reftextcurrent|.
1487 \@vpageref{\@vpageref[\reftextcurrent]}%
1493 % \begin{macro}{\vref@space}
1494 % \changes{v1.4a}{2002/03/06}{Default added}
1495 % A default for |\vref@space|. This isn't really needed except in
1496 % the case that somebody has hooked into the \texttt{varioref}
1497 % interfaces at a lower level (which isn't really supported,
1498 % but\ldots). So giving a default will prevent an error message in
1499 % that case (and should hopefully produce the same behavior as before).
1501 \let\vref@space\space
1505 % \begin{macro}{\@vpageref}
1506 % More parsing\ldots
1508 \def\@vpageref[#1]{\@ifnextchar[%
1510 % The default for the second optional argument is a space which is
1511 % prefixed by |\unskip| to get rid of any leading space inserted
1513 % \changes{v1.0h}{1994/06/11}{Pass first argument in both cases}
1514 % \changes{v1.0i}{1994/06/20}{Do it correctly}
1516 {\@@vpageref{#1}}{\@@vpageref{#1}[\unskip\vref@space]}}
1520 % \begin{macro}{\@@vpageref}
1521 % The |\@@vpageref| macro finally generates the references by
1522 % comparing the value of an internal label with the value of the
1524 % \changes{v1.0h}{1994/06/11}{Change internal interface}
1526 \def\@@vpageref#1[#2]#3{%
1528 % First it switches to horizontal mode if necessary and also
1529 % removes any leading space.
1533 % Then it advances the counter |\c@vrcnt| by one which is used to
1534 % generate internal label names.
1536 \global\advance\c@vrcnt\@ne
1538 % Then it checks if for the current value of |\c@vrcnt| a label
1539 % command was issued in the last run. If not it pretends that there
1540 % was one with the value |{??}{??}|. Thereafter it stores the
1541 % pageref value for this label in the macro |\@tempa|.
1543 \vref@pagenum\@tempa{\the\c@vrcnt @vr}%
1545 % Here we check that the generated text is not going across a page
1547 % \changes{v0.1f}{1993/01/01}{Add another label to catch cross-overs}
1549 \vref@pagenum\@tempb{\the\c@vrcnt @xvr}%
1551 % \changes{v1.0l}{1994/07/07}{Explicitly expand `label argument for
1553 % In version 1.0l the label string has been turned around so that
1554 % the number comes first. This was done to allow easy explicit
1555 % expansion of the number before it is passed to the |\label|
1556 % command. In the babel system the argument of |label| was not
1557 % expanded with the result that wrong label strings have been
1558 % generated. This is a general problem that might need a completely
1559 % different solution in babel but for now the change below (and in
1560 % some other places in the code) should solve the problem for this
1561 % special combination of packages.
1563 % These days we actually use |\vref@label| instead of |\label| as
1564 % this avoids problems with Babel or \texttt{amsmath} redefining
1565 % the latter command.
1566 % \changes{v1.4e}{2003/01/08}{Use \cs{vref@label} instead of
1567 % \cs{label} (pr/3489)}
1569 \vref@label{\the\c@vrcnt @xvr}%
1571 % \changes{v1.1g}{1998/05/10}{Test if inside AMS display (pr2175)}
1572 % Inside displays of the \texttt{amsmath} package the |\label| command
1573 % is redefined which makes the test for loops incorrect if a |\vref|
1574 % is used in, say, |\intertext|. So we test this condition first and
1575 % only do the test if |\label| doesn't have a special meaning.
1576 % [This is no longer necessary as |\label| isn't used any more]
1578 % \ifx\label\label@in@display\else
1580 \let\vref@may@loop\relax
1583 % If both points do not fall onto the same page with either issue
1584 % an error or a warning message.
1585 % However, we do no longer issue that warning now but wait until we
1586 % are sure that both labels aren't ``far away'' because in that
1587 % case it doesn't matter. So we just save that info in a macro now.
1588 % \changes{v1.0g}{1994/05/27}{Looping pages shown in wrong order}
1589 % \changes{v1.5c}{2016/02/16}{Delay generating the looping warning
1590 % until we know more}
1592 \edef\vref@may@loop{%
1593 \noexpand\vref@err{\noexpand\vref or \noexpand\vpageref
1595 \@tempb-\@tempa\space (may loop)%
1601 % Same game for the user requested label; this time the page
1602 % reference is saved in |\thevpagerefnum|.
1603 % \changes{v1.4c}{2002/06/14}{Use \cs{thevpagerefnum} instead of \cs{@tempb}}
1605 \vrefpagenum\thevpagerefnum{#3}%
1607 % Now after the internal label has served its purpose if would be
1608 % nice to free the memory it occupies by using something like
1610 % \global\expandafter\let
1611 % \csname r@\the\c@vrcnt @vr\endcsname\@empty
1613 % But this is not possible because it would result in getting
1614 % `Labels may have changed\ldots' warnings for every run. Now we
1615 % are ready to produce the textual strings. Since we have removed
1616 % any leading space we now insert a space (unless this was the star
1617 % form of the command) and then compare the two
1621 \ifx\@tempa\thevpagerefnum
1623 % If they are the same we insert the first argument into the input
1624 % stream. Otherwise we insert the second argument. Recall that
1625 % those are the two optional arguments of |...|. However, if the
1626 % user explicitly requested an empty text string using the optional
1627 % argument we cancel any preceding space.
1628 % \changes{v1.2f}{2000/07/07}{Don't output space if optional argument
1640 % Now we check if the page number of the referenced object (stored
1641 % in |\thevpagerefnum| is a single positive number.
1643 \is@pos@number\thevpagerefnum
1646 % If so, we check if the current position (stored in |\@tempa|) is
1647 % a positive number. If this is the case we assign this number to
1648 % the counter register |\@tempcnta| and add one to it.
1650 \is@pos@number\@tempa
1652 \advance\@tempcnta\@ne
1655 % If it is not a positive number we assign the largest possible
1656 % number to |\@tempcnta| and thereby pretending that label and
1657 % reference are miles away from each other.
1659 {\@tempcnta\maxdimen}%
1661 % Now we are ready to check if reference and object are on nearby
1662 % pages. |\thevpagerefnum| will expand to the page number of the object
1663 % (and we know that this is a number) and |\@tempcnta| is either
1664 % one higher than the reference page or completely out of bounds.
1665 % So if both represent the same value then the object lies one page
1666 % after its reference.
1668 \ifnum \thevpagerefnum =\@tempcnta
1670 % Thus if the object falls onto an odd page then the reference is
1671 % on the facing even page (and so we insert |\reftextfaceafter|),
1672 % otherwise the object can not be seen from the reference (and we
1673 % in insert |\reftextafter|). Don't be surprised if we are not
1674 % using |\thevpagerefnum| in the check. Since |\@tempcnta| has the same
1675 % value it is faster to use the register instead of parsing the
1676 % macro contents anew.
1680 % In fact we are going to use |\reftextfaceafter| only if we are
1681 % doing two-sided printing, otherwise |\reftextafter| is always
1683 % Since the value of |\if@twoside| is evaluated before reading in
1684 % packages we could do better (saving some tokens) by defining
1685 % the current macro in dependence of this boolean.
1696 % If the object is not on the page following the reference we check
1697 % if it is on the page before the reference. In \LaTeX{} this
1698 % situation is not too common, for example with floats it normally
1699 % does not occur, but of course it isn't impossible if you more
1700 % than one reference to the same object, or if you have back
1701 % references to sections, theorems, etc. To test this we now
1702 % subtract two from the current value of |\@tempcnta| (which was
1703 % set to one higher as the reference page number). Note, that
1704 % subtraction is also possible if the value was |\maxdimen| --- we
1705 % still get something that is much larger than any sensible page
1709 \advance\@tempcnta-2
1711 % If now |\thevpagerefnum| and |\@tempcnta| have the same value then the
1712 % object lies one page before the reference.
1714 \ifnum \thevpagerefnum =\@tempcnta
1716 % Again we have to check for odd or even pages to distinguish
1717 % between the facing and the non-facing situation.
1723 % Again the |\reftextfacebefore| only if |@twoside| evaluates to
1733 % If the above test also returns false then we have object and
1734 % references on pages which are far away or don't contain simple
1735 % page numbers. Therefore we generate the |\reftextfaraway| string
1736 % and drop any possible ``looping warning'' in |\vref@may@loop|.
1737 % Recall that this is a macro which has the user label as an
1741 \let\vref@may@loop\relax % added
1742 \reftextfaraway{#3}%
1747 % We do the same if our first test (that the page with the object
1748 % has a positive page number) turns out to be false.
1751 \let\vref@may@loop\relax %added
1752 \reftextfaraway{#3}}%
1755 % Finally we generate the internal label so that it can be check on
1756 % the next run. This means that we compare the position after the
1757 % string with the position of the referenced object. There is one
1758 % thing to note: to conserve space we locally make |\@currentlabel|
1759 % empty since we are only interested in the page number value of
1760 % this internal label.
1761 % \changes{v1.0l}{1994/07/07}{Explicitly expand \cs{label} argument for babel}
1763 % These days we actually use |\vref@label| instead of |\label| as
1764 % this avoids problems with Babel or \texttt{amsmath} redefining
1765 % the latter command.
1766 % \changes{v1.4e}{2003/01/08}{Use \cs{vref@label} instead of
1767 % \cs{label} (pr/3489)}
1768 % \changes{v1.5c}{2016/02/16}{}
1770 \vref@label{\the\c@vrcnt @vr}%
1772 % Finally we run |\vref@may@loop| which is either |\relax| or generates
1773 % a ``may loop'' warning or error as appropriate.
1781 % \begin{macro}{\vref@label}
1782 % \changes{v1.4e}{2003/01/08}{Macro added (pr/3489)}
1783 % This macro is like |\label| in the kernel but without passing on
1784 % |\@currentlabel|, ie useful if all we are interested in is the
1785 % page number. It also has the effect that it is unaffected by
1786 % \texttt{amsmath} or Babel redefining the |\label| command.
1788 \def\vref@label#1{\@bsphack
1789 \protected@write\@auxout{}%
1790 {\string\newlabel{#1}{{}{\thepage}}}%
1796 % \begin{macro}{\vpagerefnum}
1797 % \changes{v1.4c}{2002/06/14}{Macro added}
1798 % This macro allows to define |\reftextafter| and friends to refer
1799 % to the page number rather than producing a textual reference.
1801 \let\thevpagerefnum\@empty
1806 % \begin{macro}{\vrefwarning}
1807 % \changes{v0.1g}{1993/02/14}{Macro added}
1808 % \begin{macro}{\vrefshowerrors}
1809 % \changes{v1.1h}{1998/08/01}{Macro added}
1810 % \begin{macro}{\vref@err}
1811 % \changes{v0.1g}{1993/02/14}{Macro added}
1812 % When the |\vref| command detects a possible crossing over a page
1813 % boundary it will call |\vref@err| to generate an error message.
1814 % During document preparation one can turn such errors into
1815 % warnings by issuing a |\vrefwarning| declaration.
1816 % \changes{v1.0g}{1993/02/14}{Macro added}
1818 \def\vrefwarning{\def\vref@err{\PackageWarning{varioref}}}
1821 \def\vrefshowerrors{\def\vref@err##1{\PackageError{varioref}{##1}%
1822 {Please check the pages in question. You might need to replace
1823 the \string\vref\MessageBreak
1824 or \noexpand\vpageref by a normal \noexpand\(page)ref to
1825 stop LaTeX running forever.}}}
1832 % \begin{macro}{\vref}
1833 % \changes{v1.3a}{2001/04/12}{Scan for star form}
1834 % We start by scanning for a star form in which case we do not put
1835 % any space before the generated text (only remove some).
1836 % \begin{macro}{\vr@f}
1838 \DeclareRobustCommand\vref{\@ifstar
1839 {\let\vref@space\relax\vr@f}%
1840 {\let\vref@space\nobreakspace\vr@f}}
1842 % And now we do the real work\ldots
1843 % \changes{v1.3c}{2001/09/04}{Correct typo in name}
1847 % The use of|\nobreakspace| or |~| after the |\unskip| means that
1848 % this command will always produce a normal space while
1849 % something like |\nobreak\space| will
1850 % react to settings of |\nonfrenchspacing|.
1851 % Unfortunately the latter will also act in cases where one really
1852 % wants a normal space, e.g., in |Fig.~\vref{..}|, resulting in
1853 % a large extra space after the dot. For this reason the first solution
1855 % \changes{v1.1e}{1998/03/09}{Don't use \cs{nobreakspace} (pr/1866)}
1856 % \changes{v1.2a}{1998/11/27}{Use \cs{nobreakspace} (pr/2909)}
1857 % \changes{v1.2a}{1998/11/27}{Add \cs{leavevmode}}
1859 % Above comments all refer to the earlier versions where there was
1860 % no possibility to suppress the space at all. By now we have
1861 % |\vref*| and |\vpageref*| to suppress the in internally generated
1862 % space by redefining |\vref@space| appropriately.
1864 \leavevmode\unskip\vref@space
1867 % That means we have have to use |\vpageref| and not the internal
1868 % |\@vpageref| --- otherwise we would pick up the
1869 % ``current'' definition for |\vref@space| instead of setting it
1871 % \changes{v1.4c}{2002/06/18}{Use \cs{vpageref} not \cs{@vpageref} (pr/3403)}
1873 \vpageref[\unskip]{#1}}
1879 % \begin{macro}{\is@pos@number}
1880 % The utility macro |\is@pos@number| takes three arguments: a
1881 % string that is tested for being a valid non-negative integer and the
1882 % actions to be taken in case the test comes out true or false.
1884 % We start by passing the string to the macro |\is@pos@num| after
1885 % prefixing it with a \texttt{0} and adding a space after it. To have
1886 % a well-defined ending point we also add |\@nil| at the end.
1887 %\label{isposnumber}
1889 \def\is@pos@number#1{\is@pos@num0#1\space\@nil}
1891 % Now we parse the enlarged string into a counter register. To get
1892 % control back after everything that is regarded by \TeX{} as a
1893 % number is put into that register we assign |\is@pos@num@| to the
1894 % |\afterassignment| token. Since the string started with 0, we
1895 % can be sure that the register assignment will be carried out
1896 % without an error message. In case of counter assignments leading
1897 % zeros are discarded.
1899 \def\is@pos@num{\afterassignment\is@pos@num@ \count@}
1901 % Now we have to check whether or not the whole string was parsed
1902 % into that register or some remainder was left over. Since we have
1903 % added a |\@nil| token at the very end we can use that to delimit
1904 % the argument of |\is@pos@num@|. Note, that the added space in
1905 % |\is@pos@number| \vpageref[above]{isposnumber} gets parsed away
1906 % by the counter assignment. If it would be missing, and the full
1907 % string would consist of a number, \TeX{}would try to replace
1908 % |\@nil| by its definition to see if it would contain additional
1909 % digits and thus we would be in trouble at this point.
1911 \def\is@pos@num@#1\@nil{%
1913 % Now we have to check if the argument is empty. We can do this
1914 % with an |\ifx| (i.e., in an expandable way) since we know for
1915 % sure that it can not start with |\@nil|.
1916 % \changes{v1.4j}{2004/05/08}{Use \cs{@nil} for testing}
1920 % Depending on the result we execute the second or third argument
1921 % of the command |\is@pos@number| using a technique that removes
1922 % the |\else| or |\fi| from the input stream first, so that in
1923 % principle input stream parsing could be done from within the
1926 \expandafter\@firstoftwo \else
1927 \expandafter\@secondoftwo \fi}
1931 % \begin{macro}{\reftextvario}
1932 % This macro gives a little bit of random variation in the text
1933 % because the outcome depends on the number of |\vref| commands
1936 \def\reftextvario#1#2{\ifodd\c@vrcnt #1\else#2\fi}
1940 % \begin{macro}{\fullref}
1941 % And here is the primitive command that always produces a |\ref|
1944 \def\fullref#1{\ref{#1} \reftextfaraway{#1}}
1949 % \subsubsection{Supporting ranges}
1951 % \begin{macro}{\vref@pagenum}
1952 % \changes{v1.2a}{1998/08/01}{Macro added}
1953 % This command takes a label as |#1| extracts the page number
1954 % associated with it and saves the result in a csname which is
1955 % passed as |#1|. If the label isn't associated with a page number
1956 % it essentially associates it with |??| for both the label number
1957 % and the page, thus defining the label this way. This means that
1958 % no label warning is generated for this label in case it is
1961 \def\vref@pagenum#1#2{%
1962 \@ifundefined{r@#2}{\@namedef{r@#2}{{??}{??}}}{}%
1964 % Extracting and saving the page number turned out to be a source of subtle
1965 % bugs. Initially it was done through an |\edef| with a bunch of
1966 % |\expandafter| commands inside. This posed a problem if the page number
1967 % itself contained code which needed protection (e.g., pr/4080) so this got
1968 % changed to use |\protected@edef|. However, that in turn failed with Babel
1970 % if the label contained active characters, e.g., a ``:'' in French. So now
1971 % we use even more |\expandafter| commands to avoid any expansion other
1972 % than what is absolutely required---I'm sure there is now a simpler way
1973 % to code this, but \ldots\ in fact we didn't use enough initially resulting in another
1975 % \changes{v1.4w}{2009/09/13}{Use \cs{protected@edef} to avoid problems
1976 % in complicated setups, e.g., microtype (pr/4080)}
1977 % \changes{v1.4y}{2010/11/12}{Avoid even \cs{protected@edef} to pacify french
1979 % \changes{v1.4z}{2011/10/02}{Previous fix need one more expansion
1980 % (pr/4159,pr/4171)}
1982 \expandafter\expandafter\expandafter\vref@@pagenum
1983 \csname r@#2\endcsname{}{}\@nil#1%
1985 \def\vref@@pagenum#1#2#3\@nil#4{%
1991 % \begin{macro}{\vrefpagenum}
1992 % \changes{v1.2a}{1998/08/01}{Macro added}
1993 % Same as the above but this time we generate a warning for
1996 \def\vrefpagenum#1#2{%
1997 \@ifundefined{r@#2}%
1998 {\G@refundefinedtrue
1999 \@latex@warning{Reference `#2' on page \thepage \space
2001 \vref@pagenum{#1}{#2}}
2005 % \begin{macro}{\vpagerefrange}
2006 % \begin{macro}{\@vpagerefrange}
2007 % \begin{macro}{\@svpagerefrange}
2008 % \changes{v1.2a}{1998/08/01}{Macro added}
2009 % \changes{v1.3b}{2001/04/14}{Scan for star form}
2010 % \changes{v1.4s}{2007/08/07}
2011 % {Prevent loss of brackets}
2012 % If both labels refer to the same page then we produce a
2013 % |\vpageref|. Otherwise we produce the result of
2014 % |\reftextpagerange|.
2016 % One could think of making this command even more clever by
2017 % producing a special string if the difference between the two page
2018 % number is one (but this is not done).
2020 % We need two versions to implement a star form:
2022 \newcommand\@svpagerefrange[3][\reftextcurrent]{%
2023 \vrefpagenum\@tempa{#2}%
2024 \vrefpagenum\@tempb{#3}%
2026 \vpageref*[{#1}]{#2}%
2028 \reftextpagerange{#2}{#3}%
2032 % And the same but using |\vpageref|:
2034 \newcommand\@vpagerefrange[3][\reftextcurrent]{%
2035 \vrefpagenum\@tempa{#2}%
2036 \vrefpagenum\@tempb{#3}%
2038 \vpageref[{#1}]{#2}%
2040 \reftextpagerange{#2}{#3}%
2044 % And here we put things together.
2046 \newcommand\vpagerefrange{\@ifstar\@svpagerefrange\@vpagerefrange}
2053 % \begin{macro}{\vrefrange}
2054 % \changes{v1.2a}{1998/08/01}{Macro added}
2055 % \changes{v1.4s}{2006/08/07}
2056 % {Prevent loss of brackets}
2058 \newcommand\vrefrange[3][\reftextcurrent]
2059 {\reftextlabelrange{#2}{#3} \vpagerefrange[{#1}]{#2}{#3}}
2064 % \subsection{An extension of counter referencing}
2066 % \begin{macro}{\refstepcounter}
2067 % \changes{v1.4a}{2002/02/24}{Macro redefined}
2069 % At the moment a reference to a counter |foo| will generate the
2070 % equivalent of |\p@foo\thefoo| although not quite in this form. For
2071 % some applications it would be nice of one could have |\thefoo| being
2072 % an argument to |\p@foo| to be able to put material before and after
2073 % the number generated by |\thefoo|. This can be easily achieved with
2074 % a small change to one of the kernel commands as follows:
2076 \def\refstepcounter#1{\stepcounter{#1}%
2077 \protected@edef\@currentlabel
2078 {\csname p@#1\expandafter\endcsname\csname the#1\endcsname}%
2081 % The trick is to ensure that |\csname the#1\endcsname| is turned into
2082 % a single token before |\p@...| is expanded further. This way, if the
2083 % |\p@...| command is a macro with one argument it will receive
2084 % |\the...|. With the kernel code (i.e., without the |\expandafter|)
2085 % it will instead pick up |\csname| which would be disastrous.
2087 % Using |\expandafter| instead of braces delimiting the argument is
2088 % better because, assuming that the |\p@...| command is not defined as
2089 % a macro with one argument, the braces will stay and prohibit kerning
2090 % that might otherwise happen between the glyphs generated by
2091 % |\the...| and surrounding glyphs.
2094 % \begin{macro}{\labelformat}
2095 % \changes{v1.4a}{2002/02/24}{Macro added}
2096 % A shortcut to set the |\p@...| macro for a counter. It will pick
2097 % up the counter representation as an argument so that it can be
2098 % specially formatted.
2100 \def\labelformat#1{\expandafter\def\csname p@#1\endcsname##1}
2104 % \begin{macro}{\Ref}
2105 % \changes{v1.4a}{2002/02/24}{Macro added}
2106 % This macro expands the result of |\ref| and then uppercases the
2107 % first token. Only useful if the label was generated via
2108 % |\labelformat| and contains some lower case letter at its start. If
2109 % the label starts with a complicated construct (e.g., an accented
2110 % letter) one has to surround everything that needs uppercasing in
2111 % a brace group in the definition of |\labelformat|.\footnote{There
2112 % is one problem with this approach: the braces are kept in a
2113 % normal \texttt{\textbackslash ref} which might spoil kerning.
2114 % Perhaps one day this needs redoing.}
2116 \DeclareRobustCommand\Ref[1]{\protected@edef\@tempa{\ref{#1}}%
2117 \expandafter\MakeUppercase\@tempa}
2121 % \begin{macro}{\Vref}
2122 % \changes{v1.4a}{2002/02/24}{Macro added}
2123 % \begin{macro}{\Vr@f}
2124 % \changes{v1.4a}{2002/02/24}{Macro added}
2125 % \changes{v1.4x}{2010/08/04}{Correct spacing -- same mistake as in \cs{vref}
2127 % |\Vref| is the counterpart to |\vref| with |\ref| replaced by
2128 % |\Ref| in its definition.
2130 \DeclareRobustCommand\Vref{\@ifstar
2131 {\let\vref@space\relax\Vr@f}%
2132 {\let\vref@space\nobreakspace\Vr@f}}
2134 \leavevmode\unskip\vref@space
2136 \vpageref[\unskip]{#1}}