diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/csquotes/csquotes.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/csquotes/csquotes.sty | 966 |
1 files changed, 366 insertions, 600 deletions
diff --git a/Master/texmf-dist/tex/latex/csquotes/csquotes.sty b/Master/texmf-dist/tex/latex/csquotes/csquotes.sty index 4135e979135..11e7f7e24bf 100644 --- a/Master/texmf-dist/tex/latex/csquotes/csquotes.sty +++ b/Master/texmf-dist/tex/latex/csquotes/csquotes.sty @@ -1,21 +1,25 @@ -% $Id: csquotes.sty,v 3.8 2008/01/05 17:58:56 lehman stable $ +% $Id: csquotes.sty,v 4.0 2008/03/02 15:07:53 lehman stable $ -% Copyright (c) 2003--2008 Philipp Lehman, author-maintained. +% Copyright (c) 2003-2008 Philipp Lehman. % % Permission is granted to copy, distribute and/or modify this % software under the terms of the LaTeX Project Public License % (LPPL), version 1.3. % -% This software is provided `as is', without warranty of any kind, +% The LPPL maintenance status of this software is +% 'author-maintained'. +% +% This software is provided 'as is', without warranty of any kind, % either expressed or implied, including, but not limited to, the -% implied warranties of merchantability and fitness for a particular -% purpose. +% implied warranties of merchantability and fitness for a +% particular purpose. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{csquotes}[2008/01/05 v3.8 quotation facilities] +\ProvidesPackage{csquotes}[2008/03/02 v4.0 context-sensitive quotations] %% Compatibility and requirements +\RequirePackage{etoolbox} \RequirePackage{keyval} \@ifpackageloaded{inputenc} @@ -23,9 +27,9 @@ {\AtBeginDocument{% \@ifpackageloaded{inputenc} {\csq@warning - {Load `inputenc' before `csquotes'} - {`inputenc' package loaded too late} - {Always load `inputenc' before `csquotes'}} + {Load 'inputenc' before 'csquotes'} + {'inputenc' package loaded too late} + {Always load 'inputenc' before 'csquotes'}} {}}} \@ifpackageloaded{ucs} @@ -42,12 +46,6 @@ \def\do#1{\noexpand\do\noexpand#1{\the\catcode`#1}} \edef\csq@docatcodes{\csq@docatcodes} -\AtEndOfPackage{% - \def\do#1#2{\catcode`#1=#2\relax} - \csq@docatcodes - \let\csq@docatcodes\@undefined - \let\do\noexpand} - \catcode`\~=\active \catcode`\&=3 \catcode`\:=12 @@ -65,61 +63,9 @@ \newcount\csq@qlevel \newcount\csq@tshold -\def\csq@ifcsundefined#1{% - \begingroup - \expandafter\ifx\csname#1\endcsname\relax - \endgroup\expandafter\@firstoftwo - \else - \endgroup\expandafter\@secondoftwo - \fi} - -\def\csq@ifundefined#1{% - \begingroup - \escapechar\m@ne - \expandafter\csq@ifcsundefined - \expandafter{\string#1} - {\endgroup\@firstoftwo} - {\endgroup\@secondoftwo}} - \providecommand{\@gobblethree}[3]{} \providecommand{\@gobblefive}[5]{} -% Hook management (and some syntactic sugar) - -\long\def\csq@add#1#2{% - \csq@ifundefined{#1}{\let#1\@empty}{}% - \begingroup - \toks@=\expandafter{#1#2}% - \edef#1{\endgroup\def\noexpand#1{\the\toks@}}#1} - -\long\def\csq@eadd#1#2{% - \csq@ifundefined{#1}{\let#1\@empty}{}% - \begingroup - \toks@=\expandafter{#1}% - \edef#1{\endgroup\def\noexpand#1{\the\toks@#2}}#1} - -\long\def\csq@gadd#1{% - \csq@ifundefined{#1}{\let#1\@empty}{}% - \g@addto@macro#1} - -\long\def\csq@xadd#1#2{% - \csq@ifundefined{#1}{\let#1\@empty}{}% - \begingroup - \toks@=\expandafter{#1}% - \xdef#1{\the\toks@#2}% - \endgroup} - -\def\csq@csdef#1{\expandafter\def\csname#1\endcsname} -\def\csq@csedef#1{\expandafter\edef\csname#1\endcsname} -\def\csq@csgdef#1{\expandafter\gdef\csname#1\endcsname} -\def\csq@csxdef#1{\expandafter\xdef\csname#1\endcsname} -\def\csq@csgadd#1{\expandafter\csq@gadd\csname#1\endcsname} -\def\csq@csxadd#1{\expandafter\csq@xadd\csname#1\endcsname} - -\def\csq@cslet#1#2{\expandafter\let\csname#1\endcsname#2} -\def\csq@letcs#1#2{\expandafter\let\expandafter#1\csname#2\endcsname} -\def\csq@csletcs#1{\expandafter\csq@letcs\csname#1\endcsname} - % {<item>}{<list>}{<separator>} \def\csq@addto@list#1{% @@ -129,7 +75,7 @@ \@tempswatrue \def#3##1{\ifnum`#1=`##1\relax\@tempswafalse\fi}#2% \expandafter\endgroup\if@tempswa - \csq@add#2{#3#1}% + \appto#2{#3#1}% \fi} \newtoks\csq@ltxeverypar @@ -142,10 +88,6 @@ % Miscellaneous tests -\long\def\csq@ifblank#1{% from url.sty - \csq@ifblank@i#1&&\@secondoftwo\@firstoftwo:} -\long\def\csq@ifblank@i#1#2#4#5:{#4} - \newcommand*{\ifblockquote}{% \ifcsq@block \expandafter\@firstoftwo @@ -198,60 +140,69 @@ \def\csq@string#1{\csq@string@i#1&} \def\csq@string@i#1#2&{% - \string#1\csq@ifblank{#2}{}{\csq@string@i#2&}} + \string#1\ifblank{#2}{}{\csq@string@i#2&}} \def\csq@number#1{\csq@number@i#1&} \def\csq@number@i#1#2&{% - \number`#1 \csq@ifblank{#2}{}{.\csq@number@i#2&}} + \number`#1 \ifblank{#2}{}{.\csq@number@i#2&}} \def\csq@utfprint#1{u8:\csq@utfprint@i#1&} \def\csq@utfprint@i#1#2&{% - \number`#1 \csq@ifblank{#2}{}{:\csq@utfprint@i#2&}} + \number`#1 \ifblank{#2}{}{:\csq@utfprint@i#2&}} % Grouping control -\csq@ifcsundefined{eTeXversion} - {\let\csq@bqgroup\begingroup - \let\csq@eqgroup\endgroup} - {\def\csq@bqgroup{% - \bgroup\leavevmode - \csq@glevel\currentgrouplevel - \csq@gtype\currentgrouptype} - \def\csq@eqgroup{% - \ifnum\csq@gtype=\currentgrouptype - \ifnum\csq@glevel=\currentgrouplevel - \else - \csq@err@mismatch{% - I have detected a group level mismatch. Verify that all - groups\MessageBreak and all active quotes are properly - balanced and nested. If you\MessageBreak continue, I - will write a summary of all previously opened - groups\MessageBreak to the transcript file}% - \aftergroup\showgroups - \fi - \else - \csq@err@mismatch{% - I have detected a group type mismatch. Verify that all - groups\MessageBreak and all active quotes are properly - balanced and nested. If you\MessageBreak continue, I - will write a summary of all previously opened - groups\MessageBreak to the transcript file}% - \aftergroup\showgroups - \fi - \egroup}} +\protected\def\csq@bqgroup{% + \bgroup\leavevmode + \csq@glevel\currentgrouplevel + \csq@gtype\currentgrouptype} + +\protected\def\csq@eqgroup{% + \ifnum\csq@gtype=\currentgrouptype + \ifnum\csq@glevel=\currentgrouplevel + \else + \csq@mismatch{% + I have detected a group level mismatch. Verify that all + groups\MessageBreak and all active quotes are properly + balanced and nested. If you\MessageBreak continue, I + will write a summary of all previously opened + groups\MessageBreak to the transcript file}% + \showgroups + \fi + \else + \csq@mismatch{% + I have detected a group type mismatch. Verify that all + groups\MessageBreak and all active quotes are properly + balanced and nested. If you\MessageBreak continue, I + will write a summary of all previously opened + groups\MessageBreak to the transcript file}% + \showgroups + \fi + \egroup} + +\AtEndDocument{% + \ifnum\csq@qlevel>\z@ + \csq@err@mismatch{% + Still some open quote group(s); the current + level is \the\csq@qlevel.\MessageBreak + If you continue, I will write a summary of all + previously\MessageBreak opened groups to the + transcript file}% + \showgroups + \fi} %% User feedback -\def\csq@error#1#2{% +\protected\def\csq@error#1#2{% \PackageError{csquotes}{#1}{#2.}} -\def\csq@warning@loose#1#2#3{% +\protected\def\csq@warning@loose#1#2#3{% \PackageWarning{csquotes}{#1}} -\def\csq@warning@strict#1#2#3{% +\protected\def\csq@warning@strict#1#2#3{% \PackageError{csquotes}{#2}{#3.}} \let\csq@warning\csq@warning@loose -\def\csq@info#1{% +\protected\def\csq@info#1{% \ifcsq@quiet \else \PackageInfo{csquotes}{#1\csq@noline}% @@ -262,37 +213,40 @@ % Errors -\def\csq@err@mismatch#1{% +\protected\def\csq@mismatch{% \csq@errormark + \csq@err@mismatch} + +\protected\def\csq@err@mismatch#1{% \csq@error {Unbalanced groups or invalid nesting} {#1}} -\def\csq@err@mmode#1{% +\protected\def\csq@err@mmode#1{% \csq@error - {`\string#1' invalid in math mode} + {'\string#1' invalid in math mode} {This command may not be used in math mode}} -\def\csq@err@notdef#1{% +\protected\def\csq@err@notdef#1{% \csq@error - {`\string#1' not defined} + {'\string#1' not defined} {This command or environment environment appears to be\MessageBreak undefined}} -\def\csq@err@invldopt#1{% +\protected\def\csq@err@invldopt#1{% \csq@error - {Option `#1' invalid} + {Option '#1' invalid} {The option you have supplied is invalid. See the csquotes manual\MessageBreak for valid option keys and their possible values}} -\def\csq@err@alloc{% +\protected\def\csq@err@alloc{% \csq@error {Invalid argument} {One of the arguments you have supplied is already allocated as\MessageBreak active quote or delimiter}} -\def\csq@err@invldchar{% +\protected\def\csq@err@invldchar{% \csq@error {Invalid argument} {Only single characters with category code 12 or 13 may @@ -301,66 +255,59 @@ are part of the LaTeX syntax or reserved\MessageBreak for a specific purpose are invalid}} -\def\csq@err@invldutf{% +\protected\def\csq@err@invldutf{% \csq@error {Invalid argument} {Only valid UTF-8 sequences representing a single character\MessageBreak may be allocated as active quotes}} -\def\csq@err@ucs{% +\protected\def\csq@err@ucs{% \csq@error {ucs package not supported} {The ucs package is not supported. If you want to use UTF-8\MessageBreak encoded active quotes, try - `\string\usepackage[utf8]{inputenc}'.\MessageBreak + '\string\usepackage[utf8]{inputenc}'.\MessageBreak If you continue now, I will reject all UTF-8 encoded arguments\MessageBreak as invalid}} -\def\csq@err@nbquote{% - \csq@err@mismatch{% +\protected\def\csq@err@nbquote{% + \csq@mismatch{% You have nested a block quotation. Block quotation commands\MessageBreak may only be used on quotation level 0}}% % Warnings -\def\csq@warn@nobabel#1{% +\protected\def\csq@warn@nobabel#1{% \csq@warning - {The `babel' package is not available.\MessageBreak #1} + {The 'babel' package is not available.\MessageBreak #1} {#1} - {Load the `babel' package to use this feature}} - -\def\csq@warn@noomega#1{% - \csq@warning - {Quote style `#1' requires Omega.\MessageBreak - Some features will be missing} - {Quote style `#1' requires Omega} - {Compile the document with `lambda' instead of `latex'}} + {Load the 'babel' package to use this feature}} -\def\csq@warn@location#1{% +\protected\def\csq@warn@location#1{% \csq@warning - {`\string#1' invalid at this point.\MessageBreak + {'\string#1' invalid at this point.\MessageBreak Ignoring command} - {`\string#1' invalid at this point} + {'\string#1' invalid at this point} {This command may not be used at this particular - point.\MessageBreak See the user manual of the `csquotes' + point.\MessageBreak See the user manual of the 'csquotes' package for details}} -\def\csq@warn@legacy#1#2{% +\protected\def\csq@warn@legacy#1#2{% \csq@warning - {`\string#1' is deprecated.\MessageBreak - Using `\string#2' instead} - {`\string#1' is deprecated} - {Please use `\string#2' instead}% + {'\string#1' is deprecated.\MessageBreak + Using '\string#2' instead} + {'\string#1' is deprecated} + {Please use '\string#2' instead}% \let#1#2#2} %% Opening quotation mark % Outer marks -\def\csq@oqmark{% +\protected\def\csq@oqmark{% \ifnum\csq@qlevel>\z@ - \csq@err@mismatch{% - Level 1 quote group invalid at this point: + \csq@mismatch{% + Level 1 quote group invalid at this point; the current level is \the\csq@qlevel}% \csq@bqgroup \advance\csq@qlevel\@ne @@ -379,10 +326,10 @@ % Inner marks -\def\csq@iqmark{% +\protected\def\csq@iqmark{% \ifnum\csq@qlevel>\@ne - \csq@err@mismatch{% - Level 2 quote group invalid at this point: + \csq@mismatch{% + Level 2 quote group invalid at this point; the current level is \the\csq@qlevel}% \csq@bqgroup \advance\csq@qlevel\@ne @@ -399,13 +346,13 @@ % Nestable marks -\def\csq@qopen{% +\protected\def\csq@qopen{% \csq@bqgroup\csq@qopen@i} -\def\csq@qopen@i{% +\protected\def\csq@qopen@i{% \ifnum\csq@qlevel>\@ne - \csq@err@mismatch{% - New quote group invalid at this point: + \csq@mismatch{% + New quote group invalid at this point; the current level is \the\csq@qlevel}% \advance\csq@qlevel\@ne \else @@ -424,13 +371,13 @@ \fi \fi} -\def\csq@iqopen{% +\protected\def\csq@iqopen{% \csq@bqgroup\csq@iqopen@i} -\def\csq@iqopen@i{% +\protected\def\csq@iqopen@i{% \ifnum\csq@qlevel>\@ne - \csq@err@mismatch{% - Level 2 quote group invalid at this point: + \csq@mismatch{% + Level 2 quote group invalid at this point; the current level is \the\csq@qlevel}% \advance\csq@qlevel\@ne \else @@ -443,7 +390,7 @@ %% Closing quotation mark -\def\csq@qclose{% +\protected\def\csq@qclose{% \ifnum\csq@qlevel=\@ne \ifdim\lastkern=\csq@frenchmark \unkern\unkern @@ -468,14 +415,14 @@ \ifnum\csq@qlevel>\z@ \csq@qerror \else - \csq@err@mismatch{% - Cannot close the current quote group: + \csq@mismatch{% + Cannot close the current quote group; the current level is \the\csq@qlevel}% \fi \fi \fi} -\def\csq@qclose@i{% +\protected\def\csq@qclose@i{% \expandafter\def \expandafter\csq@tempa \expandafter{% @@ -485,7 +432,7 @@ \expandafter{\csq@kerntok@i}}% \csq@tempa} -\def\csq@qerror{% +\protected\def\csq@qerror{% \csq@eqgroup \csq@errormark} @@ -540,7 +487,7 @@ \fi \fi} -\csq@add\@parboxrestore{% +\appto\@parboxrestore{% \let\csq@bquote@i\csq@bquote@iii \csq@qlevel\z@ \csq@blockfalse} @@ -614,18 +561,18 @@ %% Punctuation -% 1001 apostrophe (biblatex) -% 1002 abbreviation dot (biblatex) +% 1001 apostrophe (biblatex only) +% 1002 abbreviation dot (biblatex only) % 1003/1250 comma % 1004/1500 semicolon % 1005/2000 colon % 1006/3000 period % 1007/3001 exclamation mark % 1008/3002 question mark -% 1009 suppress punctuation (biblatex) +% 1009 suppress punctuation (biblatex only) \def\csq@setsfcodes{% - \csq@ifcsundefined{csq@sfcodes@\f@encoding} + \ifcsundef{csq@sfcodes@\f@encoding} {} {\@nameuse{csq@sfcodes@\f@encoding}}% \sfcode`\)=\z@ @@ -681,12 +628,12 @@ \fi \endgroup -\csq@csdef{csq@sfactor@1250}{1003} -\csq@csdef{csq@sfactor@1500}{1004} -\csq@csdef{csq@sfactor@2000}{1005} -\csq@csdef{csq@sfactor@3000}{1006} -\csq@csdef{csq@sfactor@3001}{1007} -\csq@csdef{csq@sfactor@3002}{1008} +\csdef{csq@sfactor@1250}{1003} +\csdef{csq@sfactor@1500}{1004} +\csdef{csq@sfactor@2000}{1005} +\csdef{csq@sfactor@3000}{1006} +\csdef{csq@sfactor@3001}{1007} +\csdef{csq@sfactor@3002}{1008} \def\csq@spacefactor{% \ifhmode @@ -758,10 +705,10 @@ \def\csq@setstyle#1{% \begingroup \let\if@safe@actives\iftrue - \csq@ifcsundefined{csq@qstyle@#1} + \ifcsundef{csq@qstyle@#1} {\csq@warning - {Quote style `#1' not defined.\MessageBreak Ignoring command} - {Quote style `#1' not defined} + {Quote style '#1' not defined.\MessageBreak Ignoring command} + {Quote style '#1' not defined} {Define the style or alias first} \endgroup} {\edef\csq@tempa{\endgroup @@ -773,11 +720,11 @@ \ifnum\csq@reset=\@ne \ifx\csq@currentstyle\languagename \else - \csq@ifcsundefined{csq@qstyle@\languagename} + \ifcsundef{csq@qstyle@\languagename} {\csq@warning - {No style for language `\languagename'.\MessageBreak + {No style for language '\languagename'.\MessageBreak Using fallback style} - {No style for language `\languagename'} + {No style for language '\languagename'} {Define a style or alias for this language first}% \csq@setstyle{fallback}} {\csq@setstyle{\languagename}}% @@ -785,12 +732,12 @@ \fi} \def\csq@savelang{% - \csq@ifcsundefined{csq@mainlang} + \ifundef\csq@mainlang {\edef\csq@mainlang{\languagename}} {}} \def\csq@resetlang{% - \csq@ifcsundefined{csq@mainlang} + \ifundef\csq@mainlang {} {\@nameuse{otherlanguage*}{\csq@mainlang}}} @@ -803,7 +750,7 @@ \def\csq@nolang#1{% \begingroup \lowercase{\def\csq@tempa{#1}}% - \csq@warn@nobabel{Cannot switch to language `\csq@tempa'}% + \csq@warn@nobabel{Cannot switch to language '\csq@tempa'}% \endgroup} \def\csq@hyph#1{% @@ -813,28 +760,29 @@ \def\csq@nohyph#1{% \begingroup \lowercase{\def\csq@tempa{#1}}% - \csq@warn@nobabel{No hyphenation rules for `\csq@tempa'}% + \csq@warn@nobabel{No hyphenation rules for '\csq@tempa'}% \endgroup} \def\csq@hyphenrules#1{% \language\csname l@#1\endcsname\relax - \csq@ifundefined{#1 hyphenmins} + \ifcsundef{#1hyphenmins} {\csq@sethyphenmins\tw@\thr@@} {\expandafter\expandafter\expandafter\csq@sethyphenmins - \csname#1 hyphenmins\endcsname}} + \csname#1hyphenmins\endcsname}} + \def\csq@sethyphenmins#1#2{% \lefthyphenmin#1\relax \righthyphenmin#2\relax} -\csq@add\csq@mkbabel{% - \csq@add\@parboxrestore{\csq@resetlang}% - \csq@ifcsundefined{l@usenglish} - {\csq@ifcsundefined{l@USenglish} +\appto\csq@mkbabel{% + \appto\@parboxrestore{\csq@resetlang}% + \ifundef\l@usenglish + {\ifundef\l@USenglish {} {\let\l@usenglish\l@USenglish}} {}% - \csq@ifcsundefined{l@ukenglish} - {\csq@ifcsundefined{l@UKenglish} + \ifundef\l@ukenglish + {\ifundef\l@UKenglish {} {\let\l@ukenglish\l@UKenglish}} {}% @@ -848,7 +796,7 @@ \DeclareQuoteAlias{\bbl@main@language}{default}% \fi} -\csq@add\csq@mknobabel{% +\appto\csq@mknobabel{% \ifcase\csq@reset \or \csq@warn@nobabel{Cannot enable multilingual support}% @@ -905,7 +853,7 @@ % Plain quotes -\DeclareRobustCommand*{\enquote}{% +\newrobustcmd*{\enquote}{% \csq@ifmmode {\csq@err@mmode\enquote} {\@ifstar @@ -919,7 +867,7 @@ % Plain quotes + babel -\DeclareRobustCommand*{\foreignquote}{% +\newrobustcmd*{\foreignquote}{% \csq@ifmmode {\csq@err@mmode\foreignquote} {\@ifstar\csq@fquote@ii\csq@fquote@i}} @@ -927,7 +875,7 @@ \def\csq@fquote@i#1{\csq@quote@i{\csq@lang{#1}}} \def\csq@fquote@ii#1{\csq@quote@ii{\csq@lang{#1}}} -\DeclareRobustCommand*{\hyphenquote}{% +\newrobustcmd*{\hyphenquote}{% \csq@ifmmode {\csq@err@mmode\hyphenquote} {\@ifstar\csq@hquote@ii\csq@hquote@i}} @@ -960,14 +908,14 @@ {\expandafter\csq@pdf@quote@ii\@gobble} {\csq@pdf@quote@i}} -\csq@add\csq@mkhyperref{% +\appto\csq@mkhyperref{% \let\enquote\csq@pdf@quote \let\foreignquote\csq@pdf@fquote \let\hyphenquote\csq@pdf@fquote} % Text quotes -\DeclareRobustCommand*{\textquote}{% +\newrobustcmd*{\textquote}{% \csq@ifmmode {\csq@err@mmode\textquote} {\@ifstar @@ -982,15 +930,15 @@ \mkpretextpunct{#4}% \csq@qclose \mkmidtextpunct{#4}}% - \csq@ifblank{#3} + \ifblank{#3} {} - {\csq@add\csq@tempa{#2{#3}}}% + {\appto\csq@tempa{#2{#3}}}% #1\quotetext#5\endquotetext \csq@tempa\mkfintextpunct{#4}} % Text quotes + babel -\DeclareRobustCommand*{\foreigntextquote}{% +\newrobustcmd*{\foreigntextquote}{% \csq@ifmmode {\csq@err@mmode\foreigntextquote} {\@ifstar\csq@ftquote@ii\csq@ftquote@i}} @@ -1000,7 +948,7 @@ \def\csq@ftquote@ii#1{% \csq@getcargs{\csq@tquote{\csq@lang{#1}\csq@iqopen@i}}} -\DeclareRobustCommand*{\hyphentextquote}{% +\newrobustcmd*{\hyphentextquote}{% \csq@ifmmode {\csq@err@mmode\hyphentextquote} {\@ifstar\csq@htquote@ii\csq@htquote@i}} @@ -1012,7 +960,7 @@ % Integrated text quotes -\DeclareRobustCommand*{\textcquote}{% +\newrobustcmd*{\textcquote}{% \csq@ifmmode {\csq@err@mmode\textcquote} {\@ifstar @@ -1021,7 +969,7 @@ % Integrated text quotes + babel -\DeclareRobustCommand*{\foreigntextcquote}{% +\newrobustcmd*{\foreigntextcquote}{% \csq@ifmmode {\csq@err@mmode\foreigntextcquote} {\@ifstar\csq@ftcquote@ii\csq@ftcquote@i}} @@ -1031,7 +979,7 @@ \def\csq@ftcquote@ii#1{% \csq@getccargs{\csq@tquote{\csq@lang{#1}\csq@iqopen@i}}} -\DeclareRobustCommand*{\hyphentextcquote}{% +\newrobustcmd*{\hyphentextcquote}{% \csq@ifmmode {\csq@err@mmode\hyphentextcquote} {\@ifstar\csq@htcquote@ii\csq@htcquote@i}} @@ -1043,7 +991,7 @@ % PDF strings -\csq@add\csq@mkhyperref{% +\appto\csq@mkhyperref{% \def\textquote{\pdfstringdefWarn\textquote}% \def\foreigntextquote{\pdfstringdefWarn\foreigntextquote}% \def\hyphentextquote{\pdfstringdefWarn\hyphentextquote}% @@ -1053,7 +1001,7 @@ % Block quotes -\DeclareRobustCommand*{\blockquote}{% +\newrobustcmd*{\blockquote}{% \csq@ifmmode {\csq@err@mmode\blockquote} {\csq@getcargs{\csq@bquote{}}}} @@ -1117,7 +1065,7 @@ \endquoteblock \mkmidblockpunct{#4}% \endgroup - \csq@ifblank{#3} + \ifblank{#3} {} {#2{#3}}% \mkfinblockpunct{#4}% @@ -1129,13 +1077,13 @@ \mkpreblockpunct{#4}% \csq@qclose \mkmidblockpunct{#4}}% - \csq@ifblank{#3} + \ifblank{#3} {} - {\csq@add\csq@tempa{#2{#3}}}% + {\appto\csq@tempa{#2{#3}}}% #1\csq@qopen@i\quotetext#5\endquotetext \csq@tempa\mkfinblockpunct{#4}} -\newcommand*{\BlockquoteDisable}[1]{% +\newrobustcmd*{\BlockquoteDisable}[1]{% \begingroup \toks@=\expandafter{\csq@mkblockquote}% \@temptokena={#1}% @@ -1144,38 +1092,38 @@ % Block quotes + babel -\DeclareRobustCommand*{\foreignblockquote}[1]{% +\newrobustcmd*{\foreignblockquote}[1]{% \csq@ifmmode {\csq@err@mmode\foreignblockquote} {\csq@getcargs{\csq@bquote{\csq@lang{#1}}}}} -\DeclareRobustCommand*{\hyphenblockquote}[1]{% +\newrobustcmd*{\hyphenblockquote}[1]{% \csq@ifmmode {\csq@err@mmode\hyphenblockquote} {\csq@getcargs{\csq@bquote{\csq@hyph{#1}}}}} % Integrated block quotes -\DeclareRobustCommand*{\blockcquote}{% +\newrobustcmd*{\blockcquote}{% \csq@ifmmode {\csq@err@mmode\blockcquote} {\csq@getccargs{\csq@bquote{}}}} % Integrated block quotes + babel -\DeclareRobustCommand*{\foreignblockcquote}[1]{% +\newrobustcmd*{\foreignblockcquote}[1]{% \csq@ifmmode {\csq@err@mmode\foreignblockcquote} {\csq@getccargs{\csq@bquote{\csq@lang{#1}}}}} -\DeclareRobustCommand*{\hyphenblockcquote}[1]{% +\newrobustcmd*{\hyphenblockcquote}[1]{% \csq@ifmmode {\csq@err@mmode\hyphenblockcquote} {\csq@getccargs{\csq@bquote{\csq@hyph{#1}}}}} % PDF strings -\csq@add\csq@mkhyperref{% +\appto\csq@mkhyperref{% \def\blockquote{\pdfstringdefWarn\blockquote}% \def\foreignblockquote{\pdfstringdefWarn\foreignblockquote}% \def\hyphenblockquote{\pdfstringdefWarn\hyphenblockquote}% @@ -1192,7 +1140,7 @@ % {<init>}{<hook>}{<cite>}{<punct>} \def\csq@dquote#1#2#3#4{% - \csq@ifblank{#3} + \ifblank{#3} {\let\csq@tempb\@empty} {\def\csq@tempb{#2{#3}}}% \def\csq@tempc{#4}% @@ -1271,11 +1219,11 @@ % Legacy commands -\newcommand*{\cquote}{% +\newrobustcmd*{\cquote}{% \csq@warn@legacy\cquote\textcquote} -\newcommand*{\foreigncquote}{% +\newrobustcmd*{\foreigncquote}{% \csq@warn@legacy\foreigncquote\foreigntextcquote} -\newcommand*{\hyphencquote}{% +\newrobustcmd*{\hyphencquote}{% \csq@warn@legacy\hyphencquote\hyphentextcquote} %% Markup with active characters @@ -1312,29 +1260,29 @@ \def\csq@do@doutfspecial#1{% \csq@info{Redefining character \csq@utfprint{#1}}% - \csq@csletcs{u8:\csq@string{#1}}{csq@special@\csq@number{#1}}} + \csletcs{u8:\csq@string{#1}}{csq@special@\csq@number{#1}}} \def\csq@do@undoutfspecial#1{% \csq@info{Resetting character \csq@utfprint{#1}}% - \csq@csletcs{u8:\csq@string{#1}}{csq@saved@\csq@number{#1}}} + \csletcs{u8:\csq@string{#1}}{csq@saved@\csq@number{#1}}} \def\csq@do@delspecial#1#2{% \csq@info{Deallocating character \string#1}% - \csq@cslet{csq@special@\number`#1}\@undefined - \csq@cslet{csq@saved@\number`#1}\@undefined - \csq@cslet{csq@string@\number`#1}\@undefined - \csq@cslet{csq@textdef@\number`#1}\@undefined - \csq@cslet{csq@xtxtdef@\number`#1}\@undefined - \csq@cslet{csq@pdfdef@\number`#1}\@undefined} + \csundef{csq@special@\number`#1}% + \csundef{csq@saved@\number`#1}% + \csundef{csq@string@\number`#1}% + \csundef{csq@textdef@\number`#1}% + \csundef{csq@xtxtdef@\number`#1}% + \csundef{csq@pdfdef@\number`#1}} \def\csq@do@delutfspecial#1{% \csq@info{Deallocating character \csq@utfprint{#1}}% - \csq@cslet{csq@special@\csq@number{#1}}\@undefined - \csq@cslet{csq@saved@\csq@number{#1}}\@undefined - \csq@cslet{csq@string@\csq@number{#1}}\@undefined - \csq@cslet{csq@textdef@\csq@number{#1}}\@undefined - \csq@cslet{csq@xtxtdef@\csq@number{#1}}\@undefined - \csq@cslet{csq@pdfdef@\csq@number{#1}}\@undefined} + \csundef{csq@special@\csq@number{#1}}% + \csundef{csq@saved@\csq@number{#1}}% + \csundef{csq@string@\csq@number{#1}}% + \csundef{csq@textdef@\csq@number{#1}}% + \csundef{csq@xtxtdef@\csq@number{#1}}% + \csundef{csq@pdfdef@\csq@number{#1}}} \def\csq@mkenable{% \let\do\csq@do@dospecial @@ -1375,13 +1323,14 @@ \let\csq@mkpdfstrings\@empty} \let\csq@mkpdfstrings\@empty -\csq@add\csq@mkhyperref{\csq@mkpdfstrings} +\appto\csq@mkhyperref{\csq@mkpdfstrings} -\csq@ifcsundefined{inpenc@prehook}% inputenc 2006/05/05 v1.1b +\ifdef\inpenc@prehook % inputenc 2006/05/05 v1.1b + {\AtBeginDocument{% + \addto@hook\inpenc@prehook{% + \csq@info{Input encoding change}% + \csq@mkdelete}}} {} - {\addto@hook\inpenc@prehook{% - \csq@info{Input encoding change}% - \csq@mkdelete}} % Regular specials @@ -1396,18 +1345,18 @@ \def\csq@addspecial@i@s#1#2#3#4#5{% \csq@info{Allocating character \string#1}% - \csq@csedef{csq@special@\number`#1}{\noexpand#2{\number`#1}}% + \csedef{csq@special@\number`#1}{\noexpand#2{\number`#1}}% \ifnum\catcode`#1=\active - \csq@cslet{csq@saved@\number`#1}{#1}% + \cslet{csq@saved@\number`#1}{#1}% \else - \csq@csdef{csq@saved@\number`#1}{#1}% + \csdef{csq@saved@\number`#1}{#1}% \fi - \csq@csedef{csq@string@\number`#1}{\string#1}% - \csq@csdef{csq@textdef@\number`#1}{#3}% - \csq@ifblank{#5} - {\csq@csdef{csq@pdfdef@\number`#1}{#4}} - {\csq@add\csq@mkpdfstrings{\csq@defpspecial{#1}{#4}{#5}}}% - \csq@eadd\csq@dospecials{\noexpand\do{\string#1}{\the\catcode`#1}}% + \csedef{csq@string@\number`#1}{\string#1}% + \csdef{csq@textdef@\number`#1}{#3}% + \ifblank{#5} + {\csdef{csq@pdfdef@\number`#1}{#4}} + {\appto\csq@mkpdfstrings{\csq@defpspecial{#1}{#4}{#5}}}% + \eappto\csq@dospecials{\noexpand\do{\string#1}{\the\catcode`#1}}% \ifnum`#1<128\relax \csq@addto@list{#1}{\dospecials}{\do}% \csq@addto@list{#1}{\@sanitize}{\@makeother}% @@ -1417,21 +1366,21 @@ \def\csq@addspecial@i@u#1#2#3#4#5{% \csq@info{Allocating character \csq@utfprint{#1}}% - \csq@csedef{csq@special@\csq@number{#1}}{% + \csedef{csq@special@\csq@number{#1}}{% \noexpand#2{\csq@number{#1}}}% - \csq@ifcsundefined{u8:\csq@string{#1}} + \ifcsundef{u8:\csq@string{#1}} {\csq@error {\csq@utfprint{#1} not supported by inputenc} {This UTF-8 sequence does not seem to be supported by the inputenc\MessageBreak package}% - \csq@csdef{csq@saved@\csq@number{#1}}{}} - {\csq@csletcs{csq@saved@\csq@number{#1}}{u8:\csq@string{#1}}}% - \csq@csedef{csq@string@\csq@number{#1}}{\csq@string{#1}}% - \csq@csdef{csq@textdef@\csq@number{#1}}{#3}% - \csq@ifblank{#5} - {\csq@csdef{csq@pdfdef@\csq@number{#1}}{#4}} - {\csq@add\csq@mkpdfstrings{\csq@defupspecial{#1}{#4}{#5}}}% - \csq@eadd\csq@doutfspecials{\noexpand\do{\csq@string{#1}}}} + \csdef{csq@saved@\csq@number{#1}}{}} + {\csletcs{csq@saved@\csq@number{#1}}{u8:\csq@string{#1}}}% + \csedef{csq@string@\csq@number{#1}}{\csq@string{#1}}% + \csdef{csq@textdef@\csq@number{#1}}{#3}% + \ifblank{#5} + {\csdef{csq@pdfdef@\csq@number{#1}}{#4}} + {\appto\csq@mkpdfstrings{\csq@defupspecial{#1}{#4}{#5}}}% + \eappto\csq@doutfspecials{\noexpand\do{\csq@string{#1}}}} % Block specials @@ -1445,7 +1394,7 @@ \def\csq@addbspecial@i@s#1#2#3#4{% \begingroup \def\csq@tempa{\endgroup\csq@addspecial@i@s{#1}{\csqBQ}{}}% - \csq@eadd\csq@tempa{% + \eappto\csq@tempa{% {\expandafter\noexpand\csname csq@saved@\number`#1\endcsname \noexpand\pdfstringdefWarn{\string#1}}{}}% \csq@tempa @@ -1456,7 +1405,7 @@ \def\csq@addbspecial@i@u#1#2#3#4{% \begingroup \def\csq@tempa{\endgroup\csq@addspecial@i@u{#1}{\csqBQ}{}}% - \csq@eadd\csq@tempa{% + \eappto\csq@tempa{% {\expandafter\noexpand\csname csq@saved@\csq@number{#1}\endcsname \noexpand\pdfstringdefWarn{\csq@utfprint{#1}}}{}}% \csq@tempa @@ -1470,8 +1419,8 @@ \let\csq@tempa\@empty \def\csq@tempb{{#1}}% \uccode`\~=`#2\relax - \uppercase{\csq@add\csq@tempb{{~}}}% - \csq@add\csq@tempb{{#3}{#4}}% + \uppercase{\appto\csq@tempb{{~}}}% + \appto\csq@tempb{{#3}{#4}}% \csq@validate{#3} {\expandafter\def\expandafter\csq@tempa \expandafter{\expandafter\csq@addbspecial@iii@s\csq@tempb}} @@ -1490,8 +1439,8 @@ \begingroup \def\csq@tempa{{#1}{#2}}% \uccode`\~=`#3\relax - \uppercase{\csq@add\csq@tempa{~}}% - \csq@add\csq@tempa{{#4}}% + \uppercase{\appto\csq@tempa{~}}% + \appto\csq@tempa{{#4}}% \expandafter\endgroup \expandafter\csq@addbspecial@iv\csq@tempa} @@ -1562,16 +1511,12 @@ {\@nameuse{csq@string@#1}} {\noexpand\csqBQend{#1}}}}} -\csq@add\csq@mkhyperref{% - \def\csqQQ##1{\@nameuse{csq@pdfdef@##1}}% - \def\csqBQ##1{\@nameuse{csq@pdfdef@##1}}% - \def\csqBQbeg##1{\@nameuse{csq@pdfdef@##1}}% - \def\csqBQsep##1{\@nameuse{csq@saved@##1}}% - \def\csqBQend##1{\@nameuse{csq@saved@##1}}} - -% Legacy commands - -\def\csq@special{\csqQQ} +\appto\csq@mkhyperref{% + \def\csqQQ#1{\@nameuse{csq@pdfdef@#1}}% + \def\csqBQ#1{\@nameuse{csq@pdfdef@#1}}% + \def\csqBQbeg#1{\@nameuse{csq@pdfdef@#1}}% + \def\csqBQsep#1{\@nameuse{csq@saved@#1}}% + \def\csqBQend#1{\@nameuse{csq@saved@#1}}} % Define specials @@ -1599,7 +1544,7 @@ \long\def\csq@bspecial@i#1#2#3{% \long\def\csq@bspecial@ii##1#2##2&{% - \csq@ifblank{##2} + \ifblank{##2} {#3{}{}{#1}} {\csq@bspecial@iii#1&}}% \long\def\csq@bspecial@iii##1#2##2&{% @@ -1615,7 +1560,7 @@ \long\def\csq@xbspecial@i#1#2{% \long\def\csq@xbspecial@ii##1\csqBQsep##2&{% - \csq@ifblank{##2} + \ifblank{##2} {#2{}{}{#1}} {\csq@xbspecial@iii#1&}}% \long\def\csq@xbspecial@iii##1\csqBQsep##2##3&{% @@ -1641,12 +1586,12 @@ \def\csq@validate#1#2#3{% \csq@ifutfchar{#1} {\csq@ifvalidutf{#1} - {\csq@ifcsundefined{csq@special@\csq@number{#1}} + {\ifcsundef{csq@special@\csq@number{#1}} {#3} {\csq@err@alloc}} {\csq@err@invldutf}} {\csq@ifvalidchar{#1} - {\csq@ifcsundefined{csq@special@\number`#1} + {\ifcsundef{csq@special@\number`#1} {#2} {\csq@err@alloc}} {\csq@err@invldchar}}} @@ -1654,7 +1599,7 @@ % {<char>}{<true>}{<false>} \def\csq@ifutfchar#1{% - \csq@ifcsundefined{@inpenc@undefined} + \ifundef\@inpenc@undefined {\@secondoftwo} {\csq@ifutfenc}% {\csq@ifsingle{#1} @@ -1670,7 +1615,7 @@ {\csq@err@invldchar \@gobbletwo}}} -\csq@ifcsundefined{inputencodingname}% inputenc 2006/05/05 v1.1b +\ifundef\inputencodingname % inputenc 2006/05/05 v1.1b {\def\csq@ifutfenc{% \csq@ifucs {\csq@err@ucs\@secondoftwo} @@ -1697,7 +1642,7 @@ % {<char>}{<true>}{<false>} \long\def\csq@ifsingle#1{% - \csq@ifblank{#1} + \ifblank{#1} {\@secondoftwo} {\expandafter\csq@ifsingle@i \string#1&&\@secondoftwo\@firstoftwo:}} @@ -1735,16 +1680,16 @@ % {<char>}{<true>}{<false>} \def\csq@ifvalidutf#1{% - \csq@ifblank{#1}{\@secondoftwo}{\csq@ifvalidutf@i#1&}} + \ifblank{#1}{\@secondoftwo}{\csq@ifvalidutf@i#1&}} \def\csq@ifvalidutf@i#1#2&{% - \csq@ifblank{#2} + \ifblank{#2} {\@secondoftwo}% 0x00-0x7F handled elsewhere {\csq@ifutfstart{#1}{\csq@ifvalidutf@ii#2&}{\@secondoftwo}}} \def\csq@ifvalidutf@ii#1#2&{% \csq@ifutfnext{#1} - {\csq@ifblank{#2}{\@firstoftwo}{\csq@ifvalidutf@ii#2&}} + {\ifblank{#2}{\@firstoftwo}{\csq@ifvalidutf@ii#2&}} {\@secondoftwo}} % 0xC0-0xFD, 0x80-0xBF, 0x80-0xBF, ... @@ -1779,15 +1724,15 @@ % User interface -\newcommand*{\MakeOuterQuote}[1]{% +\newrobustcmd*{\MakeOuterQuote}[1]{% \csq@addspecial{#1}{\csq@oqmark} {\csq@pdf@ooqmark}{\csq@pdf@coqmark}} -\newcommand*{\MakeInnerQuote}[1]{% +\newrobustcmd*{\MakeInnerQuote}[1]{% \csq@addspecial{#1}{\csq@iqmark} {\csq@pdf@oiqmark}{\csq@pdf@ciqmark}} -\newcommand*{\MakeAutoQuote}{% +\newrobustcmd*{\MakeAutoQuote}{% \@ifstar {\csq@mkaquote\csq@iqopen} {\csq@mkaquote\csq@qopen}} @@ -1795,7 +1740,7 @@ \csq@addspecial{#2}{#1}{\csq@pdf@ooqmark}{}% \csq@addspecial{#3}{\csq@qclose}{\csq@pdf@coqmark}{}} -\newcommand*{\MakeForeignQuote}{% +\newrobustcmd*{\MakeForeignQuote}{% \@ifstar {\csq@mkfquote\csq@iqopen@i} {\csq@mkfquote\csq@qopen@i}} @@ -1805,7 +1750,7 @@ {\csq@pdf@ooqmark}{}% \csq@addspecial{#4}{\csq@qclose}{\csq@pdf@coqmark}{}} -\newcommand*{\MakeHyphenQuote}{% +\newrobustcmd*{\MakeHyphenQuote}{% \@ifstar {\csq@mkhquote\csq@iqopen@i} {\csq@mkhquote\csq@qopen@i}} @@ -1815,60 +1760,60 @@ {\csq@pdf@ooqmark}{}% \csq@addspecial{#4}{\csq@qclose}{\csq@pdf@coqmark}{}} -\newcommand*{\MakeBlockQuote}[3]{% +\newrobustcmd*{\MakeBlockQuote}[3]{% \csq@addbspecial{#1}{#2}{#3}{\csq@bquote{}{\mkcitation}}} -\newcommand*{\MakeForeignBlockQuote}[4]{% +\newrobustcmd*{\MakeForeignBlockQuote}[4]{% \csq@addbspecial{#2}{#3}{#4}% {\csq@bquote{\csq@lang{#1}}{\mkcitation}}} -\newcommand*{\MakeHyphenBlockQuote}[4]{% +\newrobustcmd*{\MakeHyphenBlockQuote}[4]{% \csq@addbspecial{#2}{#3}{#4}% {\csq@bquote{\csq@hyph{#1}}{\mkcitation}}} -\newcommand*{\EnableQuotes}{} -\newcommand*{\DisableQuotes}{} -\newcommand*{\VerbatimQuotes}{} -\newcommand*{\DeleteQuotes}{\csq@mkdelete} +\newrobustcmd*{\EnableQuotes}{} +\newrobustcmd*{\DisableQuotes}{} +\newrobustcmd*{\VerbatimQuotes}{} +\newrobustcmd*{\DeleteQuotes}{\csq@mkdelete} \AtBeginDocument{% - \def\EnableQuotes{\csq@mkenable}% - \def\DisableQuotes{\csq@mkdisable}% - \def\VerbatimQuotes{\csq@mkverbatim}} + \protected\def\EnableQuotes{\csq@mkenable}% + \protected\def\DisableQuotes{\csq@mkdisable}% + \protected\def\VerbatimQuotes{\csq@mkverbatim}} % Author interface -\newcommand*{\@enablequotes}{} -\newcommand*{\@disablequotes}{} -\newcommand*{\@verbatimquotes}{} -\newcommand*{\@deletequotes}{% +\newrobustcmd*{\@enablequotes}{} +\newrobustcmd*{\@disablequotes}{} +\newrobustcmd*{\@verbatimquotes}{} +\newrobustcmd*{\@deletequotes}{% \csq@quiettrue \csq@mkdelete \csq@quietfalse} \AtBeginDocument{% - \def\@enablequotes{% + \protected\def\@enablequotes{% \csq@quiettrue \csq@mkenable \csq@quietfalse}% - \def\@disablequotes{% + \protected\def\@disablequotes{% \csq@quiettrue \csq@mkdisable \csq@quietfalse}% - \def\@verbatimquotes{% + \protected\def\@verbatimquotes{% \csq@quiettrue \csq@mkverbatim \csq@quietfalse}} % Legacy -\newcommand*{\RestoreQuotes}{% +\newrobustcmd*{\RestoreQuotes}{% \csq@warn@legacy\RestoreQuotes\EnableQuotes} -\newcommand*{\@restorequotes}{\@enablequotes} +\newrobustcmd*{\@restorequotes}{\@enablequotes} %% Switch quote styles manually -\newcommand*{\setquotestyle}{% +\newrobustcmd*{\setquotestyle}{% \@ifstar {\csq@resetqstyle} {\@ifnextchar[%] @@ -1880,7 +1825,7 @@ \csq@info{Disabling multilingual support}% \csq@reset\z@ \fi - \csq@ifblank{#1} + \ifblank{#1} {\csq@setstyle{#2}} {\csq@setstyle{#2/#1}}} @@ -1890,28 +1835,29 @@ %% Define quote styles -\newcommand*{\DeclareQuoteStyle}[2][]{% +\newrobustcmd*{\DeclareQuoteStyle}[2][]{% \begingroup \let\if@safe@actives\iftrue - \csq@ifblank{#1} + \ifblank{#1} {\edef\csq@tempa{#2}} {\edef\csq@tempa{#2/#1}}% - \csq@ifcsundefined{csq@qstyle@\csq@tempa} + \ifcsundef{csq@qstyle@\csq@tempa} {} - {\csq@info{Redefining quotation style `\csq@tempa'}}% + {\csq@info{Redefining quotation style '\csq@tempa'}}% \@ifnextchar[%] {\csq@declareqstyle@i} {\csq@declareqstyle@i[]}} \def\csq@declareqstyle@i[#1]{% - \csq@csgdef{csq@qstyle@\csq@tempa}{% - \def\csq@theqmark@oinit{#1}}% + \csgdef{csq@qstyle@\csq@tempa}{% + \def\csq@theqmark@oinit{% + \let\csq@themark\csq@kernmark#1}}% \@ifnextchar[%] {\csq@declareqstyle@ii} {\csq@declareqstyle@ii[]}} \def\csq@declareqstyle@ii[#1]#2{% - \csq@csgadd{csq@qstyle@\csq@tempa}{% + \csgappto{csq@qstyle@\csq@tempa}{% \def\csq@theqmark@iinit{#1}% \def\csq@theqmark@oopen{#2}}% \@ifnextchar[%] @@ -1919,7 +1865,7 @@ {\csq@declareqstyle@iii[]}} \def\csq@declareqstyle@iii[#1]#2{% - \csq@csgadd{csq@qstyle@\csq@tempa}{% + \csgappto{csq@qstyle@\csq@tempa}{% \def\csq@theqmark@omiddle{#1}% \def\csq@theqmark@oclose{#2}}% \@ifnextchar[%] @@ -1927,19 +1873,19 @@ {\csq@declareqstyle@iv[]}} \def\csq@declareqstyle@iv[#1]#2{% - \csq@ifblank{#1} + \ifblank{#1} {\def\csq@theqmark@kern{\z@}} {\def\csq@theqmark@kern{#1}}% - \csq@csxadd{csq@qstyle@\csq@tempa}{% + \csxappto{csq@qstyle@\csq@tempa}{% \def\noexpand\csq@theqmark@kern{\csq@theqmark@kern}}% - \csq@csgadd{csq@qstyle@\csq@tempa}{% + \csgappto{csq@qstyle@\csq@tempa}{% \def\csq@theqmark@iopen{#2}}% \@ifnextchar[%] {\csq@declareqstyle@v} {\csq@declareqstyle@v[]}} \def\csq@declareqstyle@v[#1]#2{% - \csq@csgadd{csq@qstyle@\csq@tempa}{% + \csgappto{csq@qstyle@\csq@tempa}{% \def\csq@theqmark@imiddle{#1}% \def\csq@theqmark@iclose{#2}}% \endgroup} @@ -1948,20 +1894,20 @@ %% Define quote aliases -\newcommand*{\DeclareQuoteAlias}[3][]{% +\newrobustcmd*{\DeclareQuoteAlias}[3][]{% \begingroup \let\if@safe@actives\iftrue - \csq@ifblank{#1} + \ifblank{#1} {\edef\csq@tempa{#2}} {\edef\csq@tempa{#2/#1}}% - \csq@ifcsundefined{csq@qstyle@\csq@tempa} + \ifcsundef{csq@qstyle@\csq@tempa} {\csq@error {Quote style not defined} - {Define the style or alias `\csq@tempa' first}} - {\csq@ifcsundefined{csq@qstyle@#3} + {Define the style or alias '\csq@tempa' first}} + {\ifcsundef{csq@qstyle@#3} {} - {\csq@info{Redefining alias `#3' -> `\csq@tempa'}}% - \csq@csxdef{csq@qstyle@#3}{% + {\csq@info{Redefining alias '#3' -> '\csq@tempa'}}% + \csxdef{csq@qstyle@#3}{% \noexpand\@nameuse{csq@qstyle@\csq@tempa}}}% \endgroup} @@ -1969,7 +1915,7 @@ %% Define quotes for PDF strings -\newcommand*{\DeclarePlainStyle}[4]{% +\newrobustcmd*{\DeclarePlainStyle}[4]{% \def\csq@pdf@ooqmark{#1}% \def\csq@pdf@coqmark{#2}% \def\csq@pdf@oiqmark{#3}% @@ -1979,81 +1925,109 @@ %% Define package options -\newcommand*{\DeclareQuoteOption}[1]{% +\newrobustcmd*{\DeclareQuoteOption}[1]{% \define@key{csq}{#1}{\DeclareQuoteAlias[##1]{#1}{#1}}} \AtEndOfPackage{% - \def\DeclareQuoteOption#1{% + \protected\def\DeclareQuoteOption#1{% \csq@warn@location\DeclareQuoteOption}} %% Set defaults -\newcommand*{\SetBlockThreshold}[1]{% +\newrobustcmd*{\SetBlockThreshold}[1]{% \csq@tshold=#1\relax} -\newcommand*{\SetBlockEnvironment}[1]{% - \csq@ifcsundefined{#1} +\newrobustcmd*{\SetBlockEnvironment}[1]{% + \ifcsundef{#1} {\csq@err@notdef{#1}} {\def\csq@blockenvironment{#1}}} -\newcommand*{\SetCiteCommand}[1]{% - \csq@ifundefined{#1} +\newrobustcmd*{\SetCiteCommand}[1]{% + \ifundef#1% {\csq@err@notdef{#1}} {\def\csq@cite{#1}}} % Legacy commands -\newcommand*{\setblockthreshold}{% +\newrobustcmd*{\setblockthreshold}{% \csq@warn@legacy\setblockthreshold\SetBlockThreshold} -\newcommand*{\setblockenvironment}{% +\newrobustcmd*{\setblockenvironment}{% \csq@warn@legacy\setblockenvironment\SetBlockEnvironment} +%% Author interface to auto quotes + +\newrobustcmd*{\openautoquote}{% + \csq@ifmmode + {\csq@err@mmode\openautoquote} + {\csq@qopen}} + +\newrobustcmd*{\closeautoquote}{% + \csq@ifmmode + {\csq@err@mmode\closeautoquote} + {\csq@qclose}} + +\newrobustcmd*{\openinnerquote}{% + \csq@ifmmode + {\csq@err@mmode\openinnerquote} + {\csq@iqopen}} + +\newrobustcmd*{\closeinnerquote}{% + \csq@ifmmode + {\csq@err@mmode\closeinnerquote} + {\csq@qclose}} + +\appto\csq@mkhyperref{% + \def\openautoquote{\csq@pdf@ooqmark}% + \def\closeautoquote{\csq@pdf@coqmark}% + \def\openinnerquote{\csq@pdf@oiqmark}% + \def\closeinnerquote{\csq@pdf@ciqmark}} + %% Author interface to internal marks -\newcommand*{\initoquote}{% +\newrobustcmd*{\initoquote}{% \csq@resetstyle \csq@qlevel\@ne \csq@theqmark@oinit} -\newcommand*{\initiquote}{% +\newrobustcmd*{\initiquote}{% \csq@resetstyle \csq@qlevel\tw@ \csq@theqmark@iinit} -\newcommand*{\textooquote}{% +\newrobustcmd*{\textooquote}{% \csq@resetstyle \csq@theqmark@oopen} -\newcommand*{\textmoquote}{% +\newrobustcmd*{\textmoquote}{% \csq@resetstyle \csq@theqmark@omiddle} -\newcommand*{\textcoquote}{% +\newrobustcmd*{\textcoquote}{% \csq@resetstyle \csq@theqmark@oclose} -\newcommand*{\textoiquote}{% +\newrobustcmd*{\textoiquote}{% \csq@resetstyle \csq@theqmark@iopen} -\newcommand*{\textmiquote}{% +\newrobustcmd*{\textmiquote}{% \csq@resetstyle \csq@theqmark@imiddle} -\newcommand*{\textciquote}{% +\newrobustcmd*{\textciquote}{% \csq@resetstyle \csq@theqmark@iclose} %% Space factor codes -\csq@csdef{csq@sfcodes@OT1}{% +\csdef{csq@sfcodes@OT1}{% \sfcode 96=\z@ % textquoteleft \sfcode 39=\z@ % textquoteright \sfcode 92=\z@ % textquotedblleft \sfcode 34=\z@ % textquotedblright } -\csq@csdef{csq@sfcodes@T1}{% +\csdef{csq@sfcodes@T1}{% \sfcode 96=\z@ % textquoteleft \sfcode 39=\z@ % textquoteright \sfcode 16=\z@ % textquotedblleft @@ -2069,7 +2043,7 @@ \sfcode 34=\z@ % textquotedbl } -\csq@csdef{csq@sfcodes@LY1}{% +\csdef{csq@sfcodes@LY1}{% \sfcode 96=\z@ % textquoteleft \sfcode 39=\z@ % textquoteright \sfcode147=\z@ % textquotedblleft @@ -2086,38 +2060,25 @@ %% Auxiliary commands for some styles -% Wrappers for Omega primitives +% French -\newcommand*{\seteverylineleft}[1]{% - \csq@ifcsundefined{localleftbox} - {\csq@warn@noomega\csq@currentstyle} - {\leavevmode\null\localleftbox{#1}}} +\newrobustcmd*{\initfrenchquotes}{% + \let\csq@themark\csq@frenchmark} -\newcommand*{\seteverylineright}[1]{% - \csq@ifcsundefined{localrightbox} - {\csq@warn@noomega\csq@currentstyle} - {\localrightbox{#1}}} +\newrobustcmd*{\mkfrenchopenquote}[1]{% + \leavevmode#1\penalty\@M\@frenchquotespace} -% Improved spacing for French +\newrobustcmd*{\mkfrenchclosequote}[1]{% + \leavevmode\penalty\@M\@frenchquotespace#1} -\newcommand*{\frenchnbspace}{% - \penalty\@M +\newcommand*{\@frenchquotespace}{% \hskip 0.8\fontdimen2\font plus 0.3\fontdimen3\font - minus 0.8\fontdimen4\font} + minus 0.3\fontdimen4\font} -\newcommand*{\mkfrenchopenquote}[1]{% - \leavevmode#1\frenchnbspace} +% German -\newcommand*{\mkfrenchclosequote}[1]{% - \frenchnbspace#1} - -\newcommand*{\initfrenchquotes}{% - \let\csq@themark\csq@frenchmark} - -% Prevent undesirable T1 ligatures (?` and !`) - -\newcommand*{\fixligatures}{% +\newrobustcmd*{\fixligatures}{% \ifhmode \ifnum\spacefactor>3000 \relax @@ -2132,213 +2093,23 @@ \fi \fi} -%% Built-in backend styles - -\DeclareQuoteStyle[quotes]{danish} - {\quotedblbase} - {\textquotedblleft} - [0.05em] - {\textquoteright}% unsure - {\textquoteright}% unsure -\DeclareQuoteStyle[guillemets]{danish} - {\guillemotright} - {\guillemotleft} - {\textquoteright}% unsure - {\textquoteright}% unsure -\DeclareQuoteStyle{dutch} - {\quotedblbase} - {\textquotedblright} - [0.05em] - {\quotesinglbase}% unsure - {\textquoteright}% unsure -\DeclareQuoteStyle[american]{english}% verified - {\textquotedblleft} - {\textquotedblright} - [0.05em] - {\textquoteleft} - {\textquoteright} -\DeclareQuoteStyle[british]{english}% verified - {\textquoteleft} - {\textquoteright} - [0.05em] - {\textquotedblleft} - {\textquotedblright} -\DeclareQuoteStyle[oldstyle]{english}% verified - [\seteverylineleft{\textquoteleft}] - {\textquoteleft} - {\textquoteright} - [0.05em] - {\textquotedblleft} - {\textquotedblright} -\DeclareQuoteStyle{finnish} - {\textquotedblright} - {\textquotedblright} - [0.05em] - {\textquoteright} - {\textquoteright} -\DeclareQuoteStyle[quotes]{french} - {\mkfrenchopenquote{\guillemotleft}} - {\mkfrenchclosequote{\guillemotright}} - {\textquotedblleft} - {\textquotedblright} -\DeclareQuoteStyle[quotes*]{french} - {\mkfrenchopenquote{\guillemotleft}} - {\mkfrenchclosequote{\guillemotright}} - {\mkfrenchopenquote{\textquotedblleft}} - {\mkfrenchclosequote{\textquotedblright}} -\DeclareQuoteStyle[guillemets]{french} - [\initfrenchquotes] - {\mkfrenchopenquote{\guillemotleft}} - [\mkfrenchopenquote{\guillemotleft}] - {\mkfrenchclosequote{\guillemotright}} - {\mkfrenchopenquote{\guillemotleft}} - {\mkfrenchclosequote{\guillemotright}} -\DeclareQuoteStyle[guillemets*]{french} - [\initfrenchquotes] - {\mkfrenchopenquote{\guillemotleft}} - [\mkfrenchopenquote{\guillemotright}] - {\mkfrenchclosequote{\guillemotright}} - {\mkfrenchopenquote{\guillemotleft}} - {\mkfrenchclosequote{\guillemotright}} -\DeclareQuoteStyle[oldstyle]{french} - [\initfrenchquotes - \seteverylineleft{\mkfrenchopenquote{\guillemotleft}}] - {\mkfrenchopenquote{\guillemotleft}} - {\mkfrenchclosequote{\guillemotright}} - {\mkfrenchopenquote{\guillemotleft}} - {\mkfrenchclosequote{\guillemotright}} -\DeclareQuoteStyle[imprimerie]{french} - [\initfrenchquotes] - [\seteverylineleft{\guillemotleft\nobreakspace}] - {\guillemotleft\nobreakspace} - [\guillemotleft\nobreakspace] - {\nobreakspace\guillemotright} - {\guillemotleft\nobreakspace} - [\relax] - {\nobreakspace\guillemotright} -\DeclareQuoteStyle[quotes]{german}% verified - {\quotedblbase} - {\textquotedblleft} - [0.05em] - {\quotesinglbase} - {\fixligatures\textquoteleft} -\DeclareQuoteStyle[guillemets]{german}% verified - {\guillemotright} - {\guillemotleft} - [0.025em] - {\guilsinglright} - {\guilsinglleft} -\DeclareQuoteStyle[swiss]{german}% verified - {\guillemotleft} - {\guillemotright} - [0.025em] - {\guilsinglleft} - {\guilsinglright} -\DeclareQuoteStyle[quotes]{italian} - {\textquotedblleft} - {\textquotedblright} - [0.05em] - {\textquoteleft} - {\textquoteright} -\DeclareQuoteStyle[guillemets]{italian} - {\guillemotleft} - [\textquotedblright]% unsure - {\guillemotright} - [0.025em] - {\textquotedblleft} - {\textquotedblright} -\DeclareQuoteStyle[guillemets]{norwegian} - {\guillemotleft} - {\guillemotright} - [0.025em] - {\guilsinglleft} - {\guilsinglright} -\DeclareQuoteStyle[quotes]{norwegian} - {\quotedblbase} - {\textquotedblright} - [0.05em] - {\quotesinglbase} - {\textquoteright} -\DeclareQuoteStyle{spanish}% verified - {\guillemotleft} - [\guillemotright] - {\guillemotright} - [0.025em] - {\textquotedblleft} - [\textquotedblright] - {\textquotedblright} -\DeclareQuoteStyle[quotes]{swedish}% verified - {\textquotedblright} - {\textquotedblright} - [0.05em] - {\textquoteright} - {\textquoteright} -\DeclareQuoteStyle[guillemets]{swedish}% verified - {\guillemotright} - {\guillemotright} - [0.025em] - {\guilsinglright} - {\guilsinglright} -\DeclareQuoteStyle[guillemets*]{swedish}% verified - {\guillemotright} - {\guillemotleft} - [0.025em] - {\guilsinglright} - {\guilsinglleft} - -% Fallback style - -\DeclareQuoteStyle{fallback} - {\csq@dummymark} - {\csq@dummymark} - {\csq@dummymark} - {\csq@dummymark} - -\def\csq@dummymark{\textbf{?}} -\def\csq@errormark{\rule{1ex}{1ex}} +% Fallback styles -% PDF strings +\protected\def\csq@errormark{% + \kern0.2em\rule[0.25ex]{1.25ex}{1.25ex}\kern0.2em} -\DeclarePlainStyle{"}{"}{'}{'} - -%% Built-in aliases - -\DeclareQuoteAlias[american]{english}{american} -\DeclareQuoteAlias[american]{english}{canadian} -\DeclareQuoteAlias[american]{english}{english} -\DeclareQuoteAlias[british]{english}{british} -\DeclareQuoteAlias[british]{english}{australian}% unsure -\DeclareQuoteAlias[british]{english}{newzealand}% unsure -\DeclareQuoteAlias[guillemets]{norwegian}{norwegian} -\DeclareQuoteAlias[quotes]{danish}{danish} -\DeclareQuoteAlias[quotes]{french}{french} -\DeclareQuoteAlias[quotes]{german}{austrian} -\DeclareQuoteAlias[quotes]{german}{german} -\DeclareQuoteAlias[quotes]{italian}{italian} -\DeclareQuoteAlias[quotes]{swedish}{swedish} -\DeclareQuoteAlias[swiss]{german}{swiss} - -% Babel aliases - -\DeclareQuoteAlias{american}{USenglish} -\DeclareQuoteAlias{american}{usenglish} -\DeclareQuoteAlias{british}{UKenglish} -\DeclareQuoteAlias{british}{ukenglish} -\DeclareQuoteAlias{french}{frenchb} -\DeclareQuoteAlias{german}{ngerman} -\DeclareQuoteAlias{austrian}{naustrian} -\DeclareQuoteAlias{norwegian}{norsk} -\DeclareQuoteAlias{norwegian}{nynorsk} +\newrobustcmd*{\dummyquotemark}{% + \kern0.2em\textbf{?}\kern0.2em} %% Package options -\newcommand*{\ExecuteQuoteOptions}{\setkeys{csq}} +\newrobustcmd*{\ExecuteQuoteOptions}{\setkeys{csq}} \@onlypreamble\ExecuteQuoteOptions % Core options \define@key{csq}{strict}[true]{% - \csq@ifcsundefined{csq@opt@strict@#1} + \ifcsundef{csq@opt@strict@#1} {\csq@err@invldopt{strict=#1}} {\@nameuse{csq@opt@strict@#1}}} \def\csq@opt@strict@true{% @@ -2349,7 +2120,7 @@ \let\csq@warning\csq@warning@loose} \define@key{csq}{babel}[true]{% - \csq@ifcsundefined{csq@opt@babel@#1} + \ifcsundef{csq@opt@babel@#1} {\csq@err@invldopt{babel=#1}} {\@nameuse{csq@opt@babel@#1}}} \def\csq@opt@babel@false{% @@ -2369,56 +2140,40 @@ \csq@opt@babel@false \DeclareQuoteAlias{#1}{default}} -% Language options - -\DeclareQuoteOption{danish} -\DeclareQuoteOption{english} -\DeclareQuoteOption{french} -\DeclareQuoteOption{german} -\DeclareQuoteOption{italian} -\DeclareQuoteOption{norwegian} -\DeclareQuoteOption{swedish} - %% Initial setup -% Set defaults - -\DeclareQuoteAlias[american]{english}{default} +% Provide 'quote' environment -\csq@ifcsundefined{quote} +\ifundef\quote {\csq@info{% - The `quote' environment appears to be undefined.\MessageBreak - I'm defining a typical `quote' environment now} + The 'quote' environment appears to be undefined.\MessageBreak + I'm defining a typical 'quote' environment now} \def\quote{% \list{}{\rightmargin\leftmargin}% \item\relax} \def\endquote{\endlist}} {} -\SetBlockEnvironment{quote} -\SetBlockThreshold{3} -\SetCiteCommand{\cite} +% Deferred last minute setup -%% Last minute setup - -\AtBeginDocument{% - \providecommand*{\ifstringblank}{\csq@ifblank}% +\AtEndPreamble{% + \providecommand*{\ifstringblank}{\ifblank}% \@ifpackageloaded{babel} {\csq@mkbabel} {\csq@mknobabel}% - \let\csq@mkbabel\@undefined - \let\csq@mknobabel\@undefined + \undef\csq@mkbabel + \undef\csq@mknobabel \@ifpackageloaded{hyperref} {\expandafter\pdfstringdefDisableCommands \expandafter{\csq@mkhyperref}} {}% - \let\csq@mkhyperref\@undefined - \csq@add\@noligs{\@verbatimquotes}% + \undef\csq@mkhyperref + \appto\@noligs{\@verbatimquotes}% \@ifpackageloaded{verbatim} {\addto@hook\every@verbatim{\@verbatimquotes}} {}% \@ifpackageloaded{fancyvrb} - {\csq@add\FV@CatCodes{\@verbatimquotes}} + {\appto\FV@CatCodes{\@verbatimquotes}} {}% \@ifpackageloaded{amsmath} {\let\csq@collect@body\collect@body @@ -2430,7 +2185,7 @@ \@ifpackageloaded{endnotes} {\BlockquoteDisable{% \renewcommand{\endnote}[2][]{% - \csq@ifblank{#1} + \ifblank{#1} {\endnotemark\relax} {\endnotemark[#1]}}% \renewcommand{\endnotetext}[2][]{}% @@ -2439,9 +2194,20 @@ \csq@setstyle{default}% \csq@mkenable} +% Restore catcodes + +\def\do#1#2{\catcode`#1=#2\relax} +\csq@docatcodes +\undef\csq@docatcodes +\let\do\noexpand + +% Load predefined styles + +\input{csquotes.def} + % Load configuration file -\csq@info{Trying to load configuration file `csquotes.cfg'..} +\csq@info{Trying to load configuration file 'csquotes.cfg'..} \InputIfFileExists{csquotes.cfg} {\csq@info{... configuration file loaded successfully}} {\csq@info{... configuration file not used}} |