From d0e0ced5b6c1be83aaf7b21fa07e5ed5e01f5733 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 20 Jan 2011 00:16:05 +0000 Subject: cleveref 0.17.7 (20jan11) git-svn-id: svn://tug.org/texlive/trunk@21128 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/cleveref/cleveref.dtx | 551 ++++++++++++++++----- 1 file changed, 426 insertions(+), 125 deletions(-) (limited to 'Master/texmf-dist/source/latex/cleveref') diff --git a/Master/texmf-dist/source/latex/cleveref/cleveref.dtx b/Master/texmf-dist/source/latex/cleveref/cleveref.dtx index e147c7e4513..56c96b80ebe 100644 --- a/Master/texmf-dist/source/latex/cleveref/cleveref.dtx +++ b/Master/texmf-dist/source/latex/cleveref/cleveref.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Package 'cleveref' to use with LaTeX2e -% Copyright 2007--2010 by Toby Cubitt +% Copyright 2007--2011 by Toby Cubitt % % Written and maintained by Toby Cubitt % @@ -21,7 +21,7 @@ % \iffalse %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{cleveref} -% [2010/09/15 v0.17.5 Intelligent cross-referencing] +% [2011/01/10 v0.17.7 Intelligent cross-referencing] % %<*driver> \documentclass{ltxdoc} @@ -62,7 +62,7 @@ % % \fi % -% \CheckSum{13848} +% \CheckSum{14252} %% \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 @@ -213,12 +213,20 @@ % \changes{v0.17.5}{2010/09/15}{Fixed bug that broke compilation of % documents that didn't use \package{hyperref}, because % \textbackslash{}if@cref@hyperrefloaded was not defined.} -% +% \changes{v0.17.6}{2011/01/05}{Added \package{babel} support for +% Norwegian. Replaced ``appendice'' with ``annexe'' in French default +% cross-reference names, to match \package{babel} names. Replaced +% ``Linie'' with ``Zeile'' in the German default cross-reference names. +% Added \textbackslash{}lcnamecref and \textbackslash{}lcnamecrefs +% commands to force lowercase reference names, useful with the +% \option{capitalise} option.} +% \changes{v0.17.7}{2011/01/10}{Fixed \textbackslash{}crefname to work +% with empty reference names.} % % \GetFileInfo{cleveref.sty} % -% \def\fileversion{0.17.5} -% \def\filedate{15/09/2010} +% \def\fileversion{0.17.7} +% \def\filedate{10/01/2011} % % \title{The \package{cleveref} package\thanks{This document % corresponds to \textsf{cleveref}~\fileversion, dated @@ -442,8 +450,10 @@ % \pagebreak % \DescribeMacro{\namecref} % \DescribeMacro{\nameCref} +% \DescribeMacro{\lcnamecref} % \DescribeMacro{\namecrefs} % \DescribeMacro{\nameCrefs} +% \DescribeMacro{\lcnamecrefs} % Occasinally, it's useful to produce just the name of a reference, % without the label itself. For example, if you want to refer to ``this % section'', but you're not sure whether you might later change the @@ -455,7 +465,11 @@ % |\namecref{sec1}| % \end{quote} % is type-set as ``section'' (assuming |sec1| labels a section). The -% |\namecref| and |\nameCrefs| commands produce the plural forms. +% |\namecref| and |\nameCrefs| commands produce the plural forms. The +% |\lcnamecref| and |\lcnamecrefs| commands force the reference name to +% lowercase, for use when the \option{capitalise} option is enabled (see +% \cref{sec:capitalise}). (When that option is set, |\namecref| produces +% an uppercase reference name.) % % \DescribeMacro{\labelcref} % Conversely, it is occasionally useful to produce just the label part of @@ -587,19 +601,18 @@ % type-setting of cross-references, by allowing the formatting to be % customised. Defaults appropriate for English documents are provided for % the standard label types,\footnote{For any pedantic classics scholars -% out there: ``lemmas'' is recognised as a valid plural form of -% ``lemma'' in all current versions of the Oxford English Dictionary. -% ``Lemmata'' was last heard in a mathematical debate that took place -% in a pub just around the corner from Hadrian's wall\dots a few years -% before the Romans pulled out of Britain. \package{cleveref} might -% have ``clever'' in its name, but even that doesn't make it -% pretentious enough to use ``lemmata''.} and support for German, -% French, Spanish and Italian is provided via package options (see -% \cref{sec:language_babel}). But if you don't like the defaults, or are -% writing in a different language,\footnote{Any contributions of -% translations for missing languages are very welcome! See -% \cref{sec:code:babel} for information on how to contribute -% translations.} or you need to refer to something for which no default +% out there: ``lemmas'' is recognised as a valid plural form of ``lemma'' +% in all current versions of the Oxford English Dictionary. ``Lemmata'' +% was last heard in a mathematical debate that took place in a pub just +% around the corner from Hadrian's wall\dots a few years before the +% Romans pulled out of Britain. \package{cleveref} might have ``clever'' +% in its name, but even that doesn't make it pretentious enough to use +% ``lemmata''.} and support for a number of languages is provided via +% package options (see \cref{sec:language_babel}). But if you don't like +% the defaults, or are writing in a different language,\footnote{Any +% contributions of translations for missing languages are very welcome! +% See \cref{sec:code:babel} for information on how to contribute +% translations.} or you need to refer to something for which no default % format is defined, then you can take charge and define your own % formats. % @@ -800,8 +813,9 @@ % of |subsubsection| is inherited from |subsection| (which might itself % have been inherited from |section|). Similarly for |subappendix|, % |subsubappendix| and |subsubsubappendix|, and also for |enumii|, -% |enumiii|, |enumiv| and |enumv|. Finally, |subfigure| and |subtable| -% inherit from |figure| and |table|, respectively. +% |enumiii|, |enumiv| and |enumv|, which inherit from |enumi|. Finally, +% |subfigure| and |subtable| inherit from |figure| and |table|, +% respectively. % % \DescribeMacro\creflabelformat % You may want the label format for a particular cross-reference type to @@ -1125,13 +1139,12 @@ % low-level customisation commands, but \emph{do} still want the language % switching commands to work, then you have to use the component macros % in your customised formats. The cross-reference names are stored in -% macros called |\cref@\meta{type}@name|, |\Cref@\meta{type}@name|, -% |\cref@\meta{type}@name@plural|, and -% |\Cref@\meta{type}@name@plural|.\linebreak[4] (Note that since these +% macros called |\cref@|\meta{type}|@name|, |\Cref@|\meta{type}|@name|, +% |\cref@|\meta{type}|@name@plural|, and +% |\Cref@|\meta{type}|@name@plural|.\linebreak[4] (Note that since these % macro names contain the ``@'' character, you must use |\makeatletter| % and |\makeatother| to access them.) % -% \enlargethispage{\baselineskip} % For example, if you wanted to redefine the equation format so that the % cross-reference name (``equation'') was also part of the hyper-link, % but you still want to be able to switch language using \package{babel}, @@ -1145,6 +1158,13 @@ % and similarly for |\crefrangeformat|, |\crefmultiformat|, % |\Crefformat|, etc. % +% Note that if you define an empty cross-reference name for some type +% using an empty |\crefname|, e.g.\ for equations +% \begin{quote} +% |\crefname{equation}{}{}| +% \end{quote} +% then the empty cross-reference name will be retained when switching +% languages. This is probably what you want anyway. % % % \section{Overriding the Cross-Reference Type} @@ -1278,7 +1298,7 @@ % \LaTeX{} code in your document, which would somewhat defeat the purpose % of the \option{poorman} option.} In particular, any customisation of % hyper-links will be lost, and if you're using \package{varioref} with -% the \option{legacyvarioref} option (see \cref{sec:other_packages}, the +% the \option{legacyvarioref} option (see \cref{sec:other_packages}), the % spacing before the |\vref| command will not be correct. % % @@ -1405,6 +1425,10 @@ % \item \package{cleveref} doesn't know about the \package{subfloat} % package, so you have to revert to using |\ref| for cross-references % to sub-figures. (This should be fixed in a future version.) +% \item The \package{beamer} document class redefines the |\label| +% command in a particularly devious way that breaks +% \package{cleveref}'s optional argument to that command. (This should +% be fixed in a future version.) % \item The \option{poorman} |sed| script loses any custom % \package{cleveref} hyper-link formatting you might have defined, and % does not reproduce the original spacing around the |\vref| command @@ -1448,11 +1472,11 @@ % order) to: Aleksander Gorohovski, Anand Deopurkar, Arne Meier, Bas % Ploeger, Dan Luecking, David Gleich, Denis Bitouz\'e, Domenic Denicola, % 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 you out, please -% let me know!) +% Salomon, Joris Pinkse, Leo Shidai Liu, Lev Bishop, Matej Batic, Matt +% Gately, 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 you out, please let me know!) % % % \StopEventually{\clearpage\PrintChanges\clearpage\PrintIndex} @@ -3462,8 +3486,10 @@ % \begin{macro}{\labelcref} % \begin{macro}{\namecref} % \begin{macro}{\nameCref} +% \begin{macro}{\lcnamecref} % \begin{macro}{\namecrefs} % \begin{macro}{\nameCrefs} +% \begin{macro}{\lcnamecrefs} % Finally, we define a \cmd{\labelcref} that returns just the type-set % label part of a (multi-)reference, without the reference name, and % conversely \cmd{\namecref}, \cmd{\nameCref}, \cmd{\namecrefs} and @@ -3471,7 +3497,9 @@ % reference, without the reference label. The latter four retrieve the % reference name from the corresponding \cmd{\crefname} or % \cmd{\Crefname} definition, so they only work when this has been -% defined. +% defined. We also define \cmd{\lcnamecref} and \cmd{\lcnamecrefs} +% commands which force the reference name to lowercase, for use when +% the \option{capitalise} option is enabled. % \begin{macrocode} \DeclareRobustCommand{\labelcref}[1]{\@cref{labelcref}{#1}} \DeclareRobustCommand{\namecref}[1]{% @@ -3500,6 +3528,20 @@ \@latex@warning{Reference name for label type `\@tmpa' undefined}% }{\csname Cref@\@tmpa @name\endcsname}% \fi} +\DeclareRobustCommand{\lcnamecref}[1]{% + \expandafter\ifx\csname r@cref@#1\endcsname\relax% + \protect\G@refundefinedtrue% + \nfss@text{\reset@font\bfseries ??}% + \@latex@warning{Reference `#1' on page \thepage \space undefined}% + \else% + \cref@gettype{#1}{\@tmpa}% + \@ifundefined{cref@\@tmpa @name}{% + \protect\G@refundefinedtrue%`` + \nfss@text{\reset@font\bfseries ??}% + \@latex@warning{Reference name for label type `\@tmpa' undefined}% + }{\expandafter\expandafter\expandafter% + \MakeLowercase\csname cref@\@tmpa @name\endcsname}% + \fi} \DeclareRobustCommand{\namecrefs}[1]{% \expandafter\ifx\csname r@cref@#1\endcsname\relax% \protect\G@refundefinedtrue% @@ -3526,12 +3568,28 @@ \@latex@warning{Reference name for label type `\@tmpa' undefined}% }{\csname Cref@\@tmpa @name@plural\endcsname}% \fi} +\DeclareRobustCommand{\lcnamecrefs}[1]{% + \expandafter\ifx\csname r@cref@#1\endcsname\relax% + \protect\G@refundefinedtrue% + \nfss@text{\reset@font\bfseries ??}% + \@latex@warning{Reference `#1' on page \thepage \space undefined}% + \else% + \cref@gettype{#1}{\@tmpa}% + \@ifundefined{cref@\@tmpa @name@plural}{% + \protect\G@refundefinedtrue%`` + \nfss@text{\reset@font\bfseries ??}% + \@latex@warning{Reference name for label type `\@tmpa' undefined}% + }{\expandafter\expandafter\expandafter% + \MakeLowercase\csname cref@\@tmpa @name@plural\endcsname}% + \fi} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % % % @@ -3666,14 +3724,16 @@ % Add the case-change command stored in \cmd{\@tmpc} to the front of the % definitions of \cmd{\@tmpa} and \cmd{\@tmpb}. % \begin{macrocode} - \expandafter\expandafter\expandafter\def% - \expandafter\expandafter\expandafter\@tmpa% - \expandafter\expandafter\expandafter{% - \expandafter\@tmpc\@tmpa}% - \expandafter\expandafter\expandafter\def% - \expandafter\expandafter\expandafter\@tmpb% - \expandafter\expandafter\expandafter{% - \expandafter\@tmpc\@tmpb}% + \expandafter\ifx\@tmpa\@empty\else% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\@tmpa% + \expandafter\expandafter\expandafter{% + \expandafter\@tmpc\@tmpa}% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\@tmpb% + \expandafter\expandafter\expandafter{% + \expandafter\@tmpc\@tmpb}% + \fi% % \end{macrocode} % Define the other capitalisation variants to be the partial expansions % (expanded just once) of \cmd{\@tmpa} and \cmd{\@tmpb}. The @@ -3781,14 +3841,22 @@ % Assemble the arguments for \cmd{\crefformat}, \cmd{\Crefformat} and % \cmd{\labelcrefformat} from the components. % \begin{macrocode} - \expandafter\expandafter\expandafter\def% - \expandafter\expandafter\expandafter\@tmpfirst% - \expandafter\expandafter\expandafter{% - \expandafter\@tmpname\expandafter\nobreakspace\@tmplabel}% - \expandafter\expandafter\expandafter\def% - \expandafter\expandafter\expandafter\@tmpFirst% - \expandafter\expandafter\expandafter{% - \expandafter\@tmpName\expandafter\nobreakspace\@tmplabel}% + \expandafter\ifx\@tmpname\@empty\relax% + \expandafter\def\expandafter\@tmpfirst\expandafter{\@tmplabel}% + \else% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\@tmpfirst% + \expandafter\expandafter\expandafter{% + \expandafter\@tmpname\expandafter\nobreakspace\@tmplabel}% + \fi% + \expandafter\ifx\@tmpName\@empty\relax% + \expandafter\def\expandafter\@tmpFirst\expandafter{\@tmplabel}% + \else% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\@tmpFirst% + \expandafter\expandafter\expandafter{% + \expandafter\@tmpName\expandafter\nobreakspace\@tmplabel}% + \fi% \expandafter\def\expandafter\@tmplabel\expandafter{\@tmplabel}% % \end{macrocode} % Define \cmd{\crefformat} and \cmd{\Crefformat}. @@ -3822,14 +3890,24 @@ % \cmd{\Crefrangeformat} and\linebreak[4] \cmd{\labelcrefrangeformat} % from the components. % \begin{macrocode} - \expandafter\expandafter\expandafter\def% - \expandafter\expandafter\expandafter\@tmpfirst% - \expandafter\expandafter\expandafter{% - \expandafter\@tmpnameplural\expandafter\nobreakspace\@tmprangelabel}% - \expandafter\expandafter\expandafter\def% - \expandafter\expandafter\expandafter\@tmpFirst% - \expandafter\expandafter\expandafter{% - \expandafter\@tmpNameplural\expandafter\nobreakspace\@tmprangelabel}% + \expandafter\ifx\@tmpname\@empty\relax% + \expandafter\def\expandafter\@tmpfirst% + \expandafter{\@tmprangelabel}% + \else% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\@tmpfirst% + \expandafter\expandafter\expandafter{% + \expandafter\@tmpnameplural\expandafter\nobreakspace\@tmprangelabel}% + \fi% + \expandafter\ifx\@tmpName\@empty\relax% + \expandafter\def\expandafter\@tmpFirst% + \expandafter{\@tmprangelabel}% + \else% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\@tmpFirst% + \expandafter\expandafter\expandafter{% + \expandafter\@tmpNameplural\expandafter\nobreakspace\@tmprangelabel}% + \fi% \expandafter\def\expandafter\@tmprangelabel% \expandafter{\@tmprangelabel}% % \end{macrocode} @@ -3869,14 +3947,24 @@ % \cmd{\Crefmultiformat} and\linebreak[4] \cmd{\labelcrefmultiformat} % from the components. % \begin{macrocode} - \expandafter\expandafter\expandafter\def% - \expandafter\expandafter\expandafter\@tmpfirst% - \expandafter\expandafter\expandafter{% - \expandafter\@tmpnameplural\expandafter\nobreakspace\@tmplabel}% - \expandafter\expandafter\expandafter\def% - \expandafter\expandafter\expandafter\@tmpFirst% - \expandafter\expandafter\expandafter{% - \expandafter\@tmpNameplural\expandafter\nobreakspace\@tmplabel}% + \expandafter\ifx\@tmpnameplural\@empty\relax% + \expandafter\def\expandafter\@tmpfirst% + \expandafter{\@tmplabel}% + \else% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\@tmpfirst% + \expandafter\expandafter\expandafter{% + \expandafter\@tmpnameplural\expandafter\nobreakspace\@tmplabel}% + \fi% + \expandafter\ifx\@tmpNameplural\@empty\relax% + \expandafter\def\expandafter\@tmpFirst% + \expandafter{\@tmplabel}% + \else% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\@tmpFirst% + \expandafter\expandafter\expandafter{% + \expandafter\@tmpNameplural\expandafter\nobreakspace\@tmplabel}% + \fi% \expandafter\def\expandafter\@tmpsecond\expandafter{% \expandafter\crefpairconjunction\@tmplabel}% \expandafter\def\expandafter\@tmpmiddle\expandafter{% @@ -3951,14 +4039,24 @@ % \cmd{\crefrangemultiformat}, \cmd{\Crefrangemultiformat} and % \cmd{\labelcrefrangemultiformat} from the reference components. % \begin{macrocode} - \expandafter\expandafter\expandafter\def% - \expandafter\expandafter\expandafter\@tmpfirst% - \expandafter\expandafter\expandafter{% - \expandafter\@tmpnameplural\expandafter\nobreakspace\@tmprangelabel}% - \expandafter\expandafter\expandafter\def% - \expandafter\expandafter\expandafter\@tmpFirst% - \expandafter\expandafter\expandafter{% - \expandafter\@tmpNameplural\expandafter\nobreakspace\@tmprangelabel}% + \expandafter\ifx\@tmpnameplural\@empty\relax% + \expandafter\def\expandafter\@tmpfirst% + \expandafter{\@tmprangelabel}% + \else% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\@tmpfirst% + \expandafter\expandafter\expandafter{% + \expandafter\@tmpnameplural\expandafter\nobreakspace\@tmprangelabel}% + \fi% + \expandafter\ifx\@tmpNameplural\@empty\relax% + \expandafter\def\expandafter\@tmpFirst% + \expandafter{\@tmprangelabel}% + \else% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\@tmpFirst% + \expandafter\expandafter\expandafter{% + \expandafter\@tmpNameplural\expandafter\nobreakspace\@tmprangelabel}% + \fi% \expandafter\def\expandafter\@tmpsecond\expandafter{% \expandafter\crefpairconjunction\@tmprangelabel}% \expandafter\def\expandafter\@tmpmiddle\expandafter{% @@ -5034,9 +5132,7 @@ % \cmd{\addtocounter}, but to get \package{cleveref} support working, % it's cleaner to hook into the \cmd{\refstepcounter} mechanism, so we % first decrement the counter and then re-increment it using -% \cmd{\refstepcounter}. Finally, since \cmd{ALG@step} is called within -% a group, we have to make the definition of \cmd{cref@currentlabel} -% global. +% \cmd{\refstepcounter}. % \begin{macrocode} \let\cref@old@ALG@step\ALG@step \def\ALG@step{% @@ -5052,9 +5148,10 @@ % % \begin{macro}{listings} % The only thing we need to do in order to support cross-references to -% line numbers produced by the \package{listings} package is to alias -% the counter is uses, \cmd{lstnumber}, to the ``line'' cross-reference -% type. +% line numbers and listings produced by the \package{listings} package +% is to alias the counters it uses, \cmd{lstnumber} and +% \cmd{lstlistings}, to the ``line'' and ``listing'' cross-reference +% types. % \begin{macrocode} \@ifpackageloaded{listings}{% \PackageInfo{cleveref}{`listings' support loaded} @@ -5106,7 +5203,7 @@ % % \subsection{\package{aliascnt} Support} % \begin{macro}{aliascnt} -% For the \package{aliascnt} trick described in \cref{sec:label-type} +% For the \package{aliascnt} trick described in \cref{sec:label_type} % of the documentation to work, we have to inform \package{cleveref} % about how aliased counters get reset. \package{aliascnt}'s % \cmd{\newaliascnt} command doesn't add the aliased counter to any @@ -5463,7 +5560,7 @@ \cref@isstackfull{\@tmpstack}% \@whilesw\if@cref@stackfull\fi{% % \end{macrocode} -% \cmd{\cref@}\meta{type}|@name| substitution rules. +% \cmd{\cref@\meta{type}@name} substitution rules. % \begin{macrocode} \edef\@tmpa{\cref@stack@top{\@tmpstack}}% \expandafter\expandafter\expandafter\def% @@ -5480,7 +5577,7 @@ \expandafter{\@tmpa}}% \expandafter\cref@writescript\@tmpa% % \end{macrocode} -% \cmd{\cref@}\meta{type}|@name@plural| substitution rules. +% \cmd{\cref@\meta{type}@name@plural} substitution rules. % \begin{macrocode} \edef\@tmpa{\cref@stack@top{\@tmpstack}}% \expandafter\expandafter\expandafter\def% @@ -5498,7 +5595,7 @@ \expandafter{\@tmpa}}% \expandafter\cref@writescript\@tmpa% % \end{macrocode} -% \cmd{\Cref@}\meta{type}|@name| substitution rules. +% \cmd{\Cref@\meta{type}@name} substitution rules. % \begin{macrocode} \edef\@tmpa{\cref@stack@top{\@tmpstack}}% \expandafter\expandafter\expandafter\def% @@ -5515,7 +5612,7 @@ \expandafter{\@tmpa}}% \expandafter\cref@writescript\@tmpa% % \end{macrocode} -% \cmd{\Cref@}\meta{type}|@name@plural| substitution rules. +% \cmd{\Cref@\meta{type}@name@plural} substitution rules. % \begin{macrocode} \edef\@tmpa{\cref@stack@top{\@tmpstack}}% \expandafter\expandafter\expandafter\def% @@ -6171,20 +6268,20 @@ % % % Passing a language option to \package{cleveref} defines the -% cross-reference names and conjunctions as appropriate for that -% lanauge. We can't make the definitions straight away, since they would -% prevent the automatic definition of the other capitalisation variant -% from working if the user chooses to change a default definition in the -% preamble, so we postpone them until the beginning of the -% document. However, if each language option were to simply to define any -% formats that aren't already defined by the end of the preamble, the -% \emph{first} language option would override all the -% others. Unfortunately, the convention in \LaTeX{} and \package{babel} -% is for the \emph{last} language option to take precedence. So we -% instead used the \cmd{\crefname@preamble} command to save the -% definitions in |\cref@\meta{type}@name@preamble| etc., and after all -% the language options have been processed, use the contents of these to -% set the default definitions for any undefined formats. +% cross-reference names and conjunctions as appropriate for that lanauge. +% We can't make the definitions straight away, since they would prevent +% the automatic definition of the other capitalisation variant from +% working if the user chooses to change a default definition in the +% preamble, so we postpone them until the beginning of the document. +% However, if each language option were to simply to define any formats +% that aren't already defined by the end of the preamble, the +% \emph{first} language option would override all the others. +% Unfortunately, the convention in \LaTeX{} and \package{babel} is for +% the \emph{last} language option to take precedence. So we instead used +% the \cmd{\crefname@preamble} command to save the definitions in +% |\cref@|\meta{type}|@name@preamble| etc., and after all the language +% options have been processed, use the contents of these to set the +% default definitions for any undefined formats. % % For \package{babel} support, we add the appropriate redefinitions to % the\linebreak[4] |\extras|\meta{language} macro, which is called by @@ -6462,7 +6559,7 @@ \Crefname@preamble{remark}{Bemerkung}{Bemerkungen}% \Crefname@preamble{note}{Anmerkung}{Anmerkungen}% \Crefname@preamble{algorithm}{Algorithmus}{Algorithmen}% - \Crefname@preamble{line}{Linie}{Linien}% + \Crefname@preamble{line}{Zeile}{Zeilen}% \if@cref@capitalise% \crefname@preamble{equation}{Gleichung}{Gleichungen}% \crefname@preamble{part}{Teil}{Teilen}% @@ -6483,7 +6580,7 @@ \crefname@preamble{remark}{Bemerkung}{Bemerkungen}% \crefname@preamble{note}{Anmerkung}{Anmerkungen}% \crefname@preamble{algorithm}{Algorithmus}{Algorithmen}% - \crefname@preamble{line}{Linie}{Linien}% + \crefname@preamble{line}{Zeile}{Zeilen}% \else% \crefname@preamble{equation}{Gleichung}{Gleichungen}% \crefname@preamble{part}{Teil}{Teilen}% @@ -6503,8 +6600,8 @@ \crefname@preamble{example}{Beispiel}{Beispiele}% \crefname@preamble{remark}{Bemerkung}{Bemerkungen}% \crefname@preamble{note}{Anmerkung}{Anmerkungen}% - \crefname@preamble{algorithm}{algorithmus}{algorithmen}% - \crefname@preamble{line}{linie}{linien}% + \crefname@preamble{algorithm}{Algorithmus}{Algorithmen}% + \crefname@preamble{line}{Zeile}{Zeilen}% \fi% \def\cref@language{german}% % \end{macrocode} @@ -6553,7 +6650,7 @@ \Crefname{remark}{Bemerkung}{Bemerkungen}% \Crefname{note}{Anmerkung}{Anmerkungen}% \Crefname{algorithm}{Algorithmus}{Algorithmen}% - \Crefname{line}{Linie}{Linien}% + \Crefname{line}{Zeile}{Zeilen}% \if@cref@capitalise% \crefname{equation}{Gleichung}{Gleichungen}% \crefname{part}{Teil}{Teilen}% @@ -6585,7 +6682,7 @@ \crefname{remark}{Bemerkung}{Bemerkungen}% \crefname{note}{Anmerkung}{Anmerkungen}% \crefname{algorithm}{Algorithmus}{Algorithmen}% - \crefname{line}{Linie}{Linien}% + \crefname{line}{Zeile}{Zeilen}% \else% \crefname{equation}{Gleichung}{Gleichungen}% \crefname{part}{Teil}{Teilen}% @@ -6617,7 +6714,7 @@ \crefname{remark}{Bemerkung}{Bemerkungen}% \crefname{note}{Anmerkung}{Anmerkungen}% \crefname{algorithm}{Algorithmus}{Algorithmen}% - \crefname{line}{Linie}{Linien}% + \crefname{line}{Zeile}{Zeilen}% \fi% }}} % \end{macrocode} @@ -6676,7 +6773,7 @@ \Crefname{remark}{Bemerkung}{Bemerkungen}% \Crefname{note}{Anmerkung}{Anmerkungen}% \Crefname{algorithm}{Algorithmus}{Algorithmen}% - \Crefname{line}{Linie}{Linien}% + \Crefname{line}{Zeile}{Zeilen}% \if@cref@capitalise% \crefname{equation}{Gleichung}{Gleichungen}% \crefname{part}{Teil}{Teilen}% @@ -6708,7 +6805,7 @@ \crefname{remark}{Bemerkung}{Bemerkungen}% \crefname{note}{Anmerkung}{Anmerkungen}% \crefname{algorithm}{Algorithmus}{Algorithmen}% - \crefname{line}{Linie}{Linien}% + \crefname{line}{Zeile}{Zeilen}% \else% \crefname{equation}{Gleichung}{Gleichungen}% \crefname{part}{Teil}{Teilen}% @@ -6740,7 +6837,7 @@ \crefname{remark}{Bemerkung}{Bemerkungen}% \crefname{note}{Anmerkung}{Anmerkungen}% \crefname{algorithm}{Algorithmus}{Algorithmen}% - \crefname{line}{Linie}{Linien}% + \crefname{line}{Zeile}{Zeilen}% \fi% }}} % \end{macrocode} @@ -6960,7 +7057,7 @@ \Crefname@preamble{part}{Partie}{Parties}% \Crefname@preamble{chapter}{Chapitre}{Chapitres}% \Crefname@preamble{section}{Section}{Sections}% - \Crefname@preamble{appendix}{Appendice}{Appendices}% + \Crefname@preamble{appendix}{Annexe}{Annexes}% \Crefname@preamble{enumi}{Point}{Points}% \Crefname@preamble{footnote}{Note}{Notes}% \Crefname@preamble{figure}{Figure}{Figures}% @@ -6980,7 +7077,7 @@ \crefname@preamble{part}{Partie}{Parties}% \crefname@preamble{chapter}{Chapitre}{Chapitres}% \crefname@preamble{section}{Section}{Sections}% - \crefname@preamble{appendix}{Appendice}{Appendices}% + \crefname@preamble{appendix}{Annexe}{Annexes}% \crefname@preamble{enumi}{Point}{Points}% \crefname@preamble{footnote}{Note}{Notes}% \crefname@preamble{figure}{Figure}{Figures}% @@ -7001,7 +7098,7 @@ \crefname@preamble{part}{partie}{parties}% \crefname@preamble{chapter}{chapitre}{chapitres}% \crefname@preamble{section}{section}{sections}% - \crefname@preamble{appendix}{appendice}{appendices}% + \crefname@preamble{appendix}{annexe}{annexes}% \crefname@preamble{enumi}{point}{points}% \crefname@preamble{footnote}{note}{notes}% \crefname@preamble{figure}{figure}{figures}% @@ -7041,10 +7138,10 @@ \Crefname{section}{Section}{Sections}% \Crefname{subsection}{Section}{Sections}% \Crefname{subsubsection}{Section}{Sections}% - \Crefname{appendix}{Appendice}{Appendices}% - \Crefname{subappendix}{Appendice}{Appendices}% - \Crefname{subsubappendix}{Appendice}{Appendices}% - \Crefname{subsubsubappendix}{Appendice}{Appendices}% + \Crefname{appendix}{Annexe}{Annexes}% + \Crefname{subappendix}{Annexe}{Annexes}% + \Crefname{subsubappendix}{Annexe}{Annexes}% + \Crefname{subsubsubappendix}{Annexe}{Annexes}% \Crefname{enumi}{Point}{Points}% \Crefname{enumii}{Point}{Points}% \Crefname{enumiii}{Point}{Points}% @@ -7073,10 +7170,10 @@ \crefname{section}{Section}{Sections}% \crefname{subsection}{Section}{Sections}% \crefname{subsubsection}{Section}{Sections}% - \crefname{appendix}{Appendice}{Appendices}% - \crefname{subappendix}{Appendice}{Appendices}% - \crefname{subsubappendix}{Appendice}{Appendices}% - \crefname{subsubsubappendix}{Appendice}{Appendices}% + \crefname{appendix}{Annexe}{Annexes}% + \crefname{subappendix}{Annexe}{Annexes}% + \crefname{subsubappendix}{Annexe}{Annexes}% + \crefname{subsubsubappendix}{Annexe}{Annexes}% \crefname{enumi}{Point}{Points}% \crefname{enumii}{Point}{Points}% \crefname{enumiii}{Point}{Points}% @@ -7105,10 +7202,10 @@ \crefname{section}{section}{sections}% \crefname{subsection}{section}{sections}% \crefname{subsubsection}{section}{sections}% - \crefname{appendix}{appendice}{appendices}% - \crefname{subappendix}{appendice}{appendices}% - \crefname{subsubappendix}{appendice}{appendices}% - \crefname{subsubsubappendix}{appendice}{appendices}% + \crefname{appendix}{annexe}{annexes}% + \crefname{subappendix}{annexe}{annexes}% + \crefname{subsubappendix}{annexe}{annexes}% + \crefname{subsubsubappendix}{annexe}{annexes}% \crefname{enumi}{point}{points}% \crefname{enumii}{point}{points}% \crefname{enumiii}{point}{points}% @@ -7542,7 +7639,6 @@ % \end{macrocode} % % -% % \begin{macro}{russian} % Russian translations generously contributed by Aleksander Gorohovski. % \end{macro} @@ -8027,7 +8123,6 @@ % \end{macrocode} % % -% % \begin{macro}{ukrainian} % Ukrainian translations courtesy of Aleksander Gorohovski. % \end{macro} @@ -8508,6 +8603,212 @@ % \end{macrocode} % % +% \begin{macro}{norsk} +% Norwegian translations kindly donated by Sveinung Heggen. +% \end{macro} +% \begin{macrocode} +\DeclareOption{norsk}{% + \PackageInfo{cleveref}{loaded norsk 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{ til\nobreakspace}% + \def\crefrangepreconjunction@preamble{}% + \def\crefrangepostconjunction@preamble{}% + \def\crefpairconjunction@preamble{ og\nobreakspace}% + \def\crefmiddleconjunction@preamble{, }% + \def\creflastconjunction@preamble{ og\nobreakspace}% +% \end{macrocode} +% We have to define the group conjunctions explicitly here, rather than +% relying on fall-back definitions in terms of the above conjunctions +% (see \cref{sec:code:default_formats}), in case any other language +% option defines them explicitly and we need to override those. +% \begin{macrocode} + \def\crefpairgroupconjunction@preamble{ og\nobreakspace}% + \def\crefmiddlegroupconjunction@preamble{, }% + \def\creflastgroupconjunction@preamble{ og\nobreakspace}% + \Crefname@preamble{equation}{Likning}{Likninger}% + \Crefname@preamble{part}{Del}{Deler}% + \Crefname@preamble{chapter}{Kapittel}{Kapitler}% + \Crefname@preamble{section}{Avsnitt}{Avsnitt}% + \Crefname@preamble{appendix}{Tillegg}{Tillegg}% + \Crefname@preamble{enumi}{Punkt}{Punkter}% + \Crefname@preamble{footnote}{Fotnote}{Fotnoter}% + \Crefname@preamble{figure}{Figur}{Figurer}% + \Crefname@preamble{table}{Tabell}{Tabeller}% + \Crefname@preamble{theorem}{Teorem}{Teoremer}% + \Crefname@preamble{lemma}{Lemma}{Lemma}% + \Crefname@preamble{corollary}{Korollar}{Korollarer}% + \Crefname@preamble{proposition}{P\aa stand}{P\aa stander}% + \Crefname@preamble{definition}{Definisjon}{Definisjoner}% + \Crefname@preamble{result}{Resultat}{Resultat}% + \Crefname@preamble{example}{Eksempel}{Eksempler}% + \Crefname@preamble{remark}{Bemerkning}{Bemerkninger}% + \Crefname@preamble{note}{Note}{Noter}% + \Crefname@preamble{algorithm}{Algoritme }{Algoritmer}% + \Crefname@preamble{line}{Linje}{Linjer}% + \if@cref@capitalise% + \crefname@preamble{equation}{Likning}{Likninger}% + \crefname@preamble{part}{Del}{Deler}% + \crefname@preamble{chapter}{Kapittel}{Kapitler}% + \crefname@preamble{section}{Avsnitt}{Avsnitt}% + \crefname@preamble{appendix}{Tillegg}{Tillegg}% + \crefname@preamble{enumi}{Punkt}{Punkter}% + \crefname@preamble{footnote}{Fotnote}{Fotnoter}% + \crefname@preamble{figure}{Figur}{Figurer}% + \crefname@preamble{table}{Tabell}{Tabeller}% + \crefname@preamble{theorem}{Teorem}{Teoremer}% + \crefname@preamble{lemma}{Lemma}{Lemma}% + \crefname@preamble{corollary}{Korollar}{Korollarer}% + \crefname@preamble{proposition}{P\aa stand}{P\aa stander}% + \crefname@preamble{definition}{Definisjon}{Definisjoner}% + \crefname@preamble{result}{Resultat}{Resultater}% + \crefname@preamble{example}{Eksempel}{Eksempler}% + \crefname@preamble{remark}{Bemerkning}{Bemerkninger}% + \crefname@preamble{note}{Note}{Noter}% + \crefname@preamble{algorithm}{Algoritme}{Algoritmer}% + \crefname@preamble{line}{Linje}{Linjer}% + \else% + \crefname@preamble{equation}{likning}{likninger}% + \crefname@preamble{part}{del}{deler}% + \crefname@preamble{chapter}{kapittel}{kapitler}% + \crefname@preamble{section}{avsnitt}{avsnitt}% + \crefname@preamble{appendix}{tillegg}{tillegg}% + \crefname@preamble{enumi}{punkt}{punkter}% + \crefname@preamble{footnote}{fotnote}{fotnoter}% + \crefname@preamble{figure}{figur}{figurer}% + \crefname@preamble{table}{tabell}{tabeller}% + \crefname@preamble{theorem}{teorem}{teoremer}% + \crefname@preamble{lemma}{lemma}{lemma}% + \crefname@preamble{corollary}{korollar}{korollarer}% + \crefname@preamble{proposition}{p\aa stand}{p\aa stander}% + \crefname@preamble{definition}{definisjon}{definisjoner}% + \crefname@preamble{result}{resultat}{resultater}% + \crefname@preamble{example}{eksempel}{eksempler}% + \crefname@preamble{remark}{bemerkning}{bemerkninger}% + \crefname@preamble{note}{note}{noter}% + \crefname@preamble{algorithm}{algoritme}{algoritmer}% + \crefname@preamble{line}{linje}{linjer}% + \fi% + \def\cref@language{norsk}% +% \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\extrasnorsk{% + \renewcommand{\crefrangeconjunction}{ til\nobreakspace}% + \renewcommand\crefrangepreconjunction{}% + \renewcommand\crefrangepostconjunction{}% + \renewcommand{\crefpairconjunction}{ og\nobreakspace}% + \renewcommand{\crefmiddleconjunction}{, }% + \renewcommand{\creflastconjunction}{ og\nobreakspace}% + \renewcommand{\crefpairgroupconjunction}{ og\nobreakspace}% + \renewcommand{\crefmiddlegroupconjunction}{, }% + \renewcommand{\creflastgroupconjunction}{ og\nobreakspace}% + \Crefname{equation}{Likning}{Likninger}% + \Crefname{part}{Del}{Deler}% + \Crefname{chapter}{Kapittel}{Kapitler}% + \Crefname{section}{Avsnitt}{Avsnitt}% + \Crefname{subsection}{Avsnitt}{Avsnitt}% + \Crefname{subsubsection}{Avsnitt}{Avsnitt}% + \Crefname{appendix}{Tillegg}{Tillegg}% + \Crefname{subappendix}{Tillegg}{Tillegg}% + \Crefname{subsubappendix}{Tillegg}{Tillegg}% + \Crefname{subsubsubappendix}{Tillegg}{Tillegg}% + \Crefname{enumi}{Punkt}{Punkter}% + \Crefname{enumii}{Punkt}{Punkter}% + \Crefname{enumiii}{Punkt}{Punkter}% + \Crefname{enumiv}{Punkt}{Punkter}% + \Crefname{enumv}{Punkt}{Punkter}% + \Crefname{footnote}{Fotnote}{Fotnoter}% + \Crefname{figure}{Figur}{Figurer}% + \Crefname{subfigure}{Figur}{Figurer}% + \Crefname{table}{Tabell}{Tabeller}% + \Crefname{subtable}{Tabell}{Tabeller}% + \Crefname{theorem}{Teorem}{Teoremer}% + \Crefname{lemma}{Lemma}{Lemma}% + \Crefname{corollary}{Korollar}{Korollarer}% + \Crefname{proposition}{P\aa stand}{P\aa stander}% + \Crefname{definition}{Definisjon}{Definisjoner}% + \Crefname{result}{Resultat}{Resultater}% + \Crefname{example}{Eksempel}{Eksempler}% + \Crefname{remark}{Bemerkning}{Bemerkninger}% + \Crefname{note}{Note}{Noter}% + \Crefname{algorithm}{Algoritme}{Algoritmer}% + \Crefname{line}{Linje}{Linjer}% + \if@cref@capitalise% + \crefname{equation}{Likning}{Likninger}% + \crefname{part}{Del}{Deler}% + \crefname{chapter}{Kapittel}{Kapitler}% + \crefname{section}{Avsnitt}{Avsnitt}% + \crefname{subsection}{Avsnitt}{Avsnitt}% + \crefname{subsubsection}{Avsnitt}{Avsnitt}% + \crefname{appendix}{Tillegg}{Tillegg}% + \crefname{subappendix}{Tillegg}{Tillegg}% + \crefname{subsubappendix}{Tillegg}{Tillegg}% + \crefname{subsubsubappendix}{Tillegg}{Tillegg}% + \crefname{enumi}{Punkt}{Punkter}% + \crefname{enumii}{Punkt}{Punkter}% + \crefname{enumiii}{Punkt}{Punkter}% + \crefname{enumiv}{Punkt}{Punkter}% + \crefname{enumv}{Punkt}{Punkter}% + \crefname{footnote}{Fotnote}{Fotnoter}% + \crefname{figure}{Figur}{Figurer}% + \crefname{subfigure}{Figur}{Figurer}% + \crefname{table}{Tabell}{Tabeller}% + \crefname{subtable}{Tabell}{Tabeller}% + \crefname{theorem}{Teorem}{Teoremer}% + \crefname{lemma}{Lemma}{Lemma}% + \crefname{corollary}{Korollar}{Korollarer}% + \crefname{proposition}{P\aa stand}{P\aa stand}% + \crefname{definition}{Definisjon}{Definisjoner}% + \crefname{result}{Resultat}{Resultat}% + \crefname{example}{Eksempel}{Eksempler}% + \crefname{remark}{Merknad}{Bemerkninger}% + \crefname{note}{Note}{Noter}% + \crefname{algorithm}{Algoritme}{Algoritmer}% + \crefname{line}{Linje}{Linjer}% + \else% + \crefname{equation}{likning}{likninger}% + \crefname{part}{del}{deler}% + \crefname{chapter}{kapittel}{kapitler}% + \crefname{section}{avsnitt}{avsnitt}% + \crefname{subsection}{avsnitt}{avsnitt}% + \crefname{subsubsection}{avsnitt}{avsnitt}% + \crefname{appendix}{tillegg}{tillegg}% + \crefname{subappendix}{tillegg}{tillegg}% + \crefname{subsubappendix}{tillegg}{tillegg}% + \crefname{subsubsubappendix}{tillegg}{tillegg}% + \crefname{enumi}{punkt}{punkter}% + \crefname{enumii}{punkt}{punkter}% + \crefname{enumiii}{punkt}{punkter}% + \crefname{enumiv}{punkt}{punkter}% + \crefname{enumv}{punkt}{punkter}% + \crefname{footnote}{fotnote}{fotnoter}% + \crefname{figure}{figur}{figurer}% + \crefname{subfigure}{figur}{figurer}% + \crefname{table}{tabell}{tabeller}% + \crefname{subtable}{tabell}{tabell}% + \crefname{theorem}{teorem}{teoremer}% + \crefname{lemma}{lemma}{lemma}% + \crefname{corollary}{korollar}{korollarer}% + \crefname{proposition}{p\aa stand}{p\aa stand}% + \crefname{definition}{definisjon}{definisjoner}% + \crefname{result}{resultat}{resultater}% + \crefname{example}{eksempel}{eksempler}% + \crefname{remark}{bemerkning}{bemerkninger}% + \crefname{note}{note}{noter}% + \crefname{algorithm}{algoritme}{algoritmer}% + \crefname{line}{linje}{linjer}% + \fi% + }}} +% \end{macrocode} +% +% % % \subsubsection{Default Cross-Reference Formats} % \label{sec:code:default_formats} -- cgit v1.2.3