diff options
author | Karl Berry <karl@freefriends.org> | 2009-12-17 23:52:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-12-17 23:52:39 +0000 |
commit | eebb145928deadb0949e17b6a16471491808e684 (patch) | |
tree | ecd5113e21608075d3c784cab05b87fa59dbe68a /Master/texmf-dist/source/latex/cleveref | |
parent | e359d674f651a5bec03fb71d8ce17c22fca3b6dc (diff) |
cleveref 0.15.3 (17dec09)
git-svn-id: svn://tug.org/texlive/trunk@16439 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/cleveref')
-rw-r--r-- | Master/texmf-dist/source/latex/cleveref/cleveref.dtx | 440 |
1 files changed, 338 insertions, 102 deletions
diff --git a/Master/texmf-dist/source/latex/cleveref/cleveref.dtx b/Master/texmf-dist/source/latex/cleveref/cleveref.dtx index 4909c95ac0d..2b3bcd8e45f 100644 --- a/Master/texmf-dist/source/latex/cleveref/cleveref.dtx +++ b/Master/texmf-dist/source/latex/cleveref/cleveref.dtx @@ -21,11 +21,11 @@ % \iffalse %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{cleveref} -%<package> [2009/11/26 v0.15 Intelligent cross-referencing] +%<package> [2009/12/11 v0.15.3 Intelligent cross-referencing] % %<*driver> -%\documentclass{ltxdoc} -\documentclass[draft]{ltxdoc} +\documentclass{ltxdoc} +%\documentclass[draft]{ltxdoc} \usepackage{url} \usepackage{pifont} % FIXME: find nicer line-continuation symbol than \ding{229} % \usepackage{hyperref} % breaks index @@ -62,7 +62,7 @@ %</driver> % \fi % -% \CheckSum{7845} +% \CheckSum{8133} %% \CharacterTable %% {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 %% 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 @@ -139,12 +139,28 @@ % \textbackslash{}begingroup in \textbackslash{}@cref to avoid subtle % bug that caused page count to be reset if the output routine was % triggered within \textbackslash{}@cref.} +% \changes{v0.15.1}{2009/12/02}{Fixed regression introduced in v0.13 in +% non-\package{hyperref} \option{poorman} code. Fixed bug in +% \package{varioref} support that caused \textbackslash{}vref to print +% \textbackslash{}reftextcurrent string for references on the current +% page, breaking \package{varioref} backwards-compatibility. Added +% \package{babel} support for Dutch.} +% \changes{v0.15.2}{2009/12/07}{Fixed bug in \textbackslash{}appendix +% that produced badly formed prefix data for labels that aren't reset +% by other counters (e.g. tables and figures in most document +% classes). Fixed bug in \package{hyperref} \option{poorman} code that +% caused all label names to be lower-cased in the sed script. Fixed +% spacing bugs in the \package{cleveref} versions of the +% \package{varioref} commands.} +% \changes{v0.15.3}{2009/12/11}{Fixed bug in \package{varioref} support. +% Changed \option{poorman} \textbackslash{}usepackage sed substitution +% rule to use POSIX regexp syntax.} % % % \GetFileInfo{cleveref.sty} % -% \def\fileversion{0.15} -% \def\filedate{26/11/2009} +% \def\fileversion{0.15.3} +% \def\filedate{11/12/2009} % % \title{The \package{cleveref} package\thanks{This document % corresponds to \textsf{cleveref}~\fileversion, dated @@ -1270,15 +1286,16 @@ % A number of people have helped improve \package{cleveref} by % contributing code and translations. Thanks to Michael Ummels for % contributing the \package{amsthm} support code, and to Stefan Pinnow, -% Gonzalo Medina and Massimo Redaelli for contributing translations. Many -% people have suggested improvements or reported bugs, indeed many have -% spent significant effort in helping to investigate and fix them. So -% thanks (in alphabetical order) to: Anand Deopurkar, Bas Ploeger, Dan -% Luecking, David Gleich, Donald Arsenau, Hendrik Maryns, Jens Mueller, -% Joel C. Salomon, Joris Pinkse, Leo Shidai Liu, Lev Bishop, Matej Batic, -% Matthew Skala, Michael Gorven, Olivier Roy, Paul Gomme, Ricardo de -% Aldama S\'anchez, Stefan Pinnow, Ted Pavlic, and Uwe L\"uck for their -% help. (If I missed someone, please let me know!) +% Gonzalo Medina, Massimo Redaelli and Philip H\"olzenspies for +% contributing translations. Many people have suggested improvements or +% reported bugs, indeed many have spent significant effort in helping to +% investigate and fix them. So thanks (in alphabetical order) to: Anand +% Deopurkar, Bas Ploeger, Dan Luecking, David Gleich, Donald Arsenau, +% Hendrik Maryns, James Sharam, Jens Mueller, Joel C. Salomon, Joris +% Pinkse, Leo Shidai Liu, Lev Bishop, Matej Batic, Matthew Skala, Michael +% Barber, Michael Gorven, Michal Kaut, Olivier Roy, Paul Gomme, Ricardo +% de Aldama S\'anchez, Stefan Pinnow, Ted Pavlic, Thomas Arildsen, and +% Uwe L\"uck for their help. (If I missed someone, please let me know!) % % % \StopEventually{\clearpage\PrintChanges\clearpage\PrintIndex} @@ -1493,7 +1510,11 @@ % references to anything in appendices to be sorted after everything % else. % \begin{macrocode} - \edef\@result{2147483647,\@result}% + \ifx\@result\@empty% + \def\@result{2147483647}% + \else% + \edef\@result{2147483647,\@result}% + \fi% % \end{macrocode} % Override the cross-reference type of sectioning commands. % \begin{macrocode} @@ -1529,7 +1550,11 @@ % Again, the large value added to the front of the counter data forces % references to appendix items to be sorted last. % \begin{macrocode} - \edef\@result{2147483647,\@result}% + \ifx\@result\@empty% + \def\@result{2147483647}% + \else% + \edef\@result{2147483647,\@result}% + \fi% % \end{macrocode} % Override the cross-reference type of sectioning commands. % \begin{macrocode} @@ -1755,8 +1780,7 @@ \else% \cref@stack@pop{\@tmpstack}% \cref@isstackfull{\@tmpstack}% - \fi - }% + \fi}% \expandafter\endgroup% \if@notthere\cref@stack@push{#1}{#2}\fi} % \end{macrocode} @@ -2493,6 +2517,22 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\if@crefstarred} +% The |\if@crefstarred| flag is set within starred variants of +% \package{cleveref} commands. Starred variants are only defined if +% either the \package{hyperref} or \package{varioref} package is +% loaded, so we only define it in those cases.\footnote{In fact, the +% flag isn't needed when only \package{varioref} is loaded and the +% \option{legacyvarioref} is set, \emph{unless} the \option{poorman} +% option is also set. However, avoid the redundant \textbackslash{}if +% in these cases doesn't seem worth the significantly more +% complicated code that would be required.} +% \begin{macrocode} +\@ifpackageloaded{hyperref}{\newif\if@crefstarred}{% + \@ifpackageloaded{varioref}{\newif\if@crefstarred}{}} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@cref} % To save duplicating code, the referencing macros pass an argument % determining the variant to an auxilliary macro \cmd{\@cref}, which @@ -3755,7 +3795,11 @@ % references to anything in appendices to be sorted after % everything else. % \begin{macrocode} - \edef\@result{2147483647,\@result}% + \ifx\@result\@empty% + \def\@result{2147483647}% + \else% + \edef\@result{2147483647,\@result}% + \fi% % \end{macrocode} % Override the cross-reference type of sectioning commands. % \begin{macrocode} @@ -3794,7 +3838,11 @@ % Again, the large value added to the front of the counter data % forces references to appendix items to be sorted last. % \begin{macrocode} - \edef\@result{2147483647,\@result}% + \ifx\@result\@empty% + \def\@result{2147483647}% + \else% + \edef\@result{2147483647,\@result}% + \fi% % \end{macrocode} % Override the cross-reference type of sectioning commands. % \begin{macrocode} @@ -3850,7 +3898,6 @@ % flag, which is tested in \cmd{\@@setcref} and \cmd{\@@setrangeref} % (below). % \begin{macrocode} - \newif\if@crefstarred \DeclareRobustCommand{\cref}{% \@ifstar{\@crefstar{cref}}{\@crefnostar{cref}}} \DeclareRobustCommand{\Cref}{% @@ -4004,24 +4051,24 @@ \let\@thmnoarg\@thm \def\@thm{\@ifnextchar[{\@thmoptarg}{\@thmnoarg}}%] \def\@thmoptarg[#1]#2#3#4{% - \ifhmode\unskip\unskip\par\fi - \normalfont - \trivlist - \let\thmheadnl\relax - \let\thm@swap\@gobble + \ifhmode\unskip\unskip\par\fi% + \normalfont% + \trivlist% + \let\thmheadnl\relax% + \let\thm@swap\@gobble% \thm@notefont{\fontseries\mddefault\upshape}% \thm@headpunct{.}% add period after heading - \thm@headsep 5\p@ plus\p@ minus\p@\relax - \thm@space@setup + \thm@headsep 5\p@ plus\p@ minus\p@\relax% + \thm@space@setup% #2% style overrides - \@topsep \thm@preskip % used by thm head - \@topsepadd \thm@postskip % used by \@endparenv - \def\@tempa{#3}\ifx\@empty\@tempa + \@topsep \thm@preskip% used by thm head + \@topsepadd \thm@postskip% used by \@endparenv + \def\@tempa{#3}\ifx\@empty\@tempa% \def\@tempa{\@oparg{\@begintheorem{#4}{}}[]}% - \else + \else% \refstepcounter[#1]{#3}% \def\@tempa{\@oparg{\@begintheorem{#4}{\csname the#3\endcsname}}[]}% - \fi + \fi% \@tempa} % \end{macrocode} % \end{macro} @@ -4031,9 +4078,9 @@ % that it passes the optional argument to \cmd{\@thm}. % \begin{macrocode} \def\@ynthm#1[#2]#3{% - \ifx\relax#2\relax + \ifx\relax#2\relax% \def\@tempa{\@oparg{\@xthm{#1}{#3}}[]}% - \else + \else% \@ifundefined{c@#2}{% \def\@tempa{\@nocounterr{#2}}% }{% @@ -4041,13 +4088,13 @@ \toks@{#3}% \@xp\xdef\csname#1\endcsname{% \@nx\@thm[#1]{% <<<<< new optional argument for theorem name - \let\@nx\thm@swap - \if S\thm@swap\@nx\@firstoftwo\else\@nx\@gobble\fi + \let\@nx\thm@swap% + \if S\thm@swap\@nx\@firstoftwo\else\@nx\@gobble\fi% \@xp\@nx\csname th@\the\thm@style\endcsname}% {#2}{\the\toks@}}% - \let\@tempa\relax + \let\@tempa\relax% }% - \fi + \fi% \@tempa} }{}% end of \@ifpackageloaded % \end{macrocode} @@ -4080,21 +4127,24 @@ % behaviour, in case full compatibility is required. % \begin{macrocode} \if@cref@legacyvarioref% - \leavevmode\unskip\vref@space + \leavevmode\unskip\vref@space% \fi% \@cref{#1}{#2} % space here is deliberate \begingroup% \def\@tmpstack{#2,\@nil}% \cref@stack@topandbottom{\@tmpstack}{\@firstref}{\@lastref}% \ifx\@lastref\@empty% - \vpageref{#2}% + \vpageref[\unskip]{#2}% \else% \edef\@tmpa{{\@firstref}{\@lastref}}% + \expandafter\def\expandafter\@tmpa\expandafter{% + \expandafter[\expandafter\unskip\expandafter]% + \@tmpa}% \expandafter\vpagerefrange\@tmpa% \fi% \endgroup} \def\cref@vrefrange#1#2#3{% - \@setcrefrange{#2}{#3}{#1}{} \vpagerefrange{#2}{#3}} + \@setcrefrange{#2}{#3}{#1}{} \vpagerefrange[\unskip]{#2}{#3}} \def\cref@fullref#1#2{% \@cref{#1}{#2} % space here is deliberate \begingroup% @@ -4107,9 +4157,9 @@ \@tmpa\expandafter{\@firstref}% \expandafter\vrefpagenum\expandafter% \@tmpb\expandafter{\@lastref}% - \ifx\@tmpa\@tmpb + \ifx\@tmpa\@tmpb% \expandafter\reftextfaraway\expandafter{\@firstref}% - \else + \else% \edef\@tmpa{{\@firstref}{\@lastref}}% \expandafter\reftextpagerange\@tmpa% \fi% @@ -4136,7 +4186,7 @@ \def\vr@f#1{\cref@vref{cref}{#1}} \def\Vr@f#1{\cref@vref{Cref}{#1}} \renewcommand\vrefrange[3][\reftextcurrent]{% - \crefrange{#2}{#3} \vpagerefrange{#2}{#3}} + \crefrange{#2}{#3} \vpagerefrange[\unskip]{#2}{#3}} \def\fullref#1{\cref@fullref{cref}{#1}} % \end{macrocode} % @@ -4185,17 +4235,11 @@ \DeclareRobustCommand{\Fullref}{% \@ifstar{\cref@fullrefstar{Cref}}{\cref@fullref{Cref}}} \def\cref@vrefstar#1#2{% - \@crefstarredtrue% - \cref@vref{#1}{#2}% - \@crefstarredfalse} + \@crefstarredtrue\cref@vref{#1}{#2}\@crefstarredfalse} \def\cref@vrefrangestar#1#2#3{% - \@crefstarredtrue% - \cref@vrefrange{#1}{#2}{#3}% - \@crefstarredfalse} + \@crefstarredtrue\cref@vrefrange{#1}{#2}{#3}\@crefstarredfalse} \def\cref@fullrefstar#1#2{% - \@crefstarredtrue% - \cref@fullref{#1}{#2}% - \@crefstarredfalse} + \@crefstarredtrue\cref@fullref{#1}{#2}\@crefstarredfalse} }{% \DeclareRobustCommand{\vref}{\cref@vref{cref}} \DeclareRobustCommand{\Vref}{\cref@vref{Cref}} @@ -4332,47 +4376,47 @@ \expandafter\def\expandafter\cref@poorman@text\expandafter{% \crefrangeconjunction}% \expandafter\def\expandafter\@tmpa\expandafter{% - \expandafter{\@address}{\string\crefrangeconjunction}} + \expandafter{\@address}{\string\crefrangeconjunction}}% \expandafter\cref@writescript\@tmpa% \expandafter\def\expandafter\cref@poorman@text\expandafter{% \crefrangepreconjunction}% \expandafter\def\expandafter\@tmpa\expandafter{% - \expandafter{\@address}{\string\crefrangepreconjunction}} + \expandafter{\@address}{\string\crefrangepreconjunction}}% \expandafter\cref@writescript\@tmpa% \expandafter\def\expandafter\cref@poorman@text\expandafter{% \crefrangepostconjunction}% \expandafter\def\expandafter\@tmpa\expandafter{% - \expandafter{\@address}{\string\crefrangepostconjunction}} + \expandafter{\@address}{\string\crefrangepostconjunction}}% \expandafter\cref@writescript\@tmpa% \expandafter\def\expandafter\cref@poorman@text\expandafter{% \crefpairconjunction}% \expandafter\def\expandafter\@tmpa\expandafter{% - \expandafter{\@address}{\string\crefpairconjunction}} + \expandafter{\@address}{\string\crefpairconjunction}}% \expandafter\cref@writescript\@tmpa% \expandafter\def\expandafter\cref@poorman@text\expandafter{% \crefmiddleconjunction}% \expandafter\def\expandafter\@tmpa\expandafter{% - \expandafter{\@address}{\string\crefmiddleconjunction}} + \expandafter{\@address}{\string\crefmiddleconjunction}}% \expandafter\cref@writescript\@tmpa% \expandafter\def\expandafter\cref@poorman@text\expandafter{% \creflastconjunction}% \expandafter\def\expandafter\@tmpa\expandafter{% - \expandafter{\@address}{\string\creflastconjunction}} + \expandafter{\@address}{\string\creflastconjunction}}% \expandafter\cref@writescript\@tmpa% \expandafter\def\expandafter\cref@poorman@text\expandafter{% \crefpairgroupconjunction}% \expandafter\def\expandafter\@tmpa\expandafter{% - \expandafter{\@address}{\string\crefpairgroupconjunction}} + \expandafter{\@address}{\string\crefpairgroupconjunction}}% \expandafter\cref@writescript\@tmpa% \expandafter\def\expandafter\cref@poorman@text\expandafter{% \crefmiddlegroupconjunction}% \expandafter\def\expandafter\@tmpa\expandafter{% - \expandafter{\@address}{\string\crefmiddlegroupconjunction}} + \expandafter{\@address}{\string\crefmiddlegroupconjunction}}% \expandafter\cref@writescript\@tmpa% \expandafter\def\expandafter\cref@poorman@text\expandafter{% \creflastgroupconjunction}% \expandafter\def\expandafter\@tmpa\expandafter{% - \expandafter{\@address}{\string\creflastgroupconjunction}} + \expandafter{\@address}{\string\creflastgroupconjunction}}% \expandafter\cref@writescript\@tmpa% % \end{macrocode} % We write substitution rules for all component-derived cross-reference @@ -4396,7 +4440,7 @@ \expandafter\expandafter\expandafter{% \expandafter\expandafter\expandafter{% \expandafter\@address\expandafter}% - \expandafter{\@tmpa}} + \expandafter{\@tmpa}}% \expandafter\cref@writescript\@tmpa% % \end{macrocode} % \cmd{\cref@}\meta{type}|@name@plural| substitution rules. @@ -4414,7 +4458,7 @@ \expandafter\expandafter\expandafter{% \expandafter\expandafter\expandafter{% \expandafter\@address\expandafter}% - \expandafter{\@tmpa}} + \expandafter{\@tmpa}}% \expandafter\cref@writescript\@tmpa% % \end{macrocode} % \cmd{\Cref@}\meta{type}|@name| substitution rules. @@ -4431,7 +4475,7 @@ \expandafter\expandafter\expandafter{% \expandafter\expandafter\expandafter% {\expandafter\@address\expandafter}% - \expandafter{\@tmpa}} + \expandafter{\@tmpa}}% \expandafter\cref@writescript\@tmpa% % \end{macrocode} % \cmd{\Cref@}\meta{type}|@name@plural| substitution rules. @@ -4449,7 +4493,7 @@ \expandafter\expandafter\expandafter{% \expandafter\expandafter\expandafter% {\expandafter\@address\expandafter}% - \expandafter{\@tmpa}} + \expandafter{\@tmpa}}% \expandafter\cref@writescript\@tmpa% % \end{macrocode} % After the loop over cross-reference types, we set @@ -4487,7 +4531,7 @@ % We get around this by creating the unusual charcode/catcode % combinations using the \cmd{\lowercase} trick (\cmd{\lowercase} changes % the charcodes of all characters in its argument to their lccodes, but -% \emph{leaves} their catcodes alone). That way, the argument of +% \emph{leaves their catcodes alone}). That way, the argument of % \cmd{\AtEndDocument} is tokenised correctly, and when it comes to be % expanded and evaluated, the \cmd{\lowercase} commands create tokens % with the correct char- and catcodes. @@ -4554,7 +4598,7 @@ s/||label|[[^]]*|]/||label/g}} \expandafter\g@addto@macro\expandafter% \cref@poorman@text\expandafter{\@tmpa^^J}% - \lowercase{\edef\@tmpa{s/||usepackage|(|[.*|]|)|?<cleveref>//g}}% + \lowercase{\edef\@tmpa{s/||usepackage|(|[.*|]|)|<0,1|><cleveref>//g}}% \expandafter\g@addto@macro\expandafter% \cref@poorman@text\expandafter{\@tmpa^^J}% \lowercase{\edef\@tmpa{s/||[cC]refformat<.*><.*>//g}}% @@ -4620,7 +4664,7 @@ \immediate\openout\@crefscript=\jobname.sed% \immediate\write\@crefscript{\cref@poorman@text}% \immediate\closeout\@crefscript% - } + }% end of \AtEndDocument % \end{macrocode} % % @@ -4650,36 +4694,61 @@ % Redefine the user-level referencing commands so that they write a % substitution rule for the reference to the script, as well as % type-setting the reference itself. +% +% We use a temporary \cmd{\@tmpa} macro that makes use of the fact that +% the first character of \#1 is ``c'' for lower-case and ``C'' for +% upper-case in these commands, in order to write out the correct +% capitalisation in the substitution. +% +% FIXME: We only resort to this because |\string\#1| doesn't work. But +% there \emph{must} be a better way to get a backslash character into +% the token stream, obviating the need for the ugly \cmd{\@tmpa} macro. % \begin{macrocode} \@ifpackageloaded{hyperref}{% \def\@crefnostar#1#2{% \gdef\cref@poorman@text{}% \@cref{#1}{#2}% - \begingroup% - \lccode`|=92 \lccode`<=123 \lccode`>=125 \lccode`C=67 - \lowercase{\cref@writescript{}{|#1<#2>}}% - \endgroup} + \def\@tmpa##1##2\@nil{% + \if##1c% + \cref@writescript{}{\string\cref\string{#2\string}}% + \else% + \cref@writescript{}{\string\Cref\string{#2\string}}% + \fi}% + \@tmpa#1\@nil} \def\@crefstar#1#2{% \gdef\cref@poorman@text{}% \@crefstarredtrue\@cref{#1}{#2}\@crefstarredfalse% - \begingroup% - \lccode`|=92 \lccode`<=123 \lccode`>=125 \lccode`C=67 - \lowercase{\cref@writescript{}{|#1*<#2>}}% - \endgroup} + \def\@tmpa##1##2\@nil{% + \if##1c% + \cref@writescript{}{\string\cref*\string{#2\string}}% + \else% + \cref@writescript{}{\string\Cref*\string{#2\string}}% + \fi}% + \@tmpa#1\@nil} \def\@crefrangenostar#1#2#3{% \gdef\cref@poorman@text{}% \@setcrefrange{#2}{#3}{#1}{}% - \begingroup% - \lccode`|=92 \lccode`<=123 \lccode`>=125 \lccode`C=67 - \lowercase{\cref@writescript{}{|#1range<#2><#3>}}% - \endgroup} + \def\@tmpa##1##2\@nil{% + \if##1c% + \cref@writescript{}{% + \string\crefrange\string{#2\string}\string{#3\string}}% + \else% + \cref@writescript{}{% + \string\Crefrange\string{#2\string}\string{#3\string}}% + \fi}% + \@tmpa#1\@nil} \def\@crefrangestar#1#2#3{% \gdef\cref@poorman@text{}% \@crefstarredtrue\@setcrefrange{#2}{#3}{#1}{}\@crefstarredfalse% - \begingroup% - \lccode`|=92 \lccode`<=123 \lccode`>=125 \lccode`C=67 - \lowercase{\cref@writescript{}{|#1range*<#2><#3>}}% - \endgroup} + \def\@tmpa##1##2\@nil{% + \if##1c% + \cref@writescript{}{% + \string\crefrange*\string{#2\string}\string{#3\string}}% + \else% + \cref@writescript{}{% + \string\Crefrange*\string{#2\string}\string{#3\string}}% + \fi}% + \@tmpa#1\@nil} % }{% \DeclareRobustCommand{\cref}[1]{% @@ -4738,11 +4807,11 @@ \@ifstar{\cref@vrefstar{cref}}{\cref@vref{cref}}} \def\cref@vrefstar#1#2{% \@crefstarredtrue\cref@vref{#1}{#2}\@crefstarredfalse} - \fi + \fi% \def\cref@vref#1#2{% \gdef\cref@poorman@text{}% \if@cref@legacyvarioref% - \leavevmode\unskip\vref@space + \leavevmode\unskip\vref@space% \fi% \begingroup% % \end{macrocode} @@ -4757,11 +4826,14 @@ \def\@tmpstack{#2,\@nil}% \cref@stack@topandbottom{\@tmpstack}{\@firstref}{\@lastref}% \ifx\@lastref\@empty% - \vpageref{#2}% - \g@addto@macro\cref@poorman@text{ \vpageref{#2}}% + \vpageref[\unskip]{#2}% + \g@addto@macro\cref@poorman@text{ \vpageref[\unskip]{#2}}% \else% \g@addto@macro\cref@poorman@text{ }% \edef\@tmpa{{\@firstref}{\@lastref}}% + \expandafter\def\expandafter\@tmpa\expandafter{% + \expandafter[\expandafter\unskip\expandafter]% + \@tmpa}% \expandafter\vpagerefrange\@tmpa% \expandafter\g@addto@macro\expandafter\cref@poorman@text% \expandafter{\expandafter\vpagerefrange\@tmpa}% @@ -4785,8 +4857,8 @@ % \def\cref@vrefrange#1#2#3{% \gdef\cref@poorman@text{}% - \@setcrefrange{#2}{#3}{#1}{} \vpagerefrange{#2}{#3}% - \g@addto@macro\cref@poorman@text{ \vpagerefrange{#2}{#3}}% + \@setcrefrange{#2}{#3}{#1}{} \vpagerefrange[\unskip]{#2}{#3}% + \g@addto@macro\cref@poorman@text{ \vpagerefrange[\unskip]{#2}{#3}}% \def\@tmpa##1##2\@nil{% \if##1c% \if@crefstarred% @@ -4821,11 +4893,11 @@ \@tmpa\expandafter{\@firstref}% \expandafter\vrefpagenum\expandafter% \@tmpb\expandafter{\@lastref}% - \ifx\@tmpa\@tmpb + \ifx\@tmpa\@tmpb% \expandafter\reftextfaraway\expandafter{\@firstref}% \expandafter\def\expandafter\@pageref\expandafter{% \expandafter\reftextfaraway\expandafter{\@firstref}}% - \else + \else% \edef\@tmpa{{\@firstref}{\@lastref}}% \expandafter\reftextpagerange\@tmpa% \expandafter\def\expandafter\@pageref\expandafter{% @@ -4849,7 +4921,7 @@ \cref@writescript{}{\string\Fullref\string{#2\string}}% \fi% \fi}% - \@tmpa#1\@nil + \@tmpa#1\@nil% \endgroup} }% end of \AtBeginDocument }{}% end of \@ifpackageloaded @@ -4920,6 +4992,8 @@ \expandafter{#1{\ref{#2}}{\ref{#3}}{}{}{}{}}% \fi} }{% + \let\old@@setcref\@@setcref% + \let\old@@setcrefrange\@@setcrefrange% \def\@@setcref#1#2{% \old@@setcref{#1}{#2}% \expandafter\g@addto@macro\expandafter{% @@ -5044,12 +5118,12 @@ % \begin{macrocode} \def\cref@addto#1#2{% \@temptokena{#2}% - \ifx#1\undefined + \ifx#1\undefined% \edef#1{\the\@temptokena}% - \else + \else% \toks@\expandafter{#1}% \edef#1{\the\toks@\the\@temptokena}% - \fi + \fi% \@temptokena{}\toks@\@temptokena% } \@onlypreamble\cref@addto @@ -5127,6 +5201,7 @@ \Crefname@preamble{appendix}{Appendix}{Appendices}% \Crefname@preamble{figure}{Figure}{Figures}% \Crefname@preamble{table}{Table}{Tables}% + \Crefname@preamble{theorem}{Theorem}{Theorems}% \Crefname@preamble{enumi}{Item}{Items}% \Crefname@preamble{lemma}{Lemma}{Lemmas}% \Crefname@preamble{corollary}{Corollary}{Corollaries}% @@ -5300,7 +5375,7 @@ % define \cmd{\crefpairgroupconjunction} explicitly. In fact, we have to % define the other group conjunctions explicitly too here, in case any % other language option defines them explicitly and we need to override -% them . +% them. % \begin{macrocode} \def\crefpairgroupconjunction@preamble{ und~}% \def\crefmiddlegroupconjunction@preamble{, }% @@ -5571,6 +5646,167 @@ }}} % \end{macrocode} % +% \begin{macro}{german} +% Dutch translations kindly contributed by Philip H\"olzenspies. +% \end{macro} +% \begin{macrocode} +\DeclareOption{dutch}{% + \PackageInfo{cleveref}{loaded `dutch' language definitions} +% \end{macrocode} +% First, we set up the definitions used at the beginning of the document to +% define the formats created by the document preamble. +% \begin{macrocode} + \AtBeginDocument{% + \def\crefrangeconjunction@preamble{ tot~}% + \def\crefrangepreconjunction@preamble{}% + \def\crefrangepostconjunction@preamble{}% + \def\crefpairconjunction@preamble{ en~}% + \def\crefmiddleconjunction@preamble{, }% + \def\creflastconjunction@preamble{ en~}% +% \end{macrocode} +% As in German, we don't want the extra comma before ``en'' that would be +% added by the default fall-back definitions in terms of the above +% conjunctions, so we define \cmd{\crefpairgroupconjunction} explicitly. In +% fact, we have to define the other group conjunctions explicitly too here, in +% case any other language option defines them explicitly and we need to +% override them. +% \begin{macrocode} + \def\crefpairgroupconjunction@preamble{ en~}% + \def\crefmiddlegroupconjunction@preamble{, }% + \def\creflastgroupconjunction@preamble{ en~}% + \Crefname@preamble{equation}% + {Ver\-ge\-l\ij{}k\-ing}{Ver\-ge\-l\ij{}k\-ing\-en}% + \Crefname@preamble{chapter}{Hoofdstuk}{Hoofdstuken}% + \Crefname@preamble{section}{Paragraaf}{Paragrafen}% + \Crefname@preamble{appendix}{Appendix}{Appendices}% + \Crefname@preamble{figure}{Figuur}{Figuren}% + \Crefname@preamble{table}{Tabel}{Tabellen}% + \Crefname@preamble{enumi}{Punt}{Punten}% + \Crefname@preamble{lemma}{Lemma}{Lemma's}% + \Crefname@preamble{corollary}{Corollarium}{Corollaria}% + \Crefname@preamble{proposition}{Bewering}{Beweringen}% + \Crefname@preamble{definition}{Definitie}{Definities}% + \Crefname@preamble{result}{Resultaat}{Resultaten}% + \Crefname@preamble{example}{Voorbeeld}{Voorbeelden}% + \Crefname@preamble{remark}{Opmerking}{Opmerkingen}% + \Crefname@preamble{note}{Aantekening}{Aantekeningen}% + \if@cref@capitalise% + \crefname@preamble{equation}{Verg.}{Verg's.}% + \crefname@preamble{chapter}{Hoofdstuk}{Hoofdstukken}% + \crefname@preamble{section}{Paragraaf}{Paragrafen}% + \crefname@preamble{appendix}{Appendix}{Appendices}% + \crefname@preamble{figure}{Fig.}{Fig's.}% + \crefname@preamble{table}{Tabel}{Tabellen}% + \crefname@preamble{theorem}{Theorema}{Theorema's}% + \crefname@preamble{enumi}{Punt}{Punten}% + \crefname@preamble{lemma}{Lemma}{Lemma's}% + \crefname@preamble{corollary}{Corollarium}{Corollaria}% + \crefname@preamble{proposition}{Bewering}{Beweringen}% + \crefname@preamble{definition}{Definitie}{Definities}% + \crefname@preamble{result}{Resultaat}{Resultaten}% + \crefname@preamble{example}{Voorbeeld}{Voorbeelden}% + \crefname@preamble{remark}{Opmerking}{Opmerkingen}% + \crefname@preamble{note}{Aantekening}{Aantekeningen}% + \else% + \crefname@preamble{equation}{verg.}{verg's.}% + \crefname@preamble{chapter}{hoofdstuk}{hoofdstukken}% + \crefname@preamble{section}{paragraaf}{paragrafen}% + \crefname@preamble{appendix}{appendix}{appendices}% + \crefname@preamble{figure}{fig.}{fig's.}% + \crefname@preamble{table}{tabel}{tabellen}% + \crefname@preamble{theorem}{theorema}{theorema's}% + \crefname@preamble{enumi}{punt}{punten}% + \crefname@preamble{lemma}{lemma}{lemma's}% + \crefname@preamble{corollary}{corollarium}{corollaria}% + \crefname@preamble{proposition}{bewering}{beweringen}% + \crefname@preamble{definition}{definitie}{definities}% + \crefname@preamble{result}{resultaat}{resultaten}% + \crefname@preamble{example}{voorbeeld}{voorbeelden}% + \crefname@preamble{remark}{opmerking}{opmerkingen}% + \crefname@preamble{note}{aantekening}{aantekeningen}% + \fi% + \def\cref@language{dutch}% +% \end{macrocode} +% +% Next, we add the definitions to \cmd{\extras}\dots so that +% \package{babel}'s \cmd{\selectlanguage} command will change the format +% appropriately. +% \begin{macrocode} + \cref@addto\extrasdutch{% + \renewcommand{\crefrangeconjunction}{ tot~}% + \renewcommand\crefrangepreconjunction{}% + \renewcommand\crefrangepostconjunction{}% + \renewcommand{\crefpairconjunction}{ en~}% + \renewcommand{\crefmiddleconjunction}{, }% + \renewcommand{\creflastconjunction}{ en~}% + \renewcommand{\crefpairgroupconjunction}{ en~}% + \renewcommand{\crefmiddlegroupconjunction}{, }% + \renewcommand{\creflastgroupconjunction}{ en~}% + \Crefname{equation}{Ver\-ge\-l\ij{}k\-ing}{Ver\-ge\-l\ij{}k\-ing\-en}% + \Crefname{chapter}{Hoofdstuk}{Hoofdstuken}% + \Crefname{section}{Paragraaf}{Paragrafen}% + \Crefname{subsection}{Paragraaf}{Paragrafen}% + \Crefname{subsubsection}{Paragraaf}{Paragrafen}% + \Crefname{appendix}{Appendix}{Appendices}% + \Crefname{subappendix}{Appendix}{Appendices}% + \Crefname{subsubappendix}{Appendix}{Appendices}% + \Crefname{subsubsubappendix}{Appendix}{Appendices}% + \Crefname{figure}{Figuur}{Figuren}% + \Crefname{subfigure}{Figuur}{Figuren}% + \Crefname{table}{Tabel}{Tabellen}% + \Crefname{subtable}{Tabel}{Tabellen}% + \Crefname{theorem}{Theorema}{Theorema's}% + \Crefname{enumi}{Punt}{Punten}% + \Crefname{enumii}{Punt}{Punten}% + \Crefname{enumiii}{Punt}{Punten}% + \Crefname{enumiv}{Punt}{Punten}% + \Crefname{enumv}{Punt}{Punten}% + \Crefname{lemma}{Lemma}{Lemma's}% + \Crefname{corollary}{Corollarium}{Corollaria}% + \Crefname{proposition}{Bewering}{Beweringen}% + \Crefname{definition}{Definitie}{Definities}% + \Crefname{result}{Resultaat}{Resultaten}% + \Crefname{example}{Voorbeeld}{Voorbeelden}% + \Crefname{remark}{Opmerking}{Opmerkingen}% + \Crefname{note}{Aantekening}{Aantekeningen}% + \if@cref@capitalise% + \crefname{equation}{Verg.}{Verg's.}% + \crefname{chapter}{Hoofdstuk}{Hoofdstukken}% + \crefname{section}{Paragraaf}{Paragrafen}% + \crefname{appendix}{Appendix}{Appendices}% + \crefname{figure}{Fig.}{Fig's.}% + \crefname{table}{Tabel}{Tabellen}% + \crefname{theorem}{Theorema}{Theorema's}% + \crefname{enumi}{Punt}{Punten}% + \crefname{lemma}{Lemma}{Lemma's}% + \crefname{corollary}{Corollarium}{Corollaria}% + \crefname{proposition}{Bewering}{Beweringen}% + \crefname{definition}{Definitie}{Definities}% + \crefname{result}{Resultaat}{Resultaten}% + \crefname{example}{Voorbeeld}{Voorbeelden}% + \crefname{remark}{Opmerking}{Opmerkingen}% + \crefname{note}{Aantekening}{Aantekeningen}% + \else% + \crefname{equation}{verg.}{verg's.}% + \crefname{chapter}{hoofdstuk}{hoofdstukken}% + \crefname{section}{paragraaf}{paragrafen}% + \crefname{appendix}{appendix}{appendices}% + \crefname{figure}{fig.}{fig's.}% + \crefname{table}{tabel}{tabellen}% + \crefname{theorem}{theorema}{theorema's}% + \crefname{enumi}{punt}{punten}% + \crefname{lemma}{lemma}{lemma's}% + \crefname{corollary}{corollarium}{corollaria}% + \crefname{proposition}{bewering}{beweringen}% + \crefname{definition}{definitie}{definities}% + \crefname{result}{resultaat}{resultaten}% + \crefname{example}{voorbeeld}{voorbeelden}% + \crefname{remark}{opmerking}{opmerkingen}% + \crefname{note}{aantekening}{aantekeningen}% + \fi% + }}} +% \end{macrocode} +% % % \begin{macro}{french} % French translations attempted by the package author (please report @@ -6274,7 +6510,7 @@ \csname cref@\@tmpa @name@plural\endcsname}% \expandafter\def\expandafter\@tmpc\expandafter{% \csname cref@\@tmpa @name@plural@preamble\endcsname}% - \expandafter\expandafter\expandafter\let\expandafter\@tmpb\@tmpc + \expandafter\expandafter\expandafter\let\expandafter\@tmpb\@tmpc% }{% \edef\@tmpb{% \expandafter\noexpand\csname extras\cref@language\endcsname}% @@ -6303,7 +6539,7 @@ \csname Cref@\@tmpa @name@plural\endcsname}% \expandafter\def\expandafter\@tmpc\expandafter{% \csname Cref@\@tmpa @name@plural@preamble\endcsname}% - \expandafter\expandafter\expandafter\let\expandafter\@tmpb\@tmpc + \expandafter\expandafter\expandafter\let\expandafter\@tmpb\@tmpc% }{% \edef\@tmpb{% \expandafter\noexpand\csname extras\cref@language\endcsname}% |