From 5255c37137345163348d22ab46af2304cf9f55a6 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Fri, 2 Oct 2020 21:49:18 +0000
Subject: latex2e (2oct20)

git-svn-id: svn://tug.org/texlive/trunk@56514 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/source/latex/tools/varioref.dtx | 276 +++++++++++++++++++++-
 1 file changed, 268 insertions(+), 8 deletions(-)

(limited to 'Master/texmf-dist/source/latex/tools/varioref.dtx')

diff --git a/Master/texmf-dist/source/latex/tools/varioref.dtx b/Master/texmf-dist/source/latex/tools/varioref.dtx
index 077103eb97a..2bba60465e0 100644
--- a/Master/texmf-dist/source/latex/tools/varioref.dtx
+++ b/Master/texmf-dist/source/latex/tools/varioref.dtx
@@ -40,7 +40,7 @@
 %<package>\DeclareCurrentRelease{}{2019-10-01}
 %<package>
 %<package>\ProvidesPackage{varioref}
-%<package>    [2020/01/23 v1.6c package for extended references (FMi)]
+%<package>    [2020/08/11 v1.6e package for extended references (FMi)]
 % \fi
 %
 %%
@@ -70,7 +70,7 @@
 %  \PackageWarning{inputenc}{Unicode character \expandafter
 %                          \UTFviii@splitcsname\string##1\relax
 %                          \MessageBreak
-%                          not set up for use with LaTeX}^^A
+%                          not set up for use with LaTeX -- ignored}^^A
 %  \raisebox{.8pt}{\fboxsep1pt\kern.1pt\fbox{$\cdot$}\kern.1pt}^^A
 %   }}
 % \makeatother
@@ -390,6 +390,8 @@
 %\end{verbatim}
 % textual references can be suppressed.
 %
+%
+%
 % \section{Multi-lingual usage}
 %
 % The package works well together with the babel system if it is
@@ -475,6 +477,19 @@
 % describes the range of figures, tables, or whatever the labels refer
 % to, the default for English is ``|\ref{#1} to~\ref{#2}|''.
 %
+% 
+% \NewIn{2020}
+% \DescribeMacro\vrefformat
+% \DescribeMacro\Vrefformat
+% \DescribeMacro\vrefrangeformat
+% \DescribeMacro\fullrefformat
+% In some languages (currently only for Japanese) the generated text
+% has to typeset in different word order to most other (Western) languages.
+% To accomodate for this \cs{vrefformat}, etc.\ has been
+% added to allow to alter this on a per language basis.
+% There should be normally no need to alter the setup. For details see
+% the code section.
+%
 % \subsection{\ldots\ if Babel is used}
 %
 % \begin{itshape} If babel is being used then the above commands need to be
@@ -556,6 +571,7 @@
 % |\fullref| is also provided. This command can be used whenever you
 % know for sure that label and reference can't fall onto nearby pages.
 %
+%
 % \StopEventually{\PrintIndex\PrintChanges}
 %
 %
@@ -708,6 +724,10 @@
     \def\reftextfaraway#1{op bladsy~\pageref{#1}}%
     \def\reftextpagerange#1#2{op bladsye~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} tot~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %
@@ -723,6 +743,10 @@
     \def\reftextfaraway#1{on page~\pageref{#1}}%
     \def\reftextpagerange#1#2{on pages~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} to~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    Arabic option text was contributed by Ihab Samir Mattar
@@ -743,6 +767,10 @@
     \def\reftextfaraway#1{بالصفحة رقم~\pageref{#1}}%
     \def\reftextpagerange#1#2{بالصفحات~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} حتى~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 % \end{allowtofu}
@@ -759,6 +787,7 @@
     \def\reftextfaraway#1{auf Seite~\pageref{#1}}%
     \def\reftextpagerange#1#2{auf Seiten~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}%
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 % \changes{v1.2d}{2000/01/11}{Added naustrian defaults (identical to german)}
@@ -774,6 +803,10 @@
     \def\reftextfaraway#1{auf Seite~\pageref{#1}}%
     \def\reftextpagerange#1#2{auf Seiten~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    Text for basque defaults was contributed by
@@ -791,6 +824,10 @@
     \def\reftextfaraway#1{~\pageref{#1}. orrialdean}%
     \def\reftextpagerange#1#2{~\pageref{#1}--\pageref{#2} orrialdeetan}%
     \def\reftextlabelrange#1#2{\ref{#1}.etik \ref{#2}.eraino}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    Text for the Bahasa Malaysia defaults was contributed by
@@ -815,6 +852,10 @@
     \def\reftextfaraway#1{pada muka surat~\pageref{#1}}%
     \def\reftextpagerange#1#2{pada muka surat~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1}--\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    Text for brazil defaults was contributed by
@@ -837,6 +878,10 @@
     \def\reftextfaraway#1{na p\'agina~\pageref{#1}}%
     \def\reftextpagerange#1#2{nas p\'aginas~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    Text for Breton defaults was contributed by
@@ -858,6 +903,10 @@
                               on pages~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\vref@stringwarning\reflabelpagerange
                                \ref{#1} to~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    Text for Bulgarian defaults was contributed by
@@ -892,6 +941,10 @@
                         \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyri
                         ~\pageref{#1}--\pageref{#2}}%
    \def\reftextlabelrange#1#2{\ref{#1} \cyrd\cyro~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
  }}
 %    \end{macrocode}
 %    Text for catalan defaults was contributed by Robert Fuster\\
@@ -910,6 +963,10 @@
     \def\reftextpagerange#1#2{a les
                      p\`agines~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    Text for croatian defaults was contributed by \v{S}ime Ungar
@@ -926,6 +983,10 @@
      \def\reftextfaraway#1{na stranici~\pageref{#1}}%
      \def\reftextpagerange#1#2{na stranicama~\pageref{#1}--\pageref{#2}}%
      \def\reftextlabelrange#1#2{\ref{#1} do~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
    }}
 %    \end{macrocode}
 %    Defaults for the Czech option provided by Milan Vancura
@@ -943,6 +1004,10 @@
     \def\reftextfaraway#1{na stran\v{e}~\pageref{#1}}%
     \def\reftextpagerange#1#2{na stran\'ach~\pageref{#1}\--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} a\v{z}~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    Defaults for Danish provided by Torsten Martinsen
@@ -965,6 +1030,10 @@
     \def\reftextfaraway#1{p\aa{} side~\pageref{#1}}%
     \def\reftextpagerange#1#2{p\aa{} side~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    Default string for dutch have been contributed by Frank Poppe
@@ -1004,6 +1073,10 @@
 %    \begin{macrocode}
     \def\reftextpagerange#1#2{op pagina's~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1}--\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 % \changes{v1.2a}{1998/08/22}{Added english defaults for
@@ -1021,6 +1094,10 @@
     \def\reftextfaraway#1{on page~\pageref{#1}}%
     \def\reftextpagerange#1#2{on pages~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} to~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %
@@ -1041,6 +1118,10 @@
     \def\reftextfaraway#1{en pa\^go~\pageref{#1}}%
     \def\reftextpagerange#1#2{en pa\^goj~\pageref{#1} \^gis \pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} \^gis~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    The finnish strings were suggested by Matti Rintala
@@ -1064,6 +1145,10 @@
 %    Can't combine numbers with the necessary suffix well.
 %    \begin{macrocode}
      \def\reftextlabelrange#1#2{\ref{#1}--\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    French defaults are provided by Daniel Flippo
@@ -1083,6 +1168,10 @@
     \def\reftextfaraway#1{page~\pageref{#1}}%
     \def\reftextpagerange#1#2{pages~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} \`a~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    Galician defaults are provided by Matthias Moebius\\
@@ -1104,6 +1193,10 @@
      \def\reftextpagerange#1#2{%
                 nas p\'axinas~\pageref{#1}-\pageref{#2}}%
      \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    There are no good variants for German (I think and still think but
@@ -1138,6 +1231,10 @@
     \def\reftextfaraway#1{auf Seite~\pageref{#1}}%
     \def\reftextpagerange#1#2{auf den Seiten~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 % \changes{v1.2d}{2000/01/11}{Added ngerman defaults (identical to german)}
@@ -1155,6 +1252,10 @@
     \def\reftextfaraway#1{auf Seite~\pageref{#1}}%
     \def\reftextpagerange#1#2{auf den Seiten~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    Defaults for greek suggested by Apostolos Syropoulos\\
@@ -1174,6 +1275,10 @@
     \def\reftextpagerange#1#2{stis sel'ides\nobreakspace
                           \pageref{#1}---\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} ws\nobreakspace\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    Icelandic defaults suggested by Thorhallur Sverrisson
@@ -1194,6 +1299,10 @@
     \def\reftextfaraway#1{\'{a} s\'{i}{\dh}u~\pageref{#1}}%
     \def\reftextpagerange#1#2{\'{a} s\'{i}{\dh}um~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    Defaults for Italian suggested by Giovanni Pensa
@@ -1218,8 +1327,44 @@
     \def\reftextfaraway#1{a pagina~\pageref{#1}}%
     \def\reftextpagerange#1#2{nelle pagine~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{da~\ref{#1} a~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
+%    Defaults for Japanese. It needs a special \cs{vrefformat},
+%    \cs{Vrefformat}, \cs{fullrefformat} and \cs{vrefrangeformat}
+%    for gramatical reasons. As our standard documentation
+%    workflow uses pdf\TeX{} the Japanese letters can't be displayed
+%    easily, so you will see missing glyphs below. To see the real
+%    letters you have to look at the source or package file.
+% \changes{v1.6d}{2020/07/20}{Option japanese added (gh/352)}
+% \changes{v1.6e}{2020/07/25}{Option japanese changed (gh/352)}
+% \begin{allowtofu}
+%    \begin{macrocode}
+\DeclareOption{japanese}
+  {\vref@addto\extrasjapanese{%
+    \def\reftextfaceafter {\reftextvario{見開き}{次}ページ}%
+    \def\reftextfacebefore{\reftextvario{見開き}{前}ページ}%
+    \def\reftextafter     {\reftextvario{直後の}{次}ページ}%
+    \def\reftextbefore    {\reftextvario{直前の}{前}ページ}%
+    \def\reftextcurrent   {\reftextvario{この}{現}ページ}%
+    \def\reftextfaraway#1{\pageref{#1}ページ}%
+    \def\reftextpagerange#1#2{\pageref{#1}から\pageref{#2}ページ}%
+    \def\reftextlabelrange#1#2{\ref{#1}から\ref{#2}}%
+%    \end{macrocode}
+%    Note that the parentheses beow are not normal ones but full width
+%    ones U+FF08 and U+FF09!
+%    \begin{macrocode}
+    \def\vrefformat#1#2{\ref{#2}（\vpageref[#1]{#2}）}%
+    \def\Vrefformat#1#2{\Ref{#2}（\vpageref[#1]{#2}）}%
+    \def\fullrefformat#1{\ref{#1}（\reftextfaraway{#1}）}%
+    \def\vrefrangeformat#1#2#3{\reftextlabelrange{#2}{#3}%
+                               （\vpagerefrange[{#1}]{#2}{#3}）}%
+  }}
+%    \end{macrocode}
+% \end{allowtofu}
 %   Defaults for Hungarian by Jeff Goldberg
 %   (\verb=jeffrey@goldmark.org=).
 %   There is a problem with the use of the definite article
@@ -1264,6 +1409,10 @@
                               on pages~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\vref@stringwarning\reflabelpagerange
                                \ref{#1} to~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
    }%
 %    \end{macrocode}
 %    The |\AtBeginDocument| needs to be executed when the option is
@@ -1304,6 +1453,10 @@
     \def\reftextfaraway#1{p\aa{} side~\pageref{#1}}%
     \def\reftextpagerange#1#2{p\aa{} side~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 \DeclareOption{nynorsk}
   {\vref@addto\extrasnynorsk{%
@@ -1315,6 +1468,10 @@
     \def\reftextfaraway#1{p\aa{} side~\pageref{#1}}%
     \def\reftextpagerange#1#2{p\aa{} side~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    The polish translations have been provided by
@@ -1342,6 +1499,10 @@
     \def\reftextfaraway#1{na stronie~\pageref{#1}}%
     \def\reftextpagerange#1#2{na stronach~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{od~\ref{#1} do~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    The portuguese default text has been provided by
@@ -1362,6 +1523,10 @@
     \def\reftextfaraway#1{na p\'agina~\pageref{#1}}%
      \def\reftextpagerange#1#2{nas p\'aginas~\pageref{#1}--\pageref{#2}}%
      \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 % Updates to the default text for Romanian have been suggested by Florin Oprina
@@ -1381,6 +1546,10 @@
     \def\reftextfaraway#1{pe pagina~\pageref{#1}}%
     \def\reftextpagerange#1#2{pe paginile~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} la~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    The text for russian was taken from the book in Russian by
@@ -1414,6 +1583,10 @@
     \def\reftextpagerange#1#2{\cyrn\cyra\ \cyrs\cyrt\cyrr\cyra\cyrn
       \cyri\cyrc\cyra\cyrh~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\cyrs~\ref{#1}\ \cyrp\cyro~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    The text for slovak defaults was contributed by Miroslav Sedivy\\
@@ -1434,6 +1607,10 @@
     \def\reftextfaraway#1{na strane~\pageref{#1}}%
     \def\reftextpagerange#1#2{na stran\'ach~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} a\v z~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    The text for slovene defaults was contributed by Roman Maurer\\
@@ -1450,6 +1627,10 @@
     \def\reftextfaraway#1{na strani~\pageref{#1}}%
     \def\reftextpagerange#1#2{na straneh~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{od~\ref{#1} do~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    Text for spanish defaults was contributed by Julio Sanchez
@@ -1470,6 +1651,10 @@
     \def\reftextpagerange#1#2{en las p\'aginas~\pageref{#1}%
                                              -\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    The text for swedish was contributed by Mats Dahlgren
@@ -1492,6 +1677,10 @@
      \def\reftextpagerange#1#2{p\aa\
                                sidorna~\pageref{#1}--\pageref{#2}}%
      \def\reftextlabelrange#1#2{\ref{#1} till~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 \DeclareOption{turkish}
   {\vref@excuse{turkish}%
@@ -1505,6 +1694,7 @@
     \def\reftextfaraway#1{on page~\pageref{#1}}%
     \def\reftextpagerange#1#2{on pages~\pageref{#1}--\pageref{#2}}%
     \def\reftextlabelrange#1#2{\ref{#1} to~\ref{#2}}%
+    \let\vrefrangeformat\vrefrangedefaultformat
   }}
 %    \end{macrocode}
 %    The text for Ukrainian defaults was contributed by Mykola Lyakhovych\\
@@ -1532,6 +1722,10 @@
      \def\reftextpagerange#1#2{\cyrn\cyra\ \cyrs\cyrt\cyro\cyrr\cyrii
        \cyrn\cyrk\cyra\cyrh~\pageref{#1}--\pageref{#2}}%
      \def\reftextlabelrange#1#2{\cyrz~\ref{#1}\ \cyrd\cyro~\ref{#2}}%
+    \let\vrefformat\vrefdefaultformat
+    \let\Vrefformat\Vrefdefaultformat
+    \let\fullrefformat\fullrefdefaultformat
+    \let\vrefrangeformat\vrefrangedefaultformat
    }}
 %    \end{macrocode}
 %    We support francais as an alternative to french since people
@@ -1585,7 +1779,6 @@
 %    \pkg{babel} package).
 %    \begin{macrocode}
 \ExecuteOptions{english,final,space}
-\ProcessOptions*
 %    \end{macrocode}
 %
 %
@@ -2062,11 +2255,26 @@
 %    |\vpageref|, it that is needed one has to call both commands
 %    explicitly
 % \changes{v1.6a}{2019/08/25}{Command added to support hyperref better}
+% \changes{v1.6e}{2020/07/25}{Changed for Japanese (gh/352)}
+%    \begin{macrocode}
+\newcommand\vref@star[1][]{\vrefformat{#1}}
+%    \end{macrocode}
+%  \end{macro}
+%
+%
+%  \begin{macro}{\vrefformat,\vrefdefaultformat}
+%    Japanese needs a different word order in \cs{vref@star} so this
+%    is separated out o that it can be changed on language level.
+% \changes{v1.6e}{2020/07/25}{Macro added (gh/352)}
 %    \begin{macrocode}
-\newcommand\vref@star[2][]{%
+\def\vrefdefaultformat#1#2{% 
   \ref{#2}
   \vpageref[#1]{#2}}
 %    \end{macrocode}
+%    Most languages need the above definition.
+%    \begin{macrocode}
+\let\vrefformat\vrefdefaultformat
+%    \end{macrocode}
 %  \end{macro}
 
 % \begin{macro}{\vr@f}
@@ -2172,8 +2380,24 @@
 %  \begin{macro}{\fullref}
 %    And here is the primitive command that always produces a |\ref|
 %    and a |\pageref|.
+% \changes{v1.6e}{2020/07/25}{Changed for Japanese (gh/352)}
+%    \begin{macrocode}
+\newcommand\fullref{\fullrefformat}
+%    \end{macrocode}
+%  \end{macro}
+%
+%
+%  \begin{macro}{\fullrefformat,\fullrefdefaultformat}
+%    Japanese needs a different word order in \cs{fullref}  so this
+%    is separated out o that it can be changed on language level.
+% \changes{v1.6e}{2020/07/25}{Macro added (gh/352)}
 %    \begin{macrocode}
-\def\fullref#1{\ref{#1} \reftextfaraway{#1}}
+\def\fullrefdefaultformat#1{% 
+  \ref{#1} \reftextfaraway{#1}}
+%    \end{macrocode}
+%    Most languages need the above definition.
+%    \begin{macrocode}
+\let\fullrefformat\fullrefdefaultformat
 %    \end{macrocode}
 %  \end{macro}
 %
@@ -2286,13 +2510,28 @@
 % \changes{v1.2a}{1998/08/01}{Macro added}
 % \changes{v1.4s}{2006/08/07}
 %         {Prevent loss of brackets}
+% \changes{v1.6d}{2020/07/20}{Changed for Japanese (gh/352)}
+%    Argument two and three are implicitly picked up.
 %    \begin{macrocode}
-\newcommand\vrefrange[3][\reftextcurrent]
-  {\reftextlabelrange{#2}{#3} \vpagerefrange[{#1}]{#2}{#3}}
+\newcommand\vrefrange[1][\reftextcurrent]{\vrefrangeformat{#1}}
 %    \end{macrocode}
+%    
 %  \end{macro}
 %
 %
+%  \begin{macro}{\vrefrangeformat,\vrefrangedefaultformat}
+%    Japanese needs a different word order in \cs{vrefrange}  so this
+%    is separated out o that it can be changed on language level.
+% \changes{v1.6d}{2020/07/20}{Macro added (gh/352)}
+%    \begin{macrocode}
+\def\vrefrangedefaultformat#1#2#3{% 
+  \reftextlabelrange{#2}{#3} \vpagerefrange[{#1}]{#2}{#3}}
+%    \end{macrocode}
+%    Most languages need the above definition.
+%    \begin{macrocode}
+\let\vrefrangeformat\vrefrangedefaultformat
+%    \end{macrocode}
+%  \end{macro}
 %
 %  \begin{macro}{\Vref}
 %  \changes{v1.4a}{2002/02/24}{Macro added}
@@ -2308,11 +2547,26 @@
 %
 %  \begin{macro}{\Vref@star}
 % \changes{v1.6a}{2019/08/25}{Command added to support hyperref better}
+% \changes{v1.6e}{2020/07/25}{Changed for Japanese (gh/352)}
 %    \begin{macrocode}
-\newcommand\Vref@star[2][]{%
+\newcommand\Vref@star[1][]{\Vrefformat{#1}}
+%    \end{macrocode}
+%  \end{macro}
+%
+%
+%  \begin{macro}{\Vrefformat,\Vrefdefaultformat}
+%    Japanese needs a different word order in \cs{Vref}  so this
+%    is separated out o that it can be changed on language level.
+% \changes{v1.6e}{2020/07/25}{Macro added (gh/352)}
+%    \begin{macrocode}
+\def\Vrefdefaultformat#1#2{% 
   \Ref{#2}
   \vpageref[#1]{#2}}
 %    \end{macrocode}
+%    Most languages need the above definition.
+%    \begin{macrocode}
+\let\Vrefformat\Vrefdefaultformat
+%    \end{macrocode}
 %  \end{macro}
 %
 %  \begin{macro}{\Vr@f}
@@ -2443,6 +2697,12 @@
 %  \end{macro}
 %  \end{macro}
 %
+% \changes{v1.6e}{2020/07/25}{Move to handle
+% the language-specific reference formats. (gh/352)}
+%    \begin{macrocode}
+\ProcessOptions*
+%    \end{macrocode}
+%
 %    \begin{macrocode}
 %</package>
 %    \end{macrocode}
-- 
cgit v1.2.3

