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/09 v1.5b package for extended references (FMi)]
42 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
43 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
44 %% Digits \0\1\2\3\4\5\6\7\8\9
45 %% Exclamation \! Double quote \" Hash (number) \#
46 %% Dollar \$ Percent \% Ampersand \&
47 %% Acute accent \' Left paren \( Right paren \)
48 %% Asterisk \* Plus \+ Comma \,
49 %% Minus \- Point \. Solidus \/
50 %% Colon \: Semicolon \; Less than \<
51 %% Equals \= Greater than \> Question mark \?
52 %% Commercial at \@ Left bracket \[ Backslash \\
53 %% Right bracket \] Circumflex \^ Underscore \_
54 %% Grave accent \` Left brace \{ Vertical bar \|
55 %% Right brace \} Tilde \~}
59 % \changes{v1.0a}{1993/12/06}{Upgrade to LaTeX2e}
60 % \changes{v1.0g}{1994/05/27}{Use \cmd\DeclareRobustCommand}
62 % \newcommand\NewIn[1]{\marginpar{\fbox{\fbox{\sffamily\tabular{l}New in\\#1\endtabular}}}}
64 % \title{The \texttt{varioref} package\thanks{This file
65 % has version number \fileversion, last
66 % revised \filedate.}}
67 % \author{Frank Mittelbach}
70 % \MaintainedByLaTeXTeam{tools}
75 % This package defines the commands |\vref|, |\vpageref|,
76 % |\vrefrange|, and |\vpagerefrange| for
77 % \LaTeXe. |\vref| is similar to |\ref| but adds an additional
78 % page reference, like `on the facing page' or `on page 27' whenever
79 % the corresponding |\label| is not on the same page. The command
80 % |\vpageref| is a variation to |\pageref| with a similar
81 % functionality. The |\v...range| commands take two labels as arguments
82 % and produce strings which depend on whether or not these labels
83 % fall onto a single page or on different pages.
84 % Generated strings are customizable so that these
85 % commands are usable with various languages.
89 % \columnsep=2\columnsep
90 % \begin{multicols}{2}
94 % \section{Introduction}
96 % In many cases it is helpful when referring to a figure or table to
97 % put both a |\ref| and a |\pageref| command into the document
98 % especially when there are one or more pages between the reference
99 % and the object. Therefore some people use a command like
101 % \newcommand{\fullref}[1]{\ref{#1} on page~\pageref{#1}}
103 % which reduces the number of key strokes, necessary to make such a
104 % complete reference. But since one never knows where the referenced
105 % object finally falls, using such a device may result in a page
106 % reference to the current page which is disturbing and therefore
111 % \section{The user interface}
113 %\DescribeMacro\vref The implementation of |\vref| below produces only
114 % a |\ref| when reference and |\label| are on the same page. It will
115 % additionally produce one of the strings `on the facing page', `on
116 % the preceding page', or `on the following page', if label and
117 % reference differ by one and it will produce both |\ref| and
118 % |\pageref| when the difference is larger. The word `facing' is used
119 % when label and reference both fall onto a double spread. However,
120 % if a special page numbering scheme is used instead of the usual
121 % arabic numbering (e.g., |\pagenumbering{roman}|) then there will be
122 % no distinction between one or many pages off.
124 %\DescribeMacro\vpageref Sometimes one wants to refer only to page
125 % number and again such a reference should normally be suppressed if
126 % we are referring to the current page. For this purpose the package
127 % defines the |\vpageref| command. It will produce the same strings as
128 % |\vref| except that it doesn't start with the |\ref| and except that
129 % it will produce the string that is saved in |\reftextcurrent| if
130 % label and reference fall onto the same page. By defining
131 % |\reftextcurrent| to produce ``on this page'' or something similar,
134 % ... see the example \vpageref{ex:foo} which shows ...
136 % comes out as ``\ldots~see the example which shows~\ldots'', which
137 % could be misleading.
139 % You can put a space in front of |\vpageref| it will be ignored if
140 % the command doesn't produce any text at all.
142 % But in fact |\vpageref| allows even more control. If has two
143 % optional arguments. With the first one, one can specify the text
144 % that should be used if label and reference fall on the same page.
145 % This is very helpful if both are near to each other, so that they
146 % may or may not be separated by a page break. In such a case we
147 % usually know (!) whether the reference is before or after the label
148 % so that we can say something like
150 % ... see the example \vpageref[above]{ex:foo} which shows ...
152 % which will then come out as ``\ldots~see the example above which
153 % shows~\ldots'' if we are still on the same page, but as ``\ldots~see
154 % the example on the page before which shows~\ldots'' (or something
155 % similar depending on the settings of the |\reftext..before|
156 % commands) when there was a page break in the meantime. One warning
157 % however, if you use |\vpageref| with the optional argument to refer
158 % to a figure or table, keep in mind that depending on the float
159 % placement parameters the float may show up on top of the current
160 % page and therefore before the reference even if it came after it in
163 % But maybe you prefer to say ``\ldots~see the above example'' if
164 % example and reference fall onto the same page, i.e., reverse the
165 % word order. In fact, in some languages the word order automatically
166 % changes in that case. To allow for this variation the second
167 % optional argument can be used. It specifies the text preceding the
168 % generated reference if object and reference do not fall onto the
169 % same page. Thus one would write
171 % ... see the \vpageref[above example][example]{ex:foo}
174 % to achieve the desired effect.
177 % \DescribeMacro\vrefrange
179 % This command is similar to |\vref| but it
180 % takes two mandatory arguments denoting a range to refer to (e.g., a
181 % sequences of figures or a sequence of equations, etc.). So if
182 % |fig:a| is your first figure in the sequence and |fig:c| your last
185 % ... see figures \vrefrange{fig:a}{fig:c} ...
187 % which would then be formatted as
189 % \ldots\ see figures 3.4 to 3.6 on pages 23--24 \ldots
191 % or, if they happen to all fall onto the next page, as
193 % \ldots\ see figures 3.4 to 3.6 on the following page \ldots
195 % i.e., the command is deciding what to say depending on where the two
196 % labels are placed in relation to each other; it is essentially
197 % implemented using |\vpagerefrange| described below.
198 % The optional argument the command may take is the text to use in case
199 % both labels are placed on the current page.
202 % \DescribeMacro\vpagerefrange This command is similar to |\vpageref|
203 % but takes two mandatory arguments which are two labels denoting a
204 % range. If both labels fall onto the same page, the command acts
205 % exactly like |\vpageref| (with a single label), otherwise it produces
206 % something like ``on pages~15--18'' (see customization possibilities
207 % below). The optional argument it may take is the text to use in case
208 % both labels are placed on the current page.
210 % \DescribeMacro\vrefpagenum This macro is provided to allow the user
211 % to write their own small commands which implement functions similar
212 % to those provided by the two previous commands. It takes two
213 % arguments: the second is a label (i.e., as used in |\label| or
214 % |\ref|) and the first is an arbitrary command name (make sure you
215 % use our own) that receives the page number related to this label.
216 % So if you have two (or more) labels you could retrieve their page
217 % numbers, compare them and then decide what to print. For example,
218 % the following not very serious definition (also using the
219 % \texttt{ifthen} package)
221 % \newcommand\amusingversion[2]{%
222 % \vrefpagenum\firstnum{#1}%
223 % \vrefpagenum\secondnum{#2}%
225 % \ifthenelse{\equal\firstnum\secondnum}%
226 % {s of \ref{#1} and \ref{#2} \vpageref{#1}}%
227 % { of \ref{#1} \vpageref{#1} and of \ref{#2} \vpageref{#2}}%
230 % ...\amusingversion{foo}{bar}
232 % will print something like
234 % \ldots the definitions of 3 and 4 on the previous page
236 % in the case both labels are on the same page but something like
238 % \ldots the definition of 3 on the next page and of 4 on page~13
240 % in case the are on different pages.
243 % The user commands |\vref|, |\vpageref|, and |\vpagerefrange| all
245 % work by first removing any space on their left and then inserting
246 % some space of their own (|\vref|, for example, a nonbreakable
247 % space). That seemed like a good idea back then, but it has the
248 % disadvantage that you can't use these macros in situations where you
249 % definitely do not want any space before the generated text. E.g., in
250 % situations like |(\vref{foo} ...)| you end up with a space after the
253 % \DescribeMacro{\vref*}
254 % \DescribeMacro{\vpageref*}
255 % \DescribeMacro{\vpagerefrange*}
256 % Since it is too late to change the default behaviour I've added star
257 % versions of the macros which do not add any space before the
258 % generated text (they do nevertheless remove space at the left).
262 % \DescribeMacro\labelformat
264 % A reference via |\ref| produces by default the data associated with
265 % the corresponding |\label| command (typically a number); any
266 % additional formatting has to be provided by the user. If, for
267 % example, references to equations are always to be typeset as
268 % ``equation (\textit{number})'', one has to code
269 % ``\verb=equation (\ref{=\textit{key}\verb=})=''. With |\labelformat|
270 % the \texttt{varioref} package offers a possibility to generate such
271 % frills automatically. The command takes two arguments: the first is
272 % the name of a counter and the second is its representation when
273 % referenced. This means that for a successful usage, one has to know
274 % the counter name being used for generating the label, though in
275 % practice this should not pose a problem. The current counter number
276 % is picked up as an argument.
277 % Here are two examples:
279 % \labelformat{section}{section~#1}
280 % \labelformat{equation}{equation~(#1)}}
284 % \DescribeMacro\Vref
286 % A side effect of using |\labelformat| is that, depending on the
287 % defined formatting, it becomes impossible to use |\ref| at the
288 % beginning of a sentence (if its replacement text starts with a
289 % lowercase letter). To overcome this problem \texttt{varioref}
290 % introduces the commands |\Ref| and |\Vref| that behave like
291 % |\ref| and |\{vref| except that they uppercase the first token
292 % of the generated string.
294 % To make |\Ref| or |\Vref| work properly the very first token in
295 % the second argument of |\labelformat| has to be a simple \textsc{ascii}
296 % letter, otherwise the capitalization will fail or worse, you will end
297 % up with some error messages. If you actually need something more
298 % complicated in this place (e.g., an accented letter)
299 % you have to explicitly surround it with braces, to
300 % identify the part that needs to be capitalized. For example, for
301 % figure references in the Hungarian language you might want to write
302 % |\labelformat{figure}{{\'a}bra~\thefigure}|.
304 % \DescribeMacro\vpagerefnum
305 % If you like to have |\vref| suppress the page number on pages where
306 % label and reference fall onto the same page, but prefer reference to
307 % page numbers otherwise then |\vpagerefnum| can be used. This macro
308 % hold the current page ``number'' when |\vpageref| and friends are
309 % executed. Thus, by defining, for example
311 %\renewcommand\reftextfaceafter {on page~\thevpagerefnum}
312 %\renewcommand\reftextfacebefore{on page~\thevpagerefnum}
313 %\renewcommand\reftextafter {on page~\thevpagerefnum}
314 %\renewcommand\reftextbefore {on page~\thevpagerefnum}
316 % textual references can be suppressed.
318 % \section{Multi-lingual usage}
320 % The package works well together with the babel system if it is
321 % loaded \textit{after} the babel package, e.g., a document in English
322 % (default), French and German text could load the packages as
325 % \usepackage[ngerman,french,english]{babel,varioref}
327 % (or in two separate lines if you prefer one |\usepackage| line per
328 % package). Depending on the current babel language |\vref| and
329 % friends would then generate strings in different languages. If the
330 % language options are given as global options to the document class
331 % then it is enough to use
333 % \usepackage{babel,varioref}
335 % to achieve the same effect.
337 % If more than one language is specified with \texttt{varioref} then
338 % it will start using the last language selected. Switching of
339 % languages is managed through Babel; nevertheless all languages of
340 % interest need to be specified when \texttt{varioref} is loaded so
341 % that it can integrate their strings into the Babel system.
344 % \section{Customization}
346 % The package supports all options defined by the babel package to
347 % translate the fixed strings into other languages than English.
348 % (Some languages need updating, however---help is appreciated.) It
349 % also supports languages currently not in babel (those can only be
350 % used standalone, obviously); check the section on options later~on.
355 % You can also modify some or all of the strings by redefining the
356 % following commands after the package has been loaded.
357 %\DescribeMacro\reftextbefore
358 %\DescribeMacro\reftextfacebefore
359 %\DescribeMacro\reftextafter
360 %\DescribeMacro\reftextfaceafter Backward references use
361 % |\reftextbefore| if the label is on the preceding page but invisible
362 % and |\reftextfacebefore| if it is one the facing page (i.e., if the
363 % current page number is odd). Similarly |\reftextafter| is used
364 % when the label comes on the next page but one has to turn the page
365 % and |\reftextfaceafter| if it is on the following but facing page.
367 % In fact, |\reftextface...| is used only if the user or the document
368 % class specified two-sided printing.
370 %\DescribeMacro\reftextfaraway Finally we have |\reftextfaraway| which
371 % is used whenever label and reference differ by more than one or when
372 % they aren't numeric. This macro is a bit different because it takes
373 % one argument, the symbolic reference string so that one cane make
374 % use of |\pageref| in its replacement text.
377 %\DescribeMacro\reftextvario To allow a bit random variation in the
378 % generated strings one can use the command |\reftextvario| inside the
379 % string macros. It takes two arguments and selects one or the other
380 % for printing depending on the number of already seens |\vref| or
381 % |\vpageref| commands. As an example see the definitions of
382 % |\reftextbefore| etc.\ \vpageref[below]{reftextbefore}.
384 % The commands |\vrefrange| and |\vpagerefrange| produce their text
386 % using two macros described below. By redefining them one can modify
387 % the results to accommodate special requirements.
390 % They both take two mandatory arguments denoting the first and the
391 % last label of the range.
394 % \DescribeMacro\reftextpagerange This macro produces text that
395 % describes the page range of the two labels, e.g., the default
396 % for English is ``|on pages~\pageref{#1}--\pageref{#2}}|''.
399 % \DescribeMacro\reftextlabelrange This macro produces text that
400 % describes the range of figures, tables, or whatever the labels refer
401 % to, the default for English is ``|\ref{#1} to~\ref{#2}|''.
403 % \subsection{\ldots\ if Babel is used}
405 % \begin{itshape} If babel is being used then the above commands need to be
406 % changed using the Babel mechanism, e.g.,
408 % \addto\extrasngerman{%
409 % \renewcommand\reftextfaceafter {auf der n\"achsten Seite}%
412 % Otherwise babel will reintroduce its own defaults whenever the language is
413 % changed (which happens in particular during |\begin{document}| where the
414 % main language is selected).
422 % As mentioned above the package supports all standard options offered
423 % by the Babel system to customize the strings produced, it may also
424 % have a few not supported by babel, for a full list look
425 % in section\vref{sec:impoptions}. In addition it offers the option
426 % \texttt{draft} to turn error messages into warnings during
427 % development. The default \texttt{final} produces error message when
428 % a generated string falls onto a page boundary (see next section).
431 % \section{A few warnings}
433 % Defining commands like the ones described above poses some
434 % interesting problems. Suppose, for example, that a generated text
435 % like `on the next page' gets broken across pages. If this happens it
436 % is very difficult to find an acceptable solution and in fact can
437 % even result in a document that will always change from one state to
438 % another (i.e., inserting one string, finding that this is wrong,
439 % inserting another string on the next run which makes the first
440 % string correct again, inserting \ldots). The current implementation
441 % of \texttt{varioref} therefore issues an error message whenever the
442 % generated text is broken across page boundaries, e.g.,
444 % table 5 on the current \meta{page break} page
446 % would would result in an error, which needs to be resolved by the
447 % user by replacing the |\vref| command with an ordinary |\ref| just
448 % before the final run. This is not
449 % completely satisfactory but in such case no solution really is.
450 % \DescribeMacro\vrefwarning
451 % During document preparation, while one is still changing the text,
452 % such error messages can be turned into warnings by placing a
453 % |\vrefwarning| command in the preamble. This is equivalent to
454 % specifying ``draft'' as an option to the package.
455 % \DescribeMacro\vrefshowerrors
456 % |\vrefshowerrors| ensures that varioref stops when detecting a
457 % possible loop. This is the default and equivalent to specifying
458 % ``final'' as an option.
460 % At the end final a warning: every use of |\vref| will internally
461 % generate two macro names to keep track of the string positions
462 % within the document. As a result you may run out of name space or
463 % main memory if you make heavy use of this macro on a small \TeX{}
465 %\DescribeMacro\fullref For this reason the primitive command
466 % |\fullref| is also provided. This command can be used whenever you
467 % know for sure that label and reference can't fall onto nearby pages.
469 % \StopEventually{\PrintIndex\PrintChanges}
472 % \section{The documentation driver file}
474 % The next bit of code contains the documentation driver file for
475 % \TeX{}, i.e., the file that will produce the documentation you are
476 % currently reading. It will be extracted from this file by the
477 % \texttt{docstrip} program.
480 \documentclass{ltxdoc}
481 \usepackage{multicol,varioref}
482 \GetFileInfo{varioref.sty}
483 \setlength\hfuzz{1pt} % ignore slight overfulls
485 %\DisableCrossrefs % Say \DisableCrossrefs if index is ready
487 \RecordChanges % Gather update information
488 %\OnlyDescription % comment out for implementation details
490 \DocInput{varioref.dtx}
496 % \section{The implementation}
498 % The main implementation idea is to generate an internal label
499 % command for every |\vpageref| and compare the page reference of this
500 % label with the page reference of the user-requested label. Since
501 % this means one additional macro name for each use of |\vpageref| or
502 % |vref| (which is implemented in terms of |\vpageref|) the memory
503 % requirements of this package may be high in terms of main and macro
504 % name memory. Since the information held in the internal labels is
505 % used only once one could envision a different scheme if suitable
506 % primitives for this kind of ``one place information'' would be
507 % provided by \LaTeX. This type of data structure is planned for
508 % \LaTeX3 but for the moment we have to live with the memory
511 % We start by checking if this file was already loaded. If not we
512 % identify the current version. This is actually done at the top
513 % of the file, so we comment it out here
514 % \changes{v0.1h}{1993/08/15}{Small documentation changes}
517 %\NeedsTeXFormat{LaTeX2e}[1994/06/01]
518 %\ProvidesPackage{varioref}[\filedate\space\fileversion\space
519 % LaTeX2e package for extended references (FMi)]
523 % \begin{macro}{\vref@addto}
524 % \changes{v1.0b}{1994/01/31}{Avoid using babel `addto}
525 % \changes{v1.0b}{1994/01/31}{The babel commands are starting
527 % To support the use of babel we want to add the additional strings
528 % to the |\extras|\meta{language} commands. Since |\addto| in the
529 % current implementation of babel has a bug that does not allow to
530 % use arguments containing hashmarks we do this by hand.
532 \def\vref@addto#1#2{%
536 \edef#1{\the\@temptokena}%
538 \toks@\expandafter{#1}%
539 \edef#1{\the\toks@\the\@temptokena}%
541 \@temptokena{}\toks@\@temptokena
543 \@onlypreamble\vref@addto
548 % \subsection{Options}\label{sec:impoptions}
550 % \begin{macro}{\vref@excuse}
551 % Excuse that we don't know the strings for a certain language.
552 % \changes{v1.0q}{1995/04/06}{Use `PackageWarning}
555 \PackageWarningNoLine{varioref}{Sorry, language `#1'
559 English strings used by default.
561 Please modify \protect\reftext... commands manually.%
562 \MessageBreak\MessageBreak
563 If you can suggest translations for
567 to the author of this package}}
568 \@onlypreamble\vref@excuse
572 % \begin{macro}{\vref@stringwarning}
573 % And we sometimes just don't know some strings~\ldots
574 % \changes{v1.2a}{1998/08/01}{Macro added}
576 \def\vref@stringwarning#1{%
577 \PackageWarningNoLine{varioref}{Sorry, there is no proper
578 translation for the string\MessageBreak
579 produced by \protect#1\on@line.\MessageBreak
580 English string used instead.\MessageBreak
582 If you can suggest translations for
583 the current\MessageBreak
584 language, please mail them
585 to the author of this\MessageBreak package}}
590 % \begin{macro}{\reftextfaceafter}
591 % \begin{macro}{\reftextfacebefore}
592 % \begin{macro}{\reftextafter}
593 % \begin{macro}{\reftextbefore}
594 % \begin{macro}{\reftextcurrent}
595 % \label{reftextbefore} The options do set the macros that
596 % generate the textual strings. Note, that they do not start with a
597 % space, the space is already added in the main macro below.
598 % \changes{v1.2a}{1998/08/22}{Added american defaults for
599 % \cs{reftextpagerange} and \cs{reftextlabelrange}}
600 % \changes{v1.4d}{2002/11/11}{Changed default for \cs{reftextbefore}}
602 % Afrikaans option contributed by Danie Els
603 % (\texttt{dnjels@sun.ac.za}).
604 % \changes{v1.4g}{2003/03/29}{Added afrikaans option}
606 \DeclareOption{afrikaans}
607 {\vref@addto\extrasafrikaans{%
608 \def\reftextfaceafter {op die \reftextvario{regterbladsy}%
610 \def\reftextfacebefore{op die \reftextvario{linkerbladsy}%
612 \def\reftextafter {op die \reftextvario{volgende bladsy}%
614 \def\reftextbefore {op die \reftextvario{vorige bladsy}%
616 \def\reftextcurrent {op \reftextvario{hierdie}%
617 {die huidige} bladsy}%
618 \def\reftextfaraway#1{op bladsy~\pageref{#1}}%
619 \def\reftextpagerange#1#2{op bladsye~\pageref{#1}--\pageref{#2}}%
620 \def\reftextlabelrange#1#2{\ref{#1} tot~\ref{#2}}%
625 \DeclareOption{american}
626 {\vref@addto\extrasamerican{%
627 \def\reftextfaceafter {on the \reftextvario{facing}{next} page}%
628 \def\reftextfacebefore{on the \reftextvario{facing}{preceding}
630 \def\reftextafter {on the \reftextvario{following}{next} page}%
631 \def\reftextbefore {on the \reftextvario{preceding}{previous} page}%
632 \def\reftextcurrent {on \reftextvario{this}{the current} page}%
633 \def\reftextfaraway#1{on page~\pageref{#1}}%
634 \def\reftextpagerange#1#2{on pages~\pageref{#1}--\pageref{#2}}%
635 \def\reftextlabelrange#1#2{\ref{#1} to~\ref{#2}}%
638 % \changes{v1.2a}{1998/11/27}{Added austrian defaults (identical to german)}
639 % The austrian defaults are the same as the german ones.
641 \DeclareOption{austrian}
642 {\vref@addto\extrasaustrian{%
643 \def\reftextfaceafter {auf der n\"achsten Seite}%
644 \def\reftextfacebefore{auf der vorherigen Seite}%
645 \let\reftextafter \reftextfaceafter
646 \let\reftextbefore \reftextfacebefore
647 \def\reftextcurrent {auf dieser Seite}%
648 \def\reftextfaraway#1{auf Seite~\pageref{#1}}%
649 \def\reftextpagerange#1#2{auf Seiten~\pageref{#1}--\pageref{#2}}%
650 \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}%
653 % \changes{v1.2d}{2000/01/11}{Added naustrian defaults (identical to german)}
654 % The naustrian defaults are the same but needed for ``Neue Rechtschreibung''.
656 \DeclareOption{naustrian}
657 {\vref@addto\extrasnaustrian{%
658 \def\reftextfaceafter {auf der n\"achsten Seite}%
659 \def\reftextfacebefore{auf der vorherigen Seite}%
660 \let\reftextafter \reftextfaceafter
661 \let\reftextbefore \reftextfacebefore
662 \def\reftextcurrent {auf dieser Seite}%
663 \def\reftextfaraway#1{auf Seite~\pageref{#1}}%
664 \def\reftextpagerange#1#2{auf Seiten~\pageref{#1}--\pageref{#2}}%
665 \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}%
668 % Text for basque defaults was contributed by
669 % I\~naki Larra\~naga Murgoitio (aka dooteo)
670 % (|<dooteo@euskalgnu.org>|).
671 % \changes{v1.4k}{2005/04/09}{Basque defaults added.}
673 \DeclareOption{basque}
674 {\vref@addto\extrasbasque{%
675 \def\reftextfaceafter {hurrengo orrialdean}%
676 \def\reftextfacebefore{aurreko orrialdean}%
677 \let\reftextafter \reftextfaceafter
678 \let\reftextbefore \reftextfacebefore
679 \def\reftextcurrent {uneko orrialdean}%
680 \def\reftextfaraway#1{~\pageref{#1}. orrialdean}%
681 \def\reftextpagerange#1#2{~\pageref{#1}--\pageref{#2} orrialdeetan}%
682 \def\reftextlabelrange#1#2{\ref{#1}.etik \ref{#2}.eraino}%
685 % Text for the Bahasa Malaysia defaults was contributed by
686 % Bob Margolis 2005-12-02.
688 % Notes: pada muka surat translates as ``on the page'' though BM has no
689 % definite (or indefinite) article; adjectives and other modifiers follow
690 % the noun (clause); bertentangan is ``opposite'' in the sense of
691 % ``facing''; berikutnya is ``next'' (in this context - actually
692 % next-to-this, literally); berikutnya also translates as ``following
693 % this'' sebelumnya is ``preceding''; also ``previous'' ``ini'' translates,
694 % literally, as ``this'' but is also used in the sense of current page.
695 % \changes{v1.4o}{2005/12/02}{Bahasa Malaysia defaults added.}
697 \DeclareOption{bahasam}
698 {\vref@addto\extrasbahasam{%
699 \def\reftextfaceafter {pada muka surat \reftextvario{bertentangan}{berikutnya}}%
700 \def\reftextfacebefore{pada muka surat \reftextvario{bertentangan}{sebelumnya} }%
701 \def\reftextafter {pada muka surat berikutnya}%
702 \def\reftextbefore {pada muka surat sebelumnya}%
703 \def\reftextcurrent {pada muka surat ini}%
704 \def\reftextfaraway#1{pada muka surat~\pageref{#1}}%
705 \def\reftextpagerange#1#2{pada muka surat~\pageref{#1}--\pageref{#2}}%
706 \def\reftextlabelrange#1#2{\ref{#1}--\ref{#2}}%
709 % Text for brazil defaults was contributed by
710 % Alcino Dall Igna Junior\\
711 % (|adij@di.ufpe.br|).
712 % \changes{v1.0g}{1994/05/18}{Brazil defaults added.}
713 % \changes{v1.4o}{2005/11/07}{Added a few more brazil strings}
714 % \changes{v1.4r}{2007/05/26}{Misspelling of \cs{extrasbrazil}}
716 \DeclareOption{brazil}
717 {\vref@addto\extrasbrazil{%
718 \def\reftextfaceafter {na \reftextvario{p\'agina oposta}{pr\'oxima
720 \def\reftextfacebefore{na p\'agina \reftextvario{oposta}{anterior}}%
721 \def\reftextafter {na \reftextvario{p\'agina seguinte}{pr\'oxima
723 \def\reftextbefore{na p\'agina \reftextvario{anterior}{precedente}}%
724 \def\reftextcurrent {\reftextvario{nesta p\'agina}{na p\'agina
726 \def\reftextfaraway#1{na p\'agina~\pageref{#1}}%
727 \def\reftextpagerange#1#2{nas p\'aginas~\pageref{#1}--\pageref{#2}}%
728 \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
731 % Text for Breton defaults was contributed by
732 % Christian ROLLAND\\
733 % (|Christian.Rolland@univ-brest.fr|).
734 % \changes{v1.0o}{1994/09/27}{Added defaults for breton}
736 \DeclareOption{breton}
737 {\vref@excuse{breton}%
738 \vref@addto\extrasbreton{%
739 \def\reftextfaceafter {war ar bajenn \reftextvario{a-dal}{da heul}}%
740 \def\reftextfacebefore{war ar bajenn \reftextvario{a-dal}{a-raok}}%
741 \def\reftextafter {war ar bajenn da heul}%
742 \def\reftextbefore {war ar bajenn a-raok}%
743 \def\reftextcurrent {war ar \reftextvario{bajenn-ma\~n}%
745 \def\reftextfaraway#1{war ar bajenn~\pageref{#1}}%
746 \def\reftextpagerange#1#2{\vref@stringwarning\reftextpagerange
747 on pages~\pageref{#1}--\pageref{#2}}%
748 \def\reftextlabelrange#1#2{\vref@stringwarning\reflabelpagerange
749 \ref{#1} to~\ref{#2}}%
752 % Text for Bulgarian defaults was contributed by
753 % Georgi Boshnakov\\ (|georgi.boshnakov@gmail.com|).
754 % \changes{v1.4q}{2006/05/23}{Added defaults for bulgarian}
756 \DeclareOption{bulgarian}%
757 {\vref@addto\extrasbulgarian{%
758 \def\reftextfaceafter{\cyrn\cyra\
759 \reftextvario{\cyrs\cyrery\cyrs\cyre\cyrd\cyrn\cyra\cyrt\cyra}%
760 {\cyrs\cyrl\cyre\cyrd\cyrv\cyra\cyrshch\cyra\cyrt\cyra}
761 \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
762 \def\reftextfacebefore{\cyrn\cyra\
763 \reftextvario{\cyrs\cyrery\cyrs\cyre\cyrd\cyrn\cyra\cyrt\cyra}%
764 {\cyrp\cyrr\cyre\cyrd\cyrn\cyra\cyrt\cyra}
765 \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
766 \def\reftextafter{\cyrn\cyra\
767 \reftextvario{\cyrs\cyrl\cyre\cyrd\cyrv\cyra\cyrshch\cyra\cyrt\cyra}%
768 {\cyrs\cyrl\cyre\cyrd\cyrv\cyra\cyrshch\cyra\cyrt\cyra}
769 \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
770 \def\reftextbefore{\cyrn\cyra\
771 \reftextvario{\cyrp\cyrr\cyre\cyrd\cyrn\cyra\cyrt\cyra}%
772 {\cyrp\cyrr\cyre\cyrd\cyri\cyrsh\cyrn\cyra\cyrt\cyra}
773 \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
774 \def\reftextcurrent{\cyrn\cyra\
775 \reftextvario{\cyrt\cyra\cyrz\cyri}%
776 {\cyrt\cyre\cyrk\cyru\cyrshch\cyra\cyrt\cyra}
777 \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}%
778 \def\reftextfaraway#1{\cyrn\cyra\ \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra
780 \def\reftextpagerange#1#2{\cyrn\cyra\
781 \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyri
782 ~\pageref{#1}--\pageref{#2}}%
783 \def\reftextlabelrange#1#2{\ref{#1} \cyrd\cyro~\ref{#2}}%
786 % Text for catalan defaults was contributed by Robert Fuster\\
787 % (\verb=rfuster@mat.upv.es=).
788 % \changes{v1.1c}{1997/06/12}{Added defaults for catalan}
789 % \changes{v1.2g}{2000/08/22}{Updated defaults for catalan}
791 \DeclareOption{catalan}
792 {\vref@addto\extrascatalan{%
793 \def\reftextfaceafter {a la p\`agina seg\"uent}%
794 \def\reftextfacebefore{a la p\`agina anterior}%
795 \let\reftextafter \reftextfaceafter
796 \let\reftextbefore \reftextfacebefore
797 \def\reftextcurrent {en aquesta p\`agina}%
798 \def\reftextfaraway#1{a la p\`agina~\pageref{#1}}%
799 \def\reftextpagerange#1#2{a les
800 p\`agines~\pageref{#1}--\pageref{#2}}%
801 \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
804 % Text for croatian defaults was contributed by \v{S}ime Ungar
805 % (\verb=ungar@math.hr=).
806 % \changes{v1.4p}{2006/05/13}{Added defaults for croatian}
808 \DeclareOption{croatian}
809 {\vref@addto\extrascroatian{%
810 \def\reftextfaceafter {na sljede\'coj stranici}%
811 \def\reftextfacebefore{na prethodnoj stranici}%
812 \let\reftextafter \reftextfaceafter
813 \let\reftextbefore \reftextfacebefore
814 \def\reftextcurrent {na ovoj stranici}%
815 \def\reftextfaraway#1{na stranici~\pageref{#1}}%
816 \def\reftextpagerange#1#2{na stranicama~\pageref{#1}--\pageref{#2}}%
817 \def\reftextlabelrange#1#2{\ref{#1} do~\ref{#2}}%
820 % Defaults for the Czech option provided by Milan Vancura
821 % \verb=<milan@suse.cz>=.
822 % \changes{v1.2e}{2000/04/04}{Added czech defaults}
824 \DeclareOption{czech}
825 {%\vref@excuse{czech}%
826 \vref@addto\extrasczech{%
827 \def\reftextfaceafter {na n\'a\-sle\-du\-j\'\i c\'\i\ stran\v{e}}%
828 \def\reftextfacebefore{na p\v{r}ed\-choz\'\i\ stran\v{e}}%
829 \def\reftextafter {na n\'a\-sle\-du\-j\'\i c\'\i\ stran\v{e}}%
830 \def\reftextbefore {na p\v{r}ed\-choz\'\i\ stran\v{e}}%
831 \def\reftextcurrent {na t\'eto stran\v{e}}%
832 \def\reftextfaraway#1{na stran\v{e}~\pageref{#1}}%
833 \def\reftextpagerange#1#2{na stran\'ach~\pageref{#1}\--\pageref{#2}}%
834 \def\reftextlabelrange#1#2{\ref{#1} a\v{z}~\ref{#2}}%
837 % Defaults for Danish provided by Torsten Martinsen
838 % (\verb=tmar91@kom.auc.dk=). Further defaults by Ole Laursen
839 % (\verb=olau@hardworking.dk=).
840 % \changes{v1.0n}{1994/09/25}{Added Danish defaults}
841 % \changes{v1.2h}{2000/12/30}{Updates to Danish defaults}
843 \DeclareOption{danish}
844 {\vref@addto\extrasdanish{%
845 \def\reftextfaceafter {p\aa{} \reftextvario{modst\aa ende}%
847 \def\reftextfacebefore{p\aa{} \reftextvario{modst\aa ende}%
849 \def\reftextafter {p\aa{} \reftextvario{den f\o lgende}%
851 \def\reftextbefore {p\aa{} \reftextvario{forrige side}
852 {foreg\aa ende side}}%
853 \def\reftextcurrent {p\aa{} denne side}%
854 \def\reftextfaraway#1{p\aa{} side~\pageref{#1}}%
855 \def\reftextpagerange#1#2{p\aa{} side~\pageref{#1}--\pageref{#2}}%
856 \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}%
859 % Default string for dutch have been contributed by Frank Poppe
860 % (\verb=POPPE@SWOV.NL=).
861 % This option currently supports one additional string macro
862 % |\refpagename| so that you can easily change to |bladzijde|
863 % instead of |pagina| if you prefer this word for ``page''.
864 % However, I will not guarantee that this will survive future
865 % versions of this package, so use it on your own risk (you can
866 % always update the full strings to be on the safe side).
867 % \changes{v1.0l}{1994/07/07}{Added dutch defaults}
868 % \changes{v1.2a}{1998/08/22}{Added dutch defaults for
869 % \cs{reftextpagerange} and \cs{reftextlabelrange}}
871 \DeclareOption{dutch}
872 {\vref@addto\extrasdutch{%
873 \def\refpagename{pagina}%
874 \def\reftextfaceafter {op de \reftextvario{rechter \refpagename}%
875 {\refpagename\ hiernaast}}%
876 \def\reftextfacebefore{op de \reftextvario{linker \refpagename}%
877 {\refpagename\ hiernaast}}%
878 \def\reftextafter {op de \reftextvario{volgende \refpagename}%
879 {\refpagename\ hierna}}%
880 \def\reftextbefore {op de \reftextvario{vorige \refpagename}%
881 {\refpagename\ hiervoor}}%
882 \def\reftextcurrent {op deze \refpagename}%
883 \def\reftextfaraway#1{op \refpagename~\pageref{#1}}%
885 % Concerning the next defaults I received the following comment by
886 % Frederik Fouvry \texttt{<fouvry@coli.uni-sb.de>}:
887 % ``In the Dutch options (where I can exert a proper language
888 % judgement ;-), `t/m' is not used in formal (scientific) texts. I
889 % would either use `--' or `tot en met' (the abbreviation written
891 % \changes{v1.4d}{2002/11/11}{Changed default for \cs{reftextlabelrange}}
892 % \changes{v1.4m}{2005/06/09}{Fixed \cs{reftextlabelrange} (pr/3791)}
894 \def\reftextpagerange#1#2{op pagina's~\pageref{#1}--\pageref{#2}}%
895 \def\reftextlabelrange#1#2{\ref{#1}--\ref{#2}}%
898 % \changes{v1.2a}{1998/08/22}{Added english defaults for
899 % \cs{reftextpagerange} and \cs{reftextlabelrange}}
900 % \changes{v1.4d}{2002/11/11}{Changed default for \cs{reftextbefore}}
902 \DeclareOption{english}
903 {\vref@addto\extrasenglish{%
904 \def\reftextfaceafter {on the \reftextvario{facing}{next} page}%
905 \def\reftextfacebefore{on the \reftextvario{facing}{preceding}
907 \def\reftextafter {on the \reftextvario{following}{next} page}%
908 \def\reftextbefore {on the \reftextvario{preceding}{previous} page}%
909 \def\reftextcurrent {on \reftextvario{this}{the current} page}%
910 \def\reftextfaraway#1{on page~\pageref{#1}}%
911 \def\reftextpagerange#1#2{on pages~\pageref{#1}--\pageref{#2}}%
912 \def\reftextlabelrange#1#2{\ref{#1} to~\ref{#2}}%
916 % The esperanto strings were suggested by Albert Reiner
917 % (\verb=areiner@tph.tuwien.ac.at=).
918 % \changes{v1.4x}{2010/08/04}{Defaults for esperanto added}
920 \DeclareOption{esperanto}
921 {\vref@addto\extrasesperanto{%
922 \def\reftextfaceafter{en la
923 \reftextvario{flanka}{sekva} pa\^go}%
924 \def\reftextfacebefore{en la
925 \reftextvario{flanka}{anta\u ua} pa\^go}%
926 \def\reftextafter{en la sekva pa\^go}%
927 \def\reftextbefore{en la anta\u ua pa\^go}%
928 \def\reftextcurrent{\reftextvario{\^ci-pa\^ge}%
929 {en \^ci tiu pa\^go}}%
930 \def\reftextfaraway#1{en pa\^go~\pageref{#1}}%
931 \def\reftextpagerange#1#2{en pa\^goj~\pageref{#1} \^gis \pageref{#2}}%
932 \def\reftextlabelrange#1#2{\ref{#1} \^gis~\ref{#2}}%
935 % The finnish strings were suggested by Matti Rintala
936 % (\verb=bitti@cs.tut.fi=) and Hillevi Gavel
937 % \verb=Hillevi.Gavel@mdh.se=.
938 % \changes{v1.0m}{1994/09/23}{Added finnish strings}
939 % \changes{v1.4o}{2005/11/07}{Added a few more finnish strings}
941 \DeclareOption{finnish}
942 {\vref@addto\extrasfinnish{%
943 \def\reftextfaceafter {\reftextvario{viereisell\"a}%
944 {seuraavalla} sivulla}%
945 \def\reftextfacebefore{\reftextvario{viereisell\"a}%
946 {edellisell\"a} sivulla}%
947 \def\reftextafter {seuraavalla sivulla}%
948 \def\reftextbefore {edellisell\"a sivulla}%
949 \def\reftextcurrent {t\"all\"a sivulla}%
950 \def\reftextfaraway#1{sivulla~\pageref{#1}}%
951 \def\reftextpagerange#1#2{sivuilla~\pageref{#1}--\pageref{#2}}%
953 % Can't combine numbers with the necessary suffix well.
955 \def\reftextlabelrange#1#2{\ref{#1}--\ref{#2}}%
958 % French defaults are provided by Daniel Flippo
959 % (\verb=Daniel.Flipo@univ-lille1.fr=).
960 % \changes{v1.0j}{1994/06/21}{Added french defaults}
961 % \changes{v1.2a}{1998/08/22}{Added french defaults for
962 % \cs{reftextpagerange} and \cs{reftextlabelrange}}
964 \DeclareOption{french}
965 {\vref@addto\extrasfrench{%
966 \def\reftextfaceafter {page \reftextvario{ci-contre}{suivante}}%
967 \def\reftextfacebefore{page \reftextvario{ci-contre}%
969 \def\reftextafter {page suivante}%
970 \def\reftextbefore {page pr\'ec\'edente}%
971 \def\reftextcurrent {de la pr\'esente page}%
972 \def\reftextfaraway#1{page~\pageref{#1}}%
973 \def\reftextpagerange#1#2{pages~\pageref{#1}--\pageref{#2}}%
974 \def\reftextlabelrange#1#2{\ref{#1} \`a~\ref{#2}}%
977 % Galician defaults are provided by Matthias Moebius\\
978 % (\texttt{Matthias.Moebius@uni-konstanz.de}).
979 % \changes{v1.1f}{1998/04/25}{Added galician defaults}
980 % \changes{v1.4o}{2005/11/10}{Added further galician defaults}
981 % \changes{v1.4o}{2005/11/26}{Some further corrections}
982 % \changes{v1.5b}{2015/09/22}{Fixed blunder from 2005 -
983 % galician option clearly never used}
985 \DeclareOption{galician}
986 {\vref@addto\extrasgalician{%
987 \def\reftextfaceafter {na p\'axina oposta}%
988 \def\reftextfacebefore\reftextfaceafter
989 \def\reftextafter {na p\'axina seguinte}%
990 \def\reftextbefore {na p\'axina anterior}%
991 \def\reftextcurrent {nesta p\'axina}%
992 \def\reftextfaraway#1{na p\'axina~\pageref{#1}}%
993 \def\reftextpagerange#1#2{%
994 nas p\'axinas~\pageref{#1}-\pageref{#2}}%
995 \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
998 % There are no good variants for German (I think and still think but
999 % this is a matter of taste :-).
1000 % \changes{v1.0b}{1994/01/31}{Replace in incorrect `def by `let}
1001 % The following definitions were recently suggested to me but since
1002 % the original are in for a long time i don't want to change them
1003 % now since that could make a lot of documents change their formatting.
1004 % If you fancy them, add a redefinition of the corresponding macro(s)
1005 % to the preamble of your document.
1007 % \def\reftextfaceafter {auf der \reftextvario
1008 % {gegen\"uberliegenden}{anderen} Seite}%
1009 % \def\reftextfacebefore {auf der \reftextvario
1010 % {gegen\"uberliegenden}{anderen} Seite}%
1011 % \def\reftextafter {auf der \reftextvario
1012 % {n\"achsten}{folgenden} Seite}%
1013 % \def\reftextbefore {auf der \reftextvario
1014 % {vorigen}{vorhergehenden} Seite}%
1015 % \def\reftextcurrent {\reftextvario
1016 % {auf dieser}{diese} Seite}%
1018 % \changes{v1.4n}{2005/07/24}{Small change}
1020 \DeclareOption{german}
1021 {\vref@addto\extrasgerman{%
1022 \def\reftextfaceafter {auf der n\"achsten Seite}%
1023 \def\reftextfacebefore{auf der vorherigen Seite}%
1024 \let\reftextafter \reftextfaceafter
1025 \let\reftextbefore \reftextfacebefore
1026 \def\reftextcurrent {auf dieser Seite}%
1027 \def\reftextfaraway#1{auf Seite~\pageref{#1}}%
1028 \def\reftextpagerange#1#2{auf den Seiten~\pageref{#1}--\pageref{#2}}%
1029 \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}%
1032 % \changes{v1.2d}{2000/01/11}{Added ngerman defaults (identical to german)}
1033 % \changes{v1.4n}{2005/07/24}{Small change}
1034 % The ngerman defaults are the same but needed for ``Neue Rechtschreibung''
1035 % (i.e., a different set of hyphenation patterns).
1037 \DeclareOption{ngerman}
1038 {\vref@addto\extrasngerman{%
1039 \def\reftextfaceafter {auf der n\"achsten Seite}%
1040 \def\reftextfacebefore{auf der vorherigen Seite}%
1041 \let\reftextafter \reftextfaceafter
1042 \let\reftextbefore \reftextfacebefore
1043 \def\reftextcurrent {auf dieser Seite}%
1044 \def\reftextfaraway#1{auf Seite~\pageref{#1}}%
1045 \def\reftextpagerange#1#2{auf den Seiten~\pageref{#1}--\pageref{#2}}%
1046 \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}%
1049 % Defaults for greek suggested by Apostolos Syropoulos\\
1050 % (\verb=apostolo@obelix.ee.duth.gr=).
1051 % \changes{v1.2a}{1998/08/22}{Added defaults for greek}
1053 \DeclareOption{greek}
1054 {\vref@addto\extrasgreek{%
1055 \def\reftextfaceafter {sthn \reftextvario{paro'usa}%
1056 {ep'omenh} sel'ida}%
1057 \def\reftextfacebefore{sthn \reftextvario{paro'usa}{prohgo'umenh}
1059 \def\reftextafter {sthn ep'omenh sel'ida}%
1060 \def\reftextbefore {sthn prohgo'umenh sel'ida}%
1061 \def\reftextcurrent {s'' aut'h th sel'ida}%
1062 \def\reftextfaraway#1{sth sel'ida\nobreakspace\pageref{#1}}%
1063 \def\reftextpagerange#1#2{stis sel'ides\nobreakspace
1064 \pageref{#1}---\pageref{#2}}%
1065 \def\reftextlabelrange#1#2{\ref{#1} ws\nobreakspace\ref{#2}}%
1068 % Icelandic defaults suggested by Thorhallur Sverrisson
1069 % (\verb=thorhs@basis.is=).
1070 % \changes{v1.4t}{2007/09/07}{Added defaults for icelandic}
1072 \DeclareOption{icelandic}
1073 {\vref@addto\extrasicelandic{%
1074 \def\reftextfaceafter {\'{a} \reftextvario{n{\ae}stu}%
1075 {n{\ae}stu} s\'{i}{\dh}u}%
1076 \def\reftextfacebefore{\'{a} \reftextvario{fyrri}%
1077 {fyrri} s\'{i}{\dh}u}%
1078 \def\reftextafter {\'{a} \reftextvario{n{\ae}stu}%
1079 {n{\ae}stu} s\'{i}{\dh}u}%
1080 \def\reftextbefore {\'{a} \reftextvario{fyrri}{fyrri} s\'{i}{\dh}u}%
1081 \def\reftextcurrent {\'{a} \reftextvario{{\th}essari}%
1082 {{\th}essari} s\'{i}{\dh}u}%
1083 \def\reftextfaraway#1{\'{a} s\'{i}{\dh}u~\pageref{#1}}%
1084 \def\reftextpagerange#1#2{\'{a} s\'{i}{\dh}um~\pageref{#1}--\pageref{#2}}%
1085 \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}%
1088 % Defaults for Italian suggested by Giovanni Pensa
1089 % (\verb=pensa@dsi.unimi.it=) with i{\TeX}nici.
1090 % \changes{v1.1b}{1995/10/19}{Added defaults for Italian}
1091 % \changes{v1.2a}{1998/08/22}{Removed incorrect warning}
1092 % \changes{v1.4k}{2004/10/30}{Added missing defaults supplied by Lapo Mori}
1093 % \changes{v1.4n}{2005/07/24}{Small change}
1094 % \changes{v1.4u}{2009/03/21}{Correction for \cs{reftextfaraway} suggested
1095 % by Lorenzo Pantieri}
1097 \DeclareOption{italian}
1098 {\vref@addto\extrasitalian{%
1099 \def\reftextfaceafter {\reftextvario{a fronte}%
1100 {nella pagina successiva}}%
1101 \def\reftextfacebefore{\reftextvario{a fronte}%
1102 {nella pagina precedente}}%
1103 \def\reftextafter {nella pagina \reftextvario{seguente}%
1105 \def\reftextbefore {nella pagina precedente}%
1106 \def\reftextcurrent {in questa pagina}%
1107 \def\reftextfaraway#1{a pagina~\pageref{#1}}%
1108 \def\reftextpagerange#1#2{nelle pagine~\pageref{#1}--\pageref{#2}}%
1109 \def\reftextlabelrange#1#2{da~\ref{#1} a~\ref{#2}}%
1112 % Defaults for Hungarian by Jeff Goldberg
1113 % (\verb=jeffrey@goldmark.org=).
1114 % There is a problem with the use of the definite article
1115 % \textit{a} or \textit{az} in Hungarian before expansions
1116 % of |\vref| or |\ref|. The problem is that the word
1117 % should be \textit{az} if the number following would begin with
1118 % a vowel if spelled out, and \textit{a} if the number would begin
1121 % The option assumes that there is a command |\aza| defined which
1122 % helps resolving this problem.\footnote{This information is actually quite
1123 % old but unfortunately never made it into varioref. In case any work
1124 % has been undertaken to resolve this please inform the author about it.}
1125 % \changes{v1.2a}{1998/08/22}{Added defaults for magyar}
1126 % \changes{v1.4j}{2005/01/22}{Defined \cs{reftextfaceafter} and
1127 % \cs{reftextfacebefore} instead of \cs{reftextafter} and \cs{reftextbefore}}
1129 \DeclareOption{magyar}
1130 {\vref@addto\extrasmagyar{%
1131 \def\reftextafter {a k\"o\-vet\-kez\H{o} ol\-da\-lon}%
1132 \def\reftextbefore{az el\H{o}\-z\H{o} ol\-da\-lon}%
1133 \def\reftextfaceafter {\reftextvario{a t\'ul\-ol\-da\-lon}%
1134 {a k\"o\-vet\-kez\H{o} ol\-da\-lon}}%
1135 \def\reftextfacebefore{\reftextvario{a t\'ul\-ol\-da\-lon}%
1136 {az el\H{o}\-z\H{o} ol\-da\-lon}}%
1137 \def\reftextcurrent {ezen az ol\-da\-lon}%
1139 % The following suggested patch has not been added yet (pending changes
1142 % \def\reftextfaraway#1{a~\csname @@magyar@az@lowxu\endcsname
1143 % {\pageref{#1}}.~ol\-da\-lon}%
1144 % \def\reftextpagerange#1#2{a~\csname @@magyar@az@lowxu\endcsname
1146 % --\pageref{#2}.~ol\-da\-la\-kon}%
1147 % \def\reftextlabelrange#1#2{{}\csname @@magyar@told\endcsname\ref{#1}+tol
1148 % \ref{#2}-ig}% Dat: `{}' is here for anti-\capitalize
1151 \def\reftextfaraway#1{\aza{\pageref{#1}} \pageref{#1}.~ol\-da\-lon}%
1152 \def\reftextpagerange#1#2{\vref@stringwarning\reftextpagerange
1153 on pages~\pageref{#1}--\pageref{#2}}%
1154 \def\reftextlabelrange#1#2{\vref@stringwarning\reflabelpagerange
1155 \ref{#1} to~\ref{#2}}%
1158 % The |\AtBeginDocument| needs to be executed when the option is
1159 % processed and not inside the babel interface.
1160 % \changes{v1.4i}{2004/02/27}{Moved \cs{AtBeginDocument}}
1162 \AtBeginDocument{\providecommand\aza[1]{a/az%
1163 \PackageError{varioref}{%
1164 Proper definition for command \noexpand\aza missing}%
1165 {You need to (re)define the command \noexpand\aza that
1166 takes one argument (a number or a \noexpand\pageref command)
1167 and produces the string `a' or `az' depending on the argument
1168 value. It should also accept an optional argument (default `l')
1169 to denote whether or not the string should be lowercase or
1173 % The Norwegian and `nynorsk' translations have been provided by
1174 % Dag F Langmyhr \verb=<dag@ifi.uio.no>= and Karl Ove Hufthammer
1175 % \verb=<huftis@bigfoot.com>=.
1176 % \changes{v1.0q}{1995/04/06}{Added defaults for norsk}
1177 % \changes{v1.0q}{1995/04/06}{Added defaults for nynorsk}
1178 % \changes{v1.2a}{1998/08/22}{Updated defaults for norsk}
1179 % \changes{v1.2a}{1998/08/22}{Updated defaults for nynorsk}
1180 % \changes{v1.2a}{1998/08/22}{Added norsk defaults for
1181 % \cs{reftextpagerange} and \cs{reftextlabelrange}}
1182 % \changes{v1.2a}{1998/08/22}{Added nynorsk defaults for
1183 % \cs{reftextpagerange} and \cs{reftextlabelrange}}
1184 % \changes{v1.2i}{2001/01/12}{Updated nynorsk defaults}
1186 \DeclareOption{norsk}
1187 {\vref@addto\extrasnorsk{%
1188 \def\reftextfaceafter {p\aa{} neste side}%
1189 \def\reftextfacebefore{p\aa{} forrige side}%
1190 \def\reftextafter {p\aa{} neste side}%
1191 \def\reftextbefore {p\aa{} forrige side}%
1192 \def\reftextcurrent {p\aa{} denne siden}%
1193 \def\reftextfaraway#1{p\aa{} side~\pageref{#1}}%
1194 \def\reftextpagerange#1#2{p\aa{} side~\pageref{#1}--\pageref{#2}}%
1195 \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}%
1197 \DeclareOption{nynorsk}
1198 {\vref@addto\extrasnynorsk{%
1199 \def\reftextfaceafter {p\aa{} neste side}%
1200 \def\reftextfacebefore{p\aa{} f\o{}rre side}%
1201 \def\reftextafter {p\aa{} neste side}%
1202 \def\reftextbefore {p\aa{} f\o{}rre side}%
1203 \def\reftextcurrent {p\aa{} denne sida}%
1204 \def\reftextfaraway#1{p\aa{} side~\pageref{#1}}%
1205 \def\reftextpagerange#1#2{p\aa{} side~\pageref{#1}--\pageref{#2}}%
1206 \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}%
1209 % The polish translations have been provided by
1210 % Tomasz Michniewski \\
1211 % \verb=<tomekm@ias.wat.waw.pl>=.
1212 % The use of the command \verb=\eob= and \verb=aob= etc.\
1213 % requires appropriate definitions as provided, for example, by
1214 % the babel system. This should probably be handled differently
1215 % but it would require modifications in babel's language support.
1216 % \changes{v1.1d}{1997/12/06}{Added defaults for polish}
1217 % \changes{v1.2a}{1998/08/22}{Added polish defaults for
1218 % \cs{reftextpagerange} and \cs{reftextlabelrange}}
1219 % \changes{v1.4n}{2005/09/14}{Changed default for \cs{reftextfaraway}}
1221 \DeclareOption{polish}
1222 {\vref@addto\extraspolish{%
1223 \def\reftextfaceafter {na \reftextvario{s\aob{}siedniej}%
1224 {nast\eob{}pnej} stronie}%
1225 \def\reftextfacebefore{na \reftextvario{s\aob{}siedniej}%
1226 {poprzedniej} stronie}%
1227 \def\reftextafter {na nast\eob{}pnej stronie}%
1228 \def\reftextbefore {na poprzedniej stronie}%
1229 \def\reftextcurrent {na \reftextvario{tej
1230 samej}{bie\zkb{}\aob{}cej} stronie}%
1231 \def\reftextfaraway#1{na stronie~\pageref{#1}}%
1232 \def\reftextpagerange#1#2{na stronach~\pageref{#1}--\pageref{#2}}%
1233 \def\reftextlabelrange#1#2{od~\ref{#1} do~\ref{#2}}%
1236 % The portuguese default text has been provided by
1237 % Jos\'e Carlos Oliveira Santos \verb=jcsantos@fc.up.pt=.
1238 % \changes{v1.2b}{1999/11/25}{Added portuguese defaults}
1239 % \changes{v1.2c}{1999/12/02}{Added more portuguese defaults}
1240 % \changes{v1.4r}{2007/05/26}{Misspelling of \cs{extrasportuges}}
1242 \DeclareOption{portuges}
1243 {\vref@addto\extrasportuges{%
1244 \def\reftextfaceafter {na \reftextvario{p\'agina ao lado}{pr\'oxima
1246 \def\reftextfacebefore{na p\'agina \reftextvario{ao lado}{anterior}}%
1247 \def\reftextafter {na \reftextvario{p\'agina seguinte}{pr\'oxima
1249 \def\reftextbefore{na p\'agina \reftextvario{anterior}{precedente}}%
1250 \def\reftextcurrent {nesta p\'agina}%
1251 \def\reftextfaraway#1{na p\'agina~\pageref{#1}}%
1252 \def\reftextpagerange#1#2{nas p\'aginas~\pageref{#1}--\pageref{#2}}%
1253 \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
1256 % Updates to the default text for Romanian have been suggested by Florin Oprina
1257 % (\verb=<florin.oprina@gmail.com>=).
1258 % \changes{v1.4v}{2009/06/13}{Incorrect text in \cs{reftextafter} (pr/4070)}
1259 % \changes{v1.5a}{2014/07/03}{Correct text in \cs{reftextbefore}}
1261 \DeclareOption{romanian}
1262 {\vref@addto\extrasromanian{%
1263 \def\reftextfaceafter {pe pagina \reftextvario{opus\u{a}}{urm\u{a}toarei}}%
1264 \def\reftextfacebefore{pe pagina \reftextvario{opus\u{a}}{precedentei}}%
1265 \def\reftextafter {\reftextvario{pe pagina urm\u{a}toare}%
1266 {pe urm\u{a}toarea pagin\u{a}}}%
1267 \def\reftextbefore {pe pagina \reftextvario{precedent\u{a}}%
1269 \def\reftextcurrent {pe aceast\u{a} pagin\u{a}}%
1270 \def\reftextfaraway#1{pe pagina~\pageref{#1}}%
1271 \def\reftextpagerange#1#2{pe paginile~\pageref{#1}--\pageref{#2}}%
1272 \def\reftextlabelrange#1#2{\ref{#1} la~\ref{#2}}%
1275 % The text for russian was taken from the book in Russian by
1276 % I.~A.~Kotelnikov and P.~Z.~Chebotaev, and adapted
1277 % to the encoding-independent form by Vladimir Volovich
1278 % (\verb=vvv@vsu.ru=).
1279 % \changes{v1.2a}{1998/11/23}{Added russian strings}
1280 % \changes{v1.2a}{1998/11/24}{Added defaults for
1281 % \cs{reftextpagerange} and \cs{reftextlabelrange}}
1283 \DeclareOption{russian}
1284 {\vref@addto\extrasrussian{%
1285 \def\reftextfaceafter{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyro
1286 \cyrt\cyri\cyrv\cyro\cyrp\cyro\cyrl\cyro\cyrzh\cyrn\cyro\cyrishrt}%
1287 {\cyrs\cyrl\cyre\cyrd\cyru\cyryu\cyrshch\cyre\cyrishrt}\ \cyrs\cyrt
1288 \cyrr\cyra\cyrn\cyri\cyrc\cyre}%
1289 \def\reftextfacebefore{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyro
1290 \cyrt\cyri\cyrv\cyro\cyrp\cyro\cyrl\cyro\cyrzh\cyrn\cyro\cyrishrt}%
1291 {\cyrp\cyrr\cyre\cyrd\cyrery\cyrd\cyru\cyrshch\cyre\cyrishrt}\
1292 \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyre}%
1293 \def\reftextafter{\cyrn\cyra\ \cyrs\cyrl\cyre\cyrd\cyru\cyryu\cyrshch
1294 \cyre\cyrishrt\ \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyre}%
1295 \def\reftextbefore{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyre\cyrd
1296 \cyrsh\cyre\cyrs\cyrt\cyrv\cyru\cyryu\cyrshch\cyre\cyrishrt}%
1297 {\cyrp\cyrr\cyre\cyrd\cyrery\cyrd\cyru\cyrshch\cyre\cyrishrt}%
1298 \ \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyre}%
1299 \def\reftextcurrent{\cyrn\cyra\ \reftextvario{\cyrerev\cyrt\cyro
1300 \cyrishrt}{\cyrd\cyra\cyrn\cyrn\cyro\cyrishrt}\ \cyrs\cyrt\cyrr
1301 \cyra\cyrn\cyri\cyrc\cyre}%
1302 \def\reftextfaraway#1{\cyrn\cyra\ \cyrs.~\pageref{#1}}%
1303 \def\reftextpagerange#1#2{\cyrn\cyra\ \cyrs\cyrt\cyrr\cyra\cyrn
1304 \cyri\cyrc\cyra\cyrh~\pageref{#1}--\pageref{#2}}%
1305 \def\reftextlabelrange#1#2{\cyrs~\ref{#1}\ \cyrp\cyro~\ref{#2}}%
1308 % The text for slovak defaults was contributed by Miroslav Sedivy\\
1309 % (\verb=<miro@slovensko.com>=).
1310 % \changes{v1.4b}{2002/03/11}{Contributed defaults added}
1312 \DeclareOption{slovak}
1313 {\vref@addto\extrasslovak{%
1314 \def\reftextfaceafter {na \reftextvario{proti\v lahlej}%
1315 {nasleduj\'ucej} strane}%
1316 \def\reftextfacebefore{na \reftextvario{proti\v lahlej}%
1317 {predch\'adzaj\'ucej} strane}%
1318 \def\reftextafter {na \reftextvario{nasleduj\'ucej}%
1319 {\v dal\v sej} strane}%
1320 \def\reftextbefore {na \reftextvario{predch\'adzaj\'ucej}%
1321 {predo\v slej} strane}%
1322 \def\reftextcurrent {na tejto strane}%
1323 \def\reftextfaraway#1{na strane~\pageref{#1}}%
1324 \def\reftextpagerange#1#2{na stran\'ach~\pageref{#1}--\pageref{#2}}%
1325 \def\reftextlabelrange#1#2{\ref{#1} a\v z~\ref{#2}}%
1328 % The text for slovene defaults was contributed by Roman Maurer\\
1329 % (\verb=<roman.maurer@amis.net>=).
1330 % \changes{v1.4a}{2002/03/05}{Contributed defaults added}
1332 \DeclareOption{slovene}
1333 {\vref@addto\extrasslovene{%
1334 \def\reftextfaceafter {na naslednji strani}%
1335 \def\reftextfacebefore{na prej\v{s}nji strani}%
1336 \let\reftextafter \reftextfaceafter
1337 \let\reftextbefore \reftextfacebefore
1338 \def\reftextcurrent {na \reftextvario{tej}{trenutni} strani}%
1339 \def\reftextfaraway#1{na strani~\pageref{#1}}%
1340 \def\reftextpagerange#1#2{na straneh~\pageref{#1}--\pageref{#2}}%
1341 \def\reftextlabelrange#1#2{od~\ref{#1} do~\ref{#2}}%
1344 % Text for spanish defaults was contributed by Julio Sanchez
1345 % (\verb=jsanchez@gmv.es=) and Fernando Dobladez (\verb=<ferd@fuego.com>=).
1346 % \changes{v1.0f}{1994/03/16}{Inserted missing hash mark}
1347 % \changes{v1.0k}{1994/06/05}{Corrected misspelled cmd `extrasspanish}
1348 % \changes{v1.4a}{2002/03/05}{Missing defaults added}
1349 % \changes{v1.4o}{2005/11/26}{Single hyphen in range}
1351 \DeclareOption{spanish}
1352 {\vref@addto\extrasspanish{%
1353 \def\reftextfaceafter {en la p\'agina siguiente}%
1354 \def\reftextfacebefore{en la p\'agina anterior}%
1355 \let\reftextafter \reftextfaceafter
1356 \let\reftextbefore \reftextfacebefore
1357 \def\reftextcurrent {en esta p\'agina}%
1358 \def\reftextfaraway#1{en la p\'agina~\pageref{#1}}%
1359 \def\reftextpagerange#1#2{en las p\'aginas~\pageref{#1}%
1361 \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
1364 % The text for swedish was contributed by Mats Dahlgren
1365 % (\verb=matsd@sssk.se=).
1366 % \changes{v1.0p}{1995/01/10}{Added swedish strings}
1367 % \changes{v1.2a}{1998/08/22}{Added swedish defaults for
1368 % \cs{reftextpagerange} and \cs{reftextlabelrange}}
1370 \DeclareOption{swedish}
1371 {\vref@addto\extrasswedish{%
1372 \def\reftextfaceafter {p\aa\ \reftextvario{motst\aa ende}%
1374 \def\reftextfacebefore{p\aa\ \reftextvario{motst\aa ende}%
1375 {f\"{o}reg\aa ende} sida}%
1376 \def\reftextafter {p\aa\ \reftextvario{f\"{o}ljande}%
1378 \def\reftextbefore {p\aa\ f\"{o}reg\aa ende sida}%
1379 \def\reftextcurrent {p\aa\ denna sida}%
1380 \def\reftextfaraway#1{p\aa\ sidan~\pageref{#1}}%
1381 \def\reftextpagerange#1#2{p\aa\
1382 sidorna~\pageref{#1}--\pageref{#2}}%
1383 \def\reftextlabelrange#1#2{\ref{#1} till~\ref{#2}}%
1385 \DeclareOption{turkish}
1386 {\vref@excuse{turkish}%
1387 \vref@addto\extrasturkish{%
1388 \def\reftextfaceafter {on the \reftextvario{facing}{next} page}%
1389 \def\reftextfacebefore{on the \reftextvario{facing}{preceding}
1391 \def\reftextafter {on the \reftextvario{following}{next} page}%
1392 \def\reftextbefore {on the \reftextvario{preceding}{previous} page}%
1393 \def\reftextcurrent {on \reftextvario{this}{the current} page}%
1394 \def\reftextfaraway#1{on page~\pageref{#1}}%
1395 \def\reftextpagerange#1#2{on pages~\pageref{#1}--\pageref{#2}}%
1396 \def\reftextlabelrange#1#2{\ref{#1} to~\ref{#2}}%
1399 % The text for Ukrainian defaults was contributed by Mykola Lyakhovych\\
1400 % (\verb=<lyakhovych@mail.ru>=).
1401 % \changes{v1.4l}{2005/04/24}{Contributed defaults added}
1403 \DeclareOption{ukrainian}
1404 {\vref@addto\extrasukrainian{%
1405 \def\reftextfaceafter{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyro
1406 \cyrt\cyri\cyrl\cyre\cyrzh\cyrn\cyrii\cyrishrt}%
1407 {\cyrn\cyra\cyrs\cyrt\cyru\cyrp\cyrn\cyrii\cyrishrt}\ \cyrs\cyrt
1408 \cyro\cyrr\cyri\cyrn\cyrc\cyrii}%
1409 \def\reftextfacebefore{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyro
1410 \cyrt\cyri\cyrl\cyre\cyrzh\cyrn\cyrii\cyrishrt}%
1411 {\cyrp\cyro\cyrp\cyre\cyrr\cyre\cyrd\cyrn\cyrii\cyrishrt}\
1412 \cyrs\cyrt\cyro\cyrr\cyrii\cyrn\cyrc\cyrii}%
1413 \def\reftextafter{\cyrn\cyra\ \cyrn\cyra\cyrs\cyrt\cyru\cyrp\cyrn
1414 \cyrii\cyrishrt\ \cyrs\cyrt\cyro\cyrr\cyrii\cyrn\cyrc\cyrii}%
1415 \def\reftextbefore{\cyrn\cyra\ \cyrp\cyro\cyrp\cyre\cyrr\cyre\cyrd
1416 \cyrn\cyrii\cyrishrt\ \cyrs\cyrt\cyro\cyrr\cyrii\cyrn\cyrc\cyrii}%
1417 \def\reftextcurrent{\cyrn\cyra\ \reftextvario{\cyrc\cyrii\cyrishrt}%
1418 {\cyrd\cyra\cyrn\cyrii\cyrishrt}\ \cyrs\cyrt\cyro\cyrr\cyrii\cyrn
1420 \def\reftextfaraway#1{\cyrn\cyra\ \cyrs.~\pageref{#1}}%
1421 \def\reftextpagerange#1#2{\cyrn\cyra\ \cyrs\cyrt\cyro\cyrr\cyrii
1422 \cyrn\cyrk\cyra\cyrh~\pageref{#1}--\pageref{#2}}%
1423 \def\reftextlabelrange#1#2{\cyrz~\ref{#1}\ \cyrd\cyro~\ref{#2}}%
1426 % We support francais as an alternative to french since people
1427 % might be used to it, but we discurrage it.
1429 \DeclareOption{francais}{%
1430 \typeout{Please use `french' instead of `francais'}%
1431 \ExecuteOptions{french}}
1432 \DeclareOption{germanb}{%
1433 \typeout{Please use `german' instead of `germanb'}%
1434 \ExecuteOptions{german}}
1442 % During document preparation errors due to |\vref| are usually of
1443 % not much interest. For this reason the draft option turns them into
1444 % warnings by issuing a |\vrefwarning| command. The final option
1445 % (default) stops with an error message when varioref detects a possible
1447 % \changes{v1.1h}{1998/08/01}{Added draft and final options}
1449 \DeclareOption{draft}{\AtEndOfPackage\vrefwarning}
1450 \DeclareOption{final}{\AtEndOfPackage\vrefshowerrors} % the default
1453 % After all options are declared we execute the default option
1454 % \texttt{english} to set up the defaults and then call
1455 % |\ProcessOptions*| to handle any option passed to the package.
1456 % The star form is used since we want to execute the options in the
1457 % order they are given (in case this isn't used together with the
1458 % \texttt{babel} package).
1460 \ExecuteOptions{english,final}
1465 % \subsection{Defining the main macros}
1467 % \begin{macro}{\vr@cnt}
1468 % To generate new labels we use a counter and construct the
1469 % internal label names by prefixing the current counter value with
1470 % the string |vr@|. We need a \LaTeX{} counter to get |\include|s
1471 % handled correctly.
1472 % \changes{v0.1e}{1992/11/15}{use LaTeX counter}
1478 % \begin{macro}{\vpageref}
1479 % \changes{v1.3a}{2001/04/12}{Scan for star form}
1480 % \begin{macro}{\vp@geref}
1481 % The command |\vpageref| generates the appropriate string by first
1482 % parsing the optional arguments (if any) and then compares the
1483 % internal and the user label. This command should be robust since
1484 % the user might put it anywhere.
1486 % We now start by scanning for a star which means: do not add a
1487 % space in front of the generated text---ever.
1489 \DeclareRobustCommand\vpageref{\@ifstar
1490 {\let\vref@space\relax\vp@geref}%
1491 {\let\vref@space\space\vp@geref}}
1495 \def\vp@geref{\@ifnextchar[%
1497 % The default for the first optional argument is the string hidden
1498 % in the macro |\reftextcurrent|.
1500 \@vpageref{\@vpageref[\reftextcurrent]}%
1506 % \begin{macro}{\vref@space}
1507 % \changes{v1.4a}{2002/03/06}{Default added}
1508 % A default for |\vref@space|. This isn't really needed except in
1509 % the case that somebody has hooked into the \texttt{varioref}
1510 % interfaces at a lower level (which isn't really supported,
1511 % but\ldots). So giving a default will prevent an error message in
1512 % that case (and should hopefully produce the same behavior as before).
1514 \let\vref@space\space
1518 % \begin{macro}{\@vpageref}
1519 % More parsing\ldots
1521 \def\@vpageref[#1]{\@ifnextchar[%
1523 % The default for the second optional argument is a space which is
1524 % prefixed by |\unskip| to get rid of any leading space inserted
1526 % \changes{v1.0h}{1994/06/11}{Pass first argument in both cases}
1527 % \changes{v1.0i}{1994/06/20}{Do it correctly}
1529 {\@@vpageref{#1}}{\@@vpageref{#1}[\unskip\vref@space]}}
1533 % \begin{macro}{\@@vpageref}
1534 % The |\@@vpageref| macro finally generates the references by
1535 % comparing the value of an internal label with the value of the
1537 % \changes{v1.0h}{1994/06/11}{Change internal interface}
1539 \def\@@vpageref#1[#2]#3{%
1541 % First it switches to horizontal mode if necessary and also
1542 % removes any leading space.
1546 % Then it advances the counter |\c@vrcnt| by one which is used to
1547 % generate internal label names.
1549 \global\advance\c@vrcnt\@ne
1551 % Then it checks if for the current value of |\c@vrcnt| a label
1552 % command was issued in the last run. If not it pretends that there
1553 % was one with the value |{??}{??}|. Thereafter it stores the
1554 % pageref value for this label in the macro |\@tempa|.
1556 \vref@pagenum\@tempa{\the\c@vrcnt @vr}%
1558 % Here we check that the generated text is not going across a page
1560 % \changes{v0.1f}{1993/01/01}{Add another label to catch cross-overs}
1562 \vref@pagenum\@tempb{\the\c@vrcnt @xvr}%
1564 % \changes{v1.0l}{1994/07/07}{Explicitly expand `label argument for
1566 % In version 1.0l the label string has been turned around so that
1567 % the number comes first. This was done to allow easy explicit
1568 % expansion of the number before it is passed to the |\label|
1569 % command. In the babel system the argument of |label| was not
1570 % expanded with the result that wrong label strings have been
1571 % generated. This is a general problem that might need a completely
1572 % different solution in babel but for now the change below (and in
1573 % some other places in the code) should solve the problem for this
1574 % special combination of packages.
1576 % These days we actually use |\vref@label| instead of |\label| as
1577 % this avoids problems with Babel or \texttt{amsmath} redefining
1578 % the latter command.
1579 % \changes{v1.4e}{2003/01/08}{Use \cs{vref@label} instead of
1580 % \cs{label} (pr/3489)}
1582 \vref@label{\the\c@vrcnt @xvr}%
1584 % \changes{v1.1g}{1998/05/10}{Test if inside AMS display (pr2175)}
1585 % Inside displays of the \texttt{amsmath} package the |\label| command
1586 % is redefined which makes the test for loops incorrect if a |\vref|
1587 % is used in, say, |\intertext|. So we test this condition first and
1588 % only do the test if |\label| doesn't have a special meaning.
1589 % [This is no longer necessary as |\label| isn't used any more]
1591 % \ifx\label\label@in@display\else
1592 \ifx\@tempa\@tempb\else
1594 % If both points do not fall onto the same page with either issue
1595 % an error or a warning message.
1596 % \changes{v1.0g}{1994/05/27}{Looping pages shown in wrong order}
1598 \vref@err{\noexpand\vref or \noexpand\vpageref at page boundary
1599 \@tempb-\@tempa\space (may loop)%
1604 % Same game for the user requested label; this time the page
1605 % reference is saved in |\thevpagerefnum|.
1606 % \changes{v1.4c}{2002/06/14}{Use \cs{thevpagerefnum} instead of \cs{@tempb}}
1608 \vrefpagenum\thevpagerefnum{#3}%
1610 % Now after the internal label has served its purpose if would be
1611 % nice to free the memory it occupies by using something like
1613 % \global\expandafter\let
1614 % \csname r@\the\c@vrcnt @vr\endcsname\@empty
1616 % But this is not possible because it would result in getting
1617 % `Labels may have changed\ldots' warnings for every run. Now we
1618 % are ready to produce the textual strings. Since we have removed
1619 % any leading space we now insert a space (unless this was the star
1620 % form of the command) and then compare the two
1624 \ifx\@tempa\thevpagerefnum
1626 % If they are the same we insert the first argument into the input
1627 % stream. Otherwise we insert the second argument. Recall that
1628 % those are the two optional arguments of |...|. However, if the
1629 % user explicitly requested an empty text string using the optional
1630 % argument we cancel any preceding space.
1631 % \changes{v1.2f}{2000/07/07}{Don't output space if optional argument
1643 % Now we check if the page number of the referenced object (stored
1644 % in |\thevpagerefnum| is a single positive number.
1646 \is@pos@number\thevpagerefnum
1649 % If so, we check if the current position (stored in |\@tempa|) is
1650 % a positive number. If this is the case we assign this number to
1651 % the counter register |\@tempcnta| and add one to it.
1653 \is@pos@number\@tempa
1655 \advance\@tempcnta\@ne
1658 % If it is not a positive number we assign the largest possible
1659 % number to |\@tempcnta| and thereby pretending that label and
1660 % reference are miles away from each other.
1662 {\@tempcnta\maxdimen}%
1664 % Now we are ready to check if reference and object are on nearby
1665 % pages. |\thevpagerefnum| will expand to the page number of the object
1666 % (and we know that this is a number) and |\@tempcnta| is either
1667 % one higher than the reference page or completely out of bounds.
1668 % So if both represent the same value then the object lies one page
1669 % after its reference.
1671 \ifnum \thevpagerefnum =\@tempcnta
1673 % Thus if the object falls onto an odd page then the reference is
1674 % on the facing even page (and so we insert |\reftextfaceafter|),
1675 % otherwise the object can not be seen from the reference (and we
1676 % in insert |\reftextafter|). Don't be surprised if we are not
1677 % using |\thevpagerefnum| in the check. Since |\@tempcnta| has the same
1678 % value it is faster to use the register instead of parsing the
1679 % macro contents anew.
1683 % In fact we are going to use |\reftextfaceafter| only if we are
1684 % doing two-sided printing, otherwise |\reftextafter| is always
1686 % Since the value of |\if@twoside| is evaluated before reading in
1687 % packages we could do better (saving some tokens) by defining
1688 % the current macro in dependence of this boolean.
1699 % If the object is not on the page following the reference we check
1700 % if it is on the page before the reference. In \LaTeX{} this
1701 % situation is not too common, for example with floats it normally
1702 % does not occur, but of course it isn't impossible if you more
1703 % than one reference to the same object, or if you have back
1704 % references to sections, theorems, etc. To test this we now
1705 % subtract two from the current value of |\@tempcnta| (which was
1706 % set to one higher as the reference page number). Note, that
1707 % subtraction is also possible if the value was |\maxdimen| --- we
1708 % still get something that is much larger than any sensible page
1712 \advance\@tempcnta-2
1714 % If now |\thevpagerefnum| and |\@tempcnta| have the same value then the
1715 % object lies one page before the reference.
1717 \ifnum \thevpagerefnum =\@tempcnta
1719 % Again we have to check for odd or even pages to distinguish
1720 % between the facing and the non-facing situation.
1726 % Again the |\reftextfacebefore| only if |@twoside| evaluates to
1736 % If the above test also returns false then we have object and
1737 % references on pages which are far away or don't contain simple
1738 % page numbers. Therefore we generate the |\reftextfaraway| string.
1739 % Recall that this is a macro which has the user label as an
1743 \reftextfaraway{#3}%
1748 % We do the same if our first test (that the page with the object
1749 % has a positive page number) turns out to be false.
1751 {\reftextfaraway{#3}}%
1754 % Finally we generate the internal label so that it can be check on
1755 % the next run. This means that we compare the position after the
1756 % string with the position of the referenced object. There is one
1757 % thing to note: to conserve space we locally make |\@currentlabel|
1758 % empty since we are only interested in the page number value of
1759 % this internal label.
1760 % \changes{v1.0l}{1994/07/07}{Explicitly expand \cs{label} argument for babel}
1762 % These days we actually use |\vref@label| instead of |\label| as
1763 % this avoids problems with Babel or \texttt{amsmath} redefining
1764 % the latter command.
1765 % \changes{v1.4e}{2003/01/08}{Use \cs{vref@label} instead of
1766 % \cs{label} (pr/3489)}
1768 \vref@label{\the\c@vrcnt @vr}%
1774 % \begin{macro}{\vref@label}
1775 % \changes{v1.4e}{2003/01/08}{Macro added (pr/3489)}
1776 % This macro is like |\label| in the kernel but without passing on
1777 % |\@currentlabel|, ie useful if all we are interested in is the
1778 % page number. It also has the effect that it is unaffected by
1779 % \texttt{amsmath} or Babel redefining the |\label| command.
1781 \def\vref@label#1{\@bsphack
1782 \protected@write\@auxout{}%
1783 {\string\newlabel{#1}{{}{\thepage}}}%
1789 % \begin{macro}{\vpagerefnum}
1790 % \changes{v1.4c}{2002/06/14}{Macro added}
1791 % This macro allows to define |\reftextafter| and friends to refer
1792 % to the page number rather than producing a textual reference.
1794 \let\thevpagerefnum\@empty
1799 % \begin{macro}{\vrefwarning}
1800 % \changes{v0.1g}{1993/02/14}{Macro added}
1801 % \begin{macro}{\vrefshowerrors}
1802 % \changes{v1.1h}{1998/08/01}{Macro added}
1803 % \begin{macro}{\vref@err}
1804 % \changes{v0.1g}{1993/02/14}{Macro added}
1805 % When the |\vref| command detects a possible crossing over a page
1806 % boundary it will call |\vref@err| to generate an error message.
1807 % During document preparation one can turn such errors into
1808 % warnings by issuing a |\vrefwarning| declaration.
1809 % \changes{v1.0g}{1993/02/14}{Macro added}
1811 \def\vrefwarning{\def\vref@err{\PackageWarning{varioref}}}
1814 \def\vrefshowerrors{\def\vref@err##1{\PackageError{varioref}{##1}%
1815 {Please check the pages in question. You might need to replace
1816 the \string\vref\MessageBreak
1817 or \noexpand\vpageref by a normal \noexpand\(page)ref to
1818 stop LaTeX running forever.}}}
1825 % \begin{macro}{\vref}
1826 % \changes{v1.3a}{2001/04/12}{Scan for star form}
1827 % We start by scanning for a star form in which case we do not put
1828 % any space before the generated text (only remove some).
1829 % \begin{macro}{\vr@f}
1831 \DeclareRobustCommand\vref{\@ifstar
1832 {\let\vref@space\relax\vr@f}%
1833 {\let\vref@space\nobreakspace\vr@f}}
1835 % And now we do the real work\ldots
1836 % \changes{v1.3c}{2001/09/04}{Correct typo in name}
1840 % The use of|\nobreakspace| or |~| after the |\unskip| means that
1841 % this command will always produce a normal space while
1842 % something like |\nobreak\space| will
1843 % react to settings of |\nonfrenchspacing|.
1844 % Unfortunately the latter will also act in cases where one really
1845 % wants a normal space, e.g., in |Fig.~\vref{..}|, resulting in
1846 % a large extra space after the dot. For this reason the first solution
1848 % \changes{v1.1e}{1998/03/09}{Don't use \cs{nobreakspace} (pr/1866)}
1849 % \changes{v1.2a}{1998/11/27}{Use \cs{nobreakspace} (pr/2909)}
1850 % \changes{v1.2a}{1998/11/27}{Add \cs{leavevmode}}
1852 % Above comments all refer to the earlier versions where there was
1853 % no possibility to suppress the space at all. By now we have
1854 % |\vref*| and |\vpageref*| to suppress the in internally generated
1855 % space by redefining |\vref@space| appropriately.
1857 \leavevmode\unskip\vref@space
1860 % That means we have have to use |\vpageref| and not the internal
1861 % |\@vpageref| --- otherwise we would pick up the
1862 % ``current'' definition for |\vref@space| instead of setting it
1864 % \changes{v1.4c}{2002/06/18}{Use \cs{vpageref} not \cs{@vpageref} (pr/3403)}
1866 \vpageref[\unskip]{#1}}
1872 % \begin{macro}{\is@pos@number}
1873 % The utility macro |\is@pos@number| takes three arguments: a
1874 % string that is tested for being a valid non-negative integer and the
1875 % actions to be taken in case the test comes out true or false.
1877 % We start by passing the string to the macro |\is@pos@num| after
1878 % prefixing it with a \texttt{0} and adding a space after it. To have
1879 % a well-defined ending point we also add |\@nil| at the end.
1880 %\label{isposnumber}
1882 \def\is@pos@number#1{\is@pos@num0#1\space\@nil}
1884 % Now we parse the enlarged string into a counter register. To get
1885 % control back after everything that is regarded by \TeX{} as a
1886 % number is put into that register we assign |\is@pos@num@| to the
1887 % |\afterassignment| token. Since the string started with 0, we
1888 % can be sure that the register assignment will be carried out
1889 % without an error message. In case of counter assignments leading
1890 % zeros are discarded.
1892 \def\is@pos@num{\afterassignment\is@pos@num@ \count@}
1894 % Now we have to check whether or not the whole string was parsed
1895 % into that register or some remainder was left over. Since we have
1896 % added a |\@nil| token at the very end we can use that to delimit
1897 % the argument of |\is@pos@num@|. Note, that the added space in
1898 % |\is@pos@number| \vpageref[above]{isposnumber} gets parsed away
1899 % by the counter assignment. If it would be missing, and the full
1900 % string would consist of a number, \TeX{}would try to replace
1901 % |\@nil| by its definition to see if it would contain additional
1902 % digits and thus we would be in trouble at this point.
1904 \def\is@pos@num@#1\@nil{%
1906 % Now we have to check if the argument is empty. We can do this
1907 % with an |\ifx| (i.e., in an expandable way) since we know for
1908 % sure that it can not start with |\@nil|.
1909 % \changes{v1.4j}{2004/05/08}{Use \cs{@nil} for testing}
1913 % Depending on the result we execute the second or third argument
1914 % of the command |\is@pos@number| using a technique that removes
1915 % the |\else| or |\fi| from the input stream first, so that in
1916 % principle input stream parsing could be done from within the
1919 \expandafter\@firstoftwo \else
1920 \expandafter\@secondoftwo \fi}
1924 % \begin{macro}{\reftextvario}
1925 % This macro gives a little bit of random variation in the text
1926 % because the outcome depends on the number of |\vref| commands
1929 \def\reftextvario#1#2{\ifodd\c@vrcnt #1\else#2\fi}
1933 % \begin{macro}{\fullref}
1934 % And here is the primitive command that always produces a |\ref|
1937 \def\fullref#1{\ref{#1} \reftextfaraway{#1}}
1942 % \subsubsection{Supporting ranges}
1944 % \begin{macro}{\vref@pagenum}
1945 % \changes{v1.2a}{1998/08/01}{Macro added}
1946 % This command takes a label as |#1| extracts the page number
1947 % associated with it and saves the result in a csname which is
1948 % passed as |#1|. If the label isn't associated with a page number
1949 % it essentially associates it with |??| for both the label number
1950 % and the page, thus defining the label this way. This means that
1951 % no label warning is generated for this label in case it is
1954 \def\vref@pagenum#1#2{%
1955 \@ifundefined{r@#2}{\@namedef{r@#2}{{??}{??}}}{}%
1957 % Extracting and saving the page number turned out to be a source of subtle
1958 % bugs. Initially it was done through an |\edef| with a bunch of
1959 % |\expandafter| commands inside. This posed a problem if the page number
1960 % itself contained code which needed protection (e.g., pr/4080) so this got
1961 % changed to use |\protected@edef|. However, that in turn failed with Babel
1963 % if the label contained active characters, e.g., a ``:'' in French. So now
1964 % we use even more |\expandafter| commands to avoid any expansion other
1965 % than what is absolutely required---I'm sure there is now a simpler way
1966 % to code this, but \ldots\ in fact we didn't use enough initially resulting in another
1968 % \changes{v1.4w}{2009/09/13}{Use \cs{protected@edef} to avoid problems
1969 % in complicated setups, e.g., microtype (pr/4080)}
1970 % \changes{v1.4y}{2010/11/12}{Avoid even \cs{protected@edef} to pacify french
1972 % \changes{v1.4z}{2011/10/02}{Previous fix need one more expansion
1973 % (pr/4159,pr/4171)}
1975 \expandafter\expandafter\expandafter\vref@@pagenum
1976 \csname r@#2\endcsname{}{}\@nil#1%
1978 \def\vref@@pagenum#1#2#3\@nil#4{%
1984 % \begin{macro}{\vrefpagenum}
1985 % \changes{v1.2a}{1998/08/01}{Macro added}
1986 % Same as the above but this time we generate a warning for
1989 \def\vrefpagenum#1#2{%
1990 \@ifundefined{r@#2}%
1991 {\G@refundefinedtrue
1992 \@latex@warning{Reference `#2' on page \thepage \space
1994 \vref@pagenum{#1}{#2}}
1998 % \begin{macro}{\vpagerefrange}
1999 % \begin{macro}{\@vpagerefrange}
2000 % \begin{macro}{\@svpagerefrange}
2001 % \changes{v1.2a}{1998/08/01}{Macro added}
2002 % \changes{v1.3b}{2001/04/14}{Scan for star form}
2003 % \changes{v1.4s}{2007/08/07}
2004 % {Prevent loss of brackets}
2005 % If both labels refer to the same page then we produce a
2006 % |\vpageref|. Otherwise we produce the result of
2007 % |\reftextpagerange|.
2009 % One could think of making this command even more clever by
2010 % producing a special string if the difference between the two page
2011 % number is one (but this is not done).
2013 % We need two versions to implement a star form:
2015 \newcommand\@svpagerefrange[3][\reftextcurrent]{%
2016 \vrefpagenum\@tempa{#2}%
2017 \vrefpagenum\@tempb{#3}%
2019 \vpageref*[{#1}]{#2}%
2021 \reftextpagerange{#2}{#3}%
2025 % And the same but using |\vpageref|:
2027 \newcommand\@vpagerefrange[3][\reftextcurrent]{%
2028 \vrefpagenum\@tempa{#2}%
2029 \vrefpagenum\@tempb{#3}%
2031 \vpageref[{#1}]{#2}%
2033 \reftextpagerange{#2}{#3}%
2037 % And here we put things together.
2039 \newcommand\vpagerefrange{\@ifstar\@svpagerefrange\@vpagerefrange}
2046 % \begin{macro}{\vrefrange}
2047 % \changes{v1.2a}{1998/08/01}{Macro added}
2048 % \changes{v1.4s}{2006/08/07}
2049 % {Prevent loss of brackets}
2051 \newcommand\vrefrange[3][\reftextcurrent]
2052 {\reftextlabelrange{#2}{#3} \vpagerefrange[{#1}]{#2}{#3}}
2057 % \subsection{An extension of counter referencing}
2059 % \begin{macro}{\refstepcounter}
2060 % \changes{v1.4a}{2002/02/24}{Macro redefined}
2062 % At the moment a reference to a counter |foo| will generate the
2063 % equivalent of |\p@foo\thefoo| although not quite in this form. For
2064 % some applications it would be nice of one could have |\thefoo| being
2065 % an argument to |\p@foo| to be able to put material before and after
2066 % the number generated by |\thefoo|. This can be easily achieved with
2067 % a small change to one of the kernel commands as follows:
2069 \def\refstepcounter#1{\stepcounter{#1}%
2070 \protected@edef\@currentlabel
2071 {\csname p@#1\expandafter\endcsname\csname the#1\endcsname}%
2074 % The trick is to ensure that |\csname the#1\endcsname| is turned into
2075 % a single token before |\p@...| is expanded further. This way, if the
2076 % |\p@...| command is a macro with one argument it will receive
2077 % |\the...|. With the kernel code (i.e., without the |\expandafter|)
2078 % it will instead pick up |\csname| which would be disastrous.
2080 % Using |\expandafter| instead of braces delimiting the argument is
2081 % better because, assuming that the |\p@...| command is not defined as
2082 % a macro with one argument, the braces will stay and prohibit kerning
2083 % that might otherwise happen between the glyphs generated by
2084 % |\the...| and surrounding glyphs.
2087 % \begin{macro}{\labelformat}
2088 % \changes{v1.4a}{2002/02/24}{Macro added}
2089 % A shortcut to set the |\p@...| macro for a counter. It will pick
2090 % up the counter representation as an argument so that it can be
2091 % specially formatted.
2093 \def\labelformat#1{\expandafter\def\csname p@#1\endcsname##1}
2097 % \begin{macro}{\Ref}
2098 % \changes{v1.4a}{2002/02/24}{Macro added}
2099 % This macro expands the result of |\ref| and then uppercases the
2100 % first token. Only useful if the label was generated via
2101 % |\labelformat| and contains some lower case letter at its start. If
2102 % the label starts with a complicated construct (e.g., an accented
2103 % letter) one has to surround everything that needs uppercasing in
2104 % a brace group in the definition of |\labelformat|.\footnote{There
2105 % is one problem with this approach: the braces are kept in a
2106 % normal \texttt{\textbackslash ref} which might spoil kerning.
2107 % Perhaps one day this needs redoing.}
2109 \DeclareRobustCommand\Ref[1]{\protected@edef\@tempa{\ref{#1}}%
2110 \expandafter\MakeUppercase\@tempa}
2114 % \begin{macro}{\Vref}
2115 % \changes{v1.4a}{2002/02/24}{Macro added}
2116 % \begin{macro}{\Vr@f}
2117 % \changes{v1.4a}{2002/02/24}{Macro added}
2118 % \changes{v1.4x}{2010/08/04}{Correct spacing -- same mistake as in \cs{vref}
2120 % |\Vref| is the counterpart to |\vref| with |\ref| replaced by
2121 % |\Ref| in its definition.
2123 \DeclareRobustCommand\Vref{\@ifstar
2124 {\let\vref@space\relax\Vr@f}%
2125 {\let\vref@space\nobreakspace\Vr@f}}
2127 \leavevmode\unskip\vref@space
2129 \vpageref[\unskip]{#1}}