From db62fe150395d9bc65e20ba0d51042f201e2a4bc Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 12 Jul 2006 22:29:34 +0000 Subject: csquotes 3.4 git-svn-id: svn://tug.org/texlive/trunk@1825 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/csquotes/csquotes.cfg | 13 +- Master/texmf-dist/tex/latex/csquotes/csquotes.sty | 1605 ++++++++++++--------- 2 files changed, 926 insertions(+), 692 deletions(-) (limited to 'Master/texmf-dist/tex/latex/csquotes') diff --git a/Master/texmf-dist/tex/latex/csquotes/csquotes.cfg b/Master/texmf-dist/tex/latex/csquotes/csquotes.cfg index 179af4b8a96..a88047f604d 100644 --- a/Master/texmf-dist/tex/latex/csquotes/csquotes.cfg +++ b/Master/texmf-dist/tex/latex/csquotes/csquotes.cfg @@ -1,6 +1,6 @@ -% $Id: csquotes.cfg,v 3.1 2005/08/29 18:07:39 lehman pub $ +% $Id: csquotes.cfg,v 3.4 2006/04/02 15:58:08 lehman stable $ -\ProvidesFile{csquotes.cfg}[2005/08/29 v3.1 csquotes configuration] +\ProvidesFile{csquotes.cfg}[2006/04/02 v3.4 Quotation configuration] % Put your definitions here. @@ -11,16 +11,15 @@ % you want to try them out. % PRESETTING PACKAGE OPTIONS -% -% Use \ExecuteOptions to preset package options if you are not + +% Use \ExecuteQuoteOptions to preset package options if you are not % satisfied with the built-in defaults. Options given here will be % processed before any options specified in the document preamble. -% You may override them anytime with \usepackage in the preamble. -\ExecuteOptions{babel=true,strict=true} +\ExecuteQuoteOptions{babel=once,strict=true} % CHANGING THE DEFAULT PARAMETERS -% + % All preset values may be changed in the document preamble as % usual. The following values are the built-in defaults: diff --git a/Master/texmf-dist/tex/latex/csquotes/csquotes.sty b/Master/texmf-dist/tex/latex/csquotes/csquotes.sty index 55122288785..0cb999d5862 100644 --- a/Master/texmf-dist/tex/latex/csquotes/csquotes.sty +++ b/Master/texmf-dist/tex/latex/csquotes/csquotes.sty @@ -1,35 +1,50 @@ -% $Id: csquotes.sty,v 3.1 2005/08/29 18:07:39 lehman pub $ -% -% Copyright (c) 2003--2005 Philipp Lehman, author-maintained. +% $Id: csquotes.sty,v 3.4 2006/04/02 15:58:08 lehman stable $ + +% Copyright (c) 2003--2006 Philipp Lehman, author-maintained. % % 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, +% 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. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{csquotes}[2005/08/29 v3.1 quotation facilities] +\ProvidesPackage{csquotes}[2006/04/02 v3.4 Quotation facilities] \RequirePackage{keyval} +%% Category codes + +\def\csq@docatcodes{\do\~\do\&\do\:\do\"} +\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 % three +\catcode`\:=12 +\catcode`\"=12 + %% General things -\newif\ifcsq@reset \newif\ifcsq@block \newif\ifcsq@quiet -\newif\ifcsq@strict +\newif\ifcsq@reset +\newif\ifcsq@ronce \newif\ifcsq@active -\newcount\csq@qlevel -\newcount\csq@glevel \newcount\csq@gtype +\newcount\csq@glevel +\newcount\csq@qlevel \newcount\csq@lastsf -\newcount\csq@threshold - -\newtoks\csq@ltxeverypar +\newcount\csq@tshold \def\csq@ifcsundefined#1{% \begingroup @@ -43,29 +58,26 @@ \begingroup \escapechar\m@ne \expandafter\csq@ifcsundefined - \expandafter{\string #1} + \expandafter{\string#1} {\endgroup\@firstoftwo} {\endgroup\@secondoftwo}} -\csq@ifcsundefined{eTeXversion} - {\let\csq@ifetex\@secondoftwo} - {\let\csq@ifetex\@firstoftwo} +\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} + \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} + \toks@=\expandafter{#1}% + \edef#1{\endgroup\def\noexpand#1{\the\toks@#2}}#1} \long\def\csq@gadd#1{% \csq@ifundefined{#1}{\let#1\@empty}{}% @@ -74,19 +86,26 @@ \long\def\csq@xadd#1#2{% \csq@ifundefined{#1}{\let#1\@empty}{}% \begingroup - \toks@=\expandafter{#1}% - \xdef#1{\the\toks@#2}% + \toks@=\expandafter{#1}% + \xdef#1{\the\toks@#2}% \endgroup} -\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@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} -\def\csq@addto@dolist#1{% - \expandafter\csq@addto@dolist@i\csname\string #1\endcsname} +% {}{}{} -\def\csq@addto@dolist@i#1#2#3{% +\def\csq@addto@list#1{% + \expandafter\csq@addto@list@i\csname\string#1\endcsname} +\def\csq@addto@list@i#1#2#3{% \begingroup \@tempswatrue \def#3##1{\ifnum`#1=`##1\relax\@tempswafalse\fi}#2% @@ -94,28 +113,19 @@ \csq@add#2{#3#1}% \fi} +\newtoks\csq@ltxeverypar \def\csq@addto@everypar#1{% \let\csq@everypar\everypar \csq@ltxeverypar=\expandafter{\the\everypar}% - \csq@everypar={\the\csq@ltxeverypar #1}% + \csq@everypar={\the\csq@ltxeverypar#1}% \let\everypar\csq@ltxeverypar \let\csq@addto@everypar\@gobble} -% Miscellaneous things - -\begingroup - \catcode`\&=3 - - \long\gdef\csq@ifblank#1{% by D. Arseneau - \csq@ifblank@i#1&&\@secondoftwo\@firstoftwo&}% - \long\gdef\csq@ifblank@i#1#2#4#5&{#4} +% Miscellaneous tests - \long\gdef\csq@ifsingle#1{\csq@ifblank@i#1&&{\expandafter - \csq@ifsingle@i\string #1&&\@secondoftwo\@firstoftwo&}% - \@secondoftwo&}% - \long\gdef\csq@ifsingle@i#1#2#3#5#6&{#5} - -\endgroup +\long\def\csq@ifblank#1{% by D. Arseneau + \csq@ifblank@i#1&&\@secondoftwo\@firstoftwo:} +\long\def\csq@ifblank@i#1#2#4#5:{#4} \newcommand*{\ifstringblank}{\csq@ifblank} \newcommand*{\ifblockquote}{% @@ -125,6 +135,27 @@ \expandafter\@secondoftwo \fi} +\def\csq@ifsafeactives{% + \ifx\if@safe@actives\iftrue + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} + +\def\csq@iftypeset{% + \ifx\protect\@typeset@protect + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} + +\def\csq@ifstrings{% + \ifx\protect\string + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} + \def\csq@ifmmode{% \ifmmode \expandafter\@firstoftwo @@ -132,47 +163,75 @@ \expandafter\@secondoftwo \fi} -\csq@ifetex +\def\csq@ifnested{% + \ifcsq@block + \expandafter\@firstoftwo + \else + \ifnum\csq@qlevel>\z@ + \expandafter\expandafter + \expandafter\@firstoftwo + \else + \expandafter\expandafter + \expandafter\@secondoftwo + \fi + \fi} + +% Parsers for UTF-8 + +\def\csq@string#1{\csq@string@i#1&} +\def\csq@string@i#1#2&{% + \string#1\csq@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&}} + +\def\csq@utfprint#1{u8:\csq@utfprint@i#1&} +\def\csq@utfprint@i#1#2&{% + \number`#1 \csq@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@glevel=\currentgrouplevel - \ifnum\csq@gtype=\currentgrouptype + \ifnum\csq@gtype=\currentgrouptype + \ifnum\csq@glevel=\currentgrouplevel \else - \csq@err@mismatch{% - I have detected a group type mismatch. Verify that all + \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 the level and type of all previously\MessageBreak - opened groups to the transcript file}% - \aftergroup\showgroups + 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 level mismatch. Verify that all - groups\MessageBreak and all active quotes are properly - balanced and nested. If you\MessageBreak continue, I will - write the level and type of all previously\MessageBreak - opened groups to the transcript file}% + 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}} - {\let\csq@bqgroup\begingroup - \let\csq@eqgroup\endgroup} %% User feedback \def\csq@error#1#2{% \PackageError{csquotes}{#1}{#2.}} -\def\csq@warning#1#2#3#4{% - \ifcsq@strict - \PackageError{csquotes}{#3}{#4.}% - \else - \PackageWarning{csquotes}{#1.\MessageBreak #2}% - \fi} +\def\csq@warning@loose#1#2#3{% + \PackageWarning{csquotes}{#1}} +\def\csq@warning@strict#1#2#3{% + \PackageError{csquotes}{#2}{#3.}} +\let\csq@warning\csq@warning@loose \def\csq@info#1{% \ifcsq@quiet @@ -193,68 +252,88 @@ \def\csq@err@mmode#1{% \csq@error - {Command `\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{% \csq@error - {Command or environment `\string #1' not defined} + {`\string#1' not defined} {This command or environment environment appears to - be undefined}} + be\MessageBreak undefined}} + +\def\csq@err@invldopt#1{% + \csq@error + {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#1{% +\def\csq@err@alloc{% \csq@error - {Character \string #1 already allocated} - {This character is already allocated as active quote, - delimiter,\MessageBreak or closing mark}} + {Invalid argument} + {One of the arguments you have supplied is already allocated + as\MessageBreak active quote or delimiter}} -\def\csq@err@invquote{% +\def\csq@err@invldchar{% \csq@error {Invalid argument} - {One of the arguments you have supplied is invalid. - Only single\MessageBreak characters with category - code 7-8 and 12-13 may be used as\MessageBreak - active quotes}} + {Only single characters with category code 12 or 13 may + be\MessageBreak allocated as active quotes. Numbers, + punctuation marks, and\MessageBreak characters which + are part of the LaTeX syntax or reserved\MessageBreak + for a specific purpose are invalid}} -\def\csq@err@invdelim{% +\def\csq@err@invldutf{% \csq@error {Invalid argument} - {One of the arguments you have supplied is invalid. - Only single\MessageBreak characters with category - code 3-4, 7-8, 12-13 may be used as\MessageBreak - delimiters or closing marks}} + {Only valid UTF-8 sequences representing a single + character\MessageBreak may be allocated as active quotes}} + +\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 + If you continue now, I will reject all UTF-8 encoded + arguments\MessageBreak as invalid}} + +\def\csq@err@nbquote{% + \csq@err@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{% \csq@warning - {The `babel' package is not available} - {#1} + {The `babel' package is not available.\MessageBreak #1} {#1} - {Try loading the `babel' package if you want to use this - feature}} + {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} - {Some features will be missing} - {Quote style `#1' requires Omega} - {Try compiling the document with `lambda' instead of `latex'}} + {Compile the document with `lambda' instead of `latex'}} \def\csq@warn@location#1{% \csq@warning - {Command `\string #1' invalid at this point} - {Ignoring command} - {Command `\string #1' invalid at this point} - {This command may not be used at this particular location}} - -% Notices - -\def\csq@info@legacy#1#2{% - \csq@info{% - Command `\string #1' is depreciated.\MessageBreak - Please use `\string #2' instead}% - #2} + {`\string#1' invalid at this point.\MessageBreak + Ignoring command} + {`\string#1' invalid at this point} + {This command may not be used at this particular + point.\MessageBreak See the user manual of the `csquotes' + package for details}} + +\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}% + \let#1#2#2} %% Opening quotation mark @@ -263,9 +342,11 @@ \def\csq@oqmark{% \ifnum\csq@qlevel>\z@ \csq@err@mismatch{% - You have requested a level 1 quote, but - the current quotation\MessageBreak level - is already \the\csq@qlevel}% + Level 1 quote group invalid at this point: + the current level is \the\csq@qlevel}% + \csq@bqgroup + \advance\csq@qlevel\@ne + \let\csq@oqmark\csq@qerror \else \csq@bqgroup \csq@qlevel\@ne @@ -283,9 +364,11 @@ \def\csq@iqmark{% \ifnum\csq@qlevel>\@ne \csq@err@mismatch{% - You have requested a level 2 quote, but - the current quotation\MessageBreak level - is already \the\csq@qlevel}% + Level 2 quote group invalid at this point: + the current level is \the\csq@qlevel}% + \csq@bqgroup + \advance\csq@qlevel\@ne + \let\csq@iqmark\csq@qerror \else \csq@bqgroup \csq@qlevel\tw@ @@ -304,10 +387,9 @@ \def\csq@qopen@i{% \ifnum\csq@qlevel>\@ne \csq@err@mismatch{% - You have requested a level 1 or 2 quote, - but the current\MessageBreak quotation - level is already \the\csq@qlevel}% - \csq@eqgroup + New quote group invalid at this point: + the current level is \the\csq@qlevel}% + \advance\csq@qlevel\@ne \else \advance\csq@qlevel\@ne \csq@resetstyle @@ -330,10 +412,9 @@ \def\csq@iqopen@i{% \ifnum\csq@qlevel>\@ne \csq@err@mismatch{% - You have requested a level 2 quote, but - the current quotation\MessageBreak level - is already \the\csq@qlevel}% - \csq@eqgroup + Level 2 quote group invalid at this point: + the current level is \the\csq@qlevel}% + \advance\csq@qlevel\@ne \else \csq@qlevel\tw@ \csq@resetstyle @@ -342,11 +423,6 @@ \csq@theqmark@iopen \fi} -% Nestable marks + babel - -\def\csq@qopen@lang#1{\csq@bqgroup\csq@lang{#1}\csq@qopen@i} -\def\csq@qopen@hyph#1{\csq@bqgroup\csq@hyph{#1}\csq@qopen@i} - %% Closing quotation mark \def\csq@qclose{% @@ -371,10 +447,13 @@ \expandafter\expandafter \expandafter\csq@restkern \else - \csq@err@mismatch{% - You have requested that the current quotation - be closed, but\MessageBreak the current - quotation level is already \the\csq@qlevel}% + \ifnum\csq@qlevel>\z@ + \csq@qerror + \else + \csq@err@mismatch{% + Cannot close the current quote group: + the current level is \the\csq@qlevel}% + \fi \fi \fi} @@ -390,6 +469,10 @@ \csq@eadd\csq@tempa{\csq@lastsf\the\csq@lastsf\relax}% \csq@tempa} +\def\csq@qerror{% + \csq@eqgroup + \csq@errormark} + %% Style initialization \def\csq@init{% @@ -430,7 +513,8 @@ \def\noexpand\csq@thekern@close{\the\@tempdima}}% \fi \csq@tempa - \else + \fi + \ifnum\csq@qlevel=\tw@ \csq@theqmark@iinit \ifx\csq@theqmark@imiddle\@empty \else @@ -457,10 +541,10 @@ \def\csq@restkern@ii{% \ifcat a\noexpand\csq@kerntok@ii - \csq@restkern@iii + \expandafter\csq@restkern@iii \fi \ifcat 1\noexpand\csq@kerntok@ii - \csq@restkern@iii + \expandafter\csq@restkern@iii \fi} \def\csq@restkern@iii{% @@ -527,12 +611,12 @@ \let\nonfrenchspacing\csq@setencodes} \def\csq@setfrcodes{% - \sfcode`\,=1001 - \sfcode`\;=1002 - \sfcode`\:=1003 - \sfcode`\.=1004 - \sfcode`\!=1005 - \sfcode`\?=1006 + \sfcode`\,=1002 + \sfcode`\;=1003 + \sfcode`\:=1004 + \sfcode`\.=1005 + \sfcode`\!=1006 + \sfcode`\?=1007 } \def\csq@setencodes{% @@ -544,12 +628,13 @@ \sfcode`\?=3002 } -\@namedef{csq@frcode@1250}{1001} -\@namedef{csq@frcode@1500}{1002} -\@namedef{csq@frcode@2000}{1003} -\@namedef{csq@frcode@3000}{1004} -\@namedef{csq@frcode@3001}{1005} -\@namedef{csq@frcode@3002}{1006} +\csq@csdef{csq@frcode@1001}{1001}% abbrv. dot +\csq@csdef{csq@frcode@1250}{1002} +\csq@csdef{csq@frcode@1500}{1003} +\csq@csdef{csq@frcode@2000}{1004} +\csq@csdef{csq@frcode@3000}{1005} +\csq@csdef{csq@frcode@3001}{1006} +\csq@csdef{csq@frcode@3002}{1007} \def\csq@setlastsf{% \ifhmode @@ -562,56 +647,56 @@ \fi} \newcommand*{\ifquotepunct}{% - \ifnum\csq@lastsf>\@m + \ifnum\csq@lastsf>1001 \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi} \newcommand*{\ifquotecomma}{% - \ifnum\csq@lastsf=1001 + \ifnum\csq@lastsf=1002 \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi} \newcommand*{\ifquotesemicolon}{% - \ifnum\csq@lastsf=1002 + \ifnum\csq@lastsf=1003 \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi} \newcommand*{\ifquotecolon}{% - \ifnum\csq@lastsf=1003 + \ifnum\csq@lastsf=1004 \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi} \newcommand*{\ifquoteterm}{% - \ifnum\csq@lastsf>1003 + \ifnum\csq@lastsf>1004 \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi} \newcommand*{\ifquoteperiod}{% - \ifnum\csq@lastsf=1004 + \ifnum\csq@lastsf=1005 \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi} \newcommand*{\ifquoteexclam}{% - \ifnum\csq@lastsf=1005 + \ifnum\csq@lastsf=1006 \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi} \newcommand*{\ifquotequestion}{% - \ifnum\csq@lastsf=1006 + \ifnum\csq@lastsf=1007 \expandafter\@firstoftwo \else \expandafter\@secondoftwo @@ -620,14 +705,18 @@ %% Babel interface \def\csq@setstyle#1{% + \begingroup + \let\if@safe@actives\iftrue \csq@ifcsundefined{csq@qstyle@#1} {\csq@warning + {Quote style `#1' not defined.\MessageBreak Ignoring command} {Quote style `#1' not defined} - {Ignoring command} - {Quote style `#1' not defined} - {Define the style or alias first before using it}} - {\edef\csq@currentstyle{#1}% - \@nameuse{csq@qstyle@#1}}} + {Define the style or alias first} + \endgroup} + {\edef\csq@tempa{\endgroup + \def\noexpand\csq@currentstyle{#1}% + \noexpand\@nameuse{csq@qstyle@#1}}% + \csq@tempa}} \def\csq@resetstyle{% \ifcsq@reset @@ -635,9 +724,9 @@ \else \csq@ifcsundefined{csq@qstyle@\languagename} {\csq@warning - {No quote style for language `\languagename'} - {Using fallback style} - {No quote style for language `\languagename'} + {No style for language `\languagename'.\MessageBreak + Using fallback style} + {No style for language `\languagename'} {Define a style or alias for this language first}% \csq@setstyle{fallback}} {\csq@setstyle{\languagename}}% @@ -654,7 +743,7 @@ {} {\@nameuse{otherlanguage*}{\csq@mainlang}}} -% \lowercase: workaround for page headers of standard classes +% \lowercase: workaround for page headers of book.cls et al. \def\csq@lang#1{% \csq@savelang @@ -687,13 +776,19 @@ {\csq@ifcsundefined{l@UKenglish} {} {\let\l@ukenglish\l@UKenglish}} - {}} + {}% + \ifcsq@ronce + \DeclareQuoteAlias{\languagename}{default}% + \fi} \csq@add\csq@mknobabel{% \ifcsq@reset - \csq@warn@nobabel{Disabling multilingual support}% + \csq@warn@nobabel{Cannot enable multilingual support}% \csq@resetfalse \fi + \ifcsq@ronce + \csq@warn@nobabel{Cannot adjust language}% + \fi \def\csq@resetqstyle{% \csq@warn@nobabel{Cannot enable multilingual support}}% \let\csq@lang\csq@nolang @@ -701,7 +796,10 @@ %% Markup with control sequences -% Argument parser +% Argument parsers + +% {}[][] => +% {\mkcitation}{}{} \def\csq@getcargs#1{% \@ifnextchar[%] @@ -716,7 +814,8 @@ \long\def\csq@getcargs@ii#1#2[#3]{% #1{\mkcitation}{#2}{#3}} -% Integrated argument parser +% {}[][]{}[] => +% {\mkccitation}{\csq@cite[][]{}}{} \def\csq@getccargs#1{% \@ifnextchar[%] @@ -771,7 +870,7 @@ % PDF strings \long\def\csq@pdf@quote#1{% - \if #1*\relax + \if#1*\relax \expandafter\@firstoftwo \else \expandafter\@secondoftwo @@ -785,7 +884,7 @@ \csq@pdf@oiqmark #1\csq@pdf@ciqmark} \long\def\csq@pdf@fquote#1{% - \if #1*\relax + \if#1*\relax \expandafter\@firstoftwo \else \expandafter\@secondoftwo @@ -793,7 +892,7 @@ {\expandafter\csq@pdf@quote@ii\@gobble} {\csq@pdf@quote@i}} -\csq@add\csq@mkpdfstrings{% +\csq@add\csq@mkhyperref{% \let\enquote\csq@pdf@quote \let\foreignquote\csq@pdf@fquote \let\hyphenquote\csq@pdf@fquote} @@ -817,7 +916,7 @@ \csq@ifblank{#3} {} {\csq@add\csq@tempa{#2{#3}}}% - #1\quotetext #5\endquotetext + #1\quotetext#5\endquotetext \csq@tempa\mkfintextpunct{#4}} % Text quotes + babel @@ -875,13 +974,13 @@ % PDF strings -\csq@add\csq@mkpdfstrings{% - \def\textquote{\csq@warn@pdfstrings\textquote}% - \def\foreigntextquote{\csq@warn@pdfstrings\foreigntextquote}% - \def\hyphentextquote{\csq@warn@pdfstrings\hyphentextquote}% - \def\textcquote{\csq@warn@pdfstrings\textcquote}% - \def\foreigntextcquote{\csq@warn@pdfstrings\foreigntextcquote}% - \def\hyphentextcquote{\csq@warn@pdfstrings\hyphentextcquote}} +\csq@add\csq@mkhyperref{% + \def\textquote{\pdfstringdefWarn\textquote}% + \def\foreigntextquote{\pdfstringdefWarn\foreigntextquote}% + \def\hyphentextquote{\pdfstringdefWarn\hyphentextquote}% + \def\textcquote{\pdfstringdefWarn\textcquote}% + \def\foreigntextcquote{\pdfstringdefWarn\foreigntextcquote}% + \def\hyphentextcquote{\pdfstringdefWarn\hyphentextcquote}} % Block quotes @@ -890,62 +989,57 @@ {\csq@err@mmode\blockquote} {\csq@getcargs{\csq@bquote{}}}} -% {}{}{}{}{} - \def\csq@bquote{% - \begingroup - \let\if@tempswa\ifcsq@block - \ifnum\csq@qlevel>\z@ - \@tempswatrue - \fi - \expandafter\endgroup\if@tempswa - \csq@err@mismatch{% - You have nested a block quotation. Block quotation - commands\MessageBreak may only be used on quotation - level 0}% - \expandafter\@gobblefive - \else - \expandafter\csq@bquote@i - \fi} + \csq@ifnested + {\csq@err@nbquote\@gobblefive} + {\ifinner + \expandafter\csq@bquote@iii + \else + \expandafter\csq@bquote@i + \fi}} -\providecommand{\@gobblefive}[5]{} +% {}{}{}{}{} \long\def\csq@bquote@i#1#2#3#4#5{% \begingroup - \def\@elt##1{\global\value{##1}\the\value{##1}\relax}% - \edef\csq@tempa{\cl@@ckpt}% - \let\@elt\relax - \let\csq@bquote\@gobblefive - \let\csq@error\@gobbletwo - \let\csq@warning\@gobblefour - \let\csq@info\@gobble - \let\label\@gobble - \let\index\@gobble - \let\glossary\@gobble - \@fileswfalse - \csq@blockfalse - \def\par{\csq@blocktrue\@par}% - \setbox\@tempboxa=\vbox{% - \parindent\z@ - \vrule \@height1\baselineskip \@width\z@ #1#5% - \ifcsq@block\aftergroup\csq@blocktrue\fi}% - \ifdim\ht\@tempboxa>\csq@threshold\baselineskip - \csq@blocktrue - \fi - \csq@tempa - \expandafter\endgroup\ifcsq@block - \expandafter\@firstoftwo + \def\@elt##1{\global\value{##1}\the\value{##1}\relax}% + \edef\csq@tempa{\cl@@ckpt}% + \let\@elt\relax + \let\csq@nbgobble\@gobble + \let\csq@bquote\@gobblefive + \let\csq@error\@gobbletwo + \let\csq@warning\@gobblethree + \let\csq@info\@gobble + \let\label\@gobble + \let\index\@gobble + \let\glossary\@gobble + \@fileswfalse + \csq@blockfalse + \def\par{\aftergroup\csq@blocktrue\@par}% + \setbox\@tempboxa=\vbox{% + \parfillskip\z@ \@plus 1fil\relax + \parindent\z@ + \vrule \@height1\baselineskip \@width\z@ #1#5}% + \ifdim\ht\@tempboxa>\csq@tshold\baselineskip + \csq@blocktrue + \fi + \ifcsq@block + \aftergroup\@firstoftwo \else - \expandafter\@secondoftwo + \aftergroup\@secondoftwo \fi - {\csq@bquote@ii{#1}{#2}{#3}{#4}{#5}} - {\csq@bquote@iii{#1}{#2}{#3}{#4}{#5}}} + \csq@tempa + \endgroup + {\csq@bquote@ii{#1}{#2}{#3}{#4}{#5}} + {\csq@bquote@iii{#1}{#2}{#3}{#4}{#5}}} + +\let\csq@nbgobble\@firstofone \long\def\csq@bquote@ii#1#2#3#4#5{% \csq@checkblockcite \begin{\csq@blockenvironment}% \csq@blocktrue - \begingroup #1% + \begingroup#1% \csq@setsfcodes \quoteblock #5% @@ -968,7 +1062,7 @@ \csq@ifblank{#3} {} {\csq@add\csq@tempa{#2{#3}}}% - #1\csq@qopen@i\quotetext #5\endquotetext + #1\csq@qopen@i\quotetext#5\endquotetext \csq@tempa\mkfinblockpunct{#4}} % Block quotes + babel @@ -1004,13 +1098,13 @@ % PDF strings -\csq@add\csq@mkpdfstrings{% - \def\blockquote{\csq@warn@pdfstrings\blockquote}% - \def\foreignblockquote{\csq@warn@pdfstrings\foreignblockquote}% - \def\hyphenblockquote{\csq@warn@pdfstrings\hyphenblockquote}% - \def\blockcquote{\csq@warn@pdfstrings\blockcquote}% - \def\foreignblockcquote{\csq@warn@pdfstrings\foreignblockcquote}% - \def\hyphenblockcquote{\csq@warn@pdfstrings\hyphenblockcquote}} +\csq@add\csq@mkhyperref{% + \def\blockquote{\pdfstringdefWarn\blockquote}% + \def\foreignblockquote{\pdfstringdefWarn\foreignblockquote}% + \def\hyphenblockquote{\pdfstringdefWarn\hyphenblockquote}% + \def\blockcquote{\pdfstringdefWarn\blockcquote}% + \def\foreignblockcquote{\pdfstringdefWarn\foreignblockcquote}% + \def\hyphenblockcquote{\pdfstringdefWarn\hyphenblockcquote}} % Display quotes @@ -1031,9 +1125,9 @@ \def\csq@bdquote#1{% \@nameuse{\csq@blockenvironment}% \csq@blocktrue - \begingroup #1% + \begingroup#1% \csq@setsfcodes - \quoteblock\ignorespaces} + \quoteblock} \def\csq@edquote{% \ifdim\lastskip>\z@\unskip\fi @@ -1083,8 +1177,8 @@ % Hooks -\newcommand*{\mkcitation}[1]{\space (#1)} -\newcommand*{\mkccitation}[1]{\space #1} +\newcommand*{\mkcitation}[1]{\space(#1)} +\newcommand*{\mkccitation}[1]{\space#1} \newcommand*{\mkmidtextpunct}[1]{} \newcommand*{\mkfintextpunct}[1]{#1} @@ -1100,7 +1194,7 @@ \def\csq@err@blockcite{% \csq@error - {Command `\string\blockcite' is depreciated} + {`\string\blockcite' is deprecated} {Please use `\string\mkcitation' instead}} \let\blockcite\csq@err@blockcite @@ -1108,258 +1202,500 @@ \ifx\blockcite\csq@err@blockcite \else \csq@warning - {`\string\blockcite' is superseded by `\string\mkcitation'} - {As a temporary solution, I will copy the current - definition\MessageBreak of `\string\blockcite' to - `\string\mkcitation'} - {Command `\string\blockcite' is depreciated} + {`\string\blockcite' superseded by + `\string\mkcitation'.\MessageBreak As a workaround, I will + copy the current definition\MessageBreak of + `\string\blockcite' to `\string\mkcitation'} + {`\string\blockcite' is deprecated} {Please use `\string\mkcitation' instead}% \let\mkcitation\blockcite \let\blockcite\csq@err@blockcite \fi} \newcommand*{\cquote}{% - \csq@info@legacy\cquote\textcquote} + \csq@warn@legacy\cquote\textcquote} \newcommand*{\foreigncquote}{% - \csq@info@legacy\foreigncquote\foreigntextcquote} + \csq@warn@legacy\foreigncquote\foreigntextcquote} \newcommand*{\hyphencquote}{% - \csq@info@legacy\hyphencquote\hyphentextcquote} + \csq@warn@legacy\hyphencquote\hyphentextcquote} %% Markup with active characters -% Manage active characters - \let\csq@dospecials\@empty -\let\csq@dodelimiters\@empty +\let\csq@doutfspecials\@empty \def\csq@do@dospecial#1#2{% \ifnum\catcode`#1=\active - \csq@info{Defining active character \string #1}% + \csq@info{Redefining character \string#1}% + \csq@letspecial{#1}{csq@special@\number`#1}% \else - \csq@info{Making \string #1 an active character}% - \fi - \csq@edefspecial{#1}{\noexpand\csq@special{\number`#1}}} + \csq@info{Making character \string#1 active}% + \csq@letspecial{#1}{csq@special@\number`#1}% + \catcode`#1=\active + \fi} \def\csq@do@undospecial#1#2{% \ifnum#2=\active - \csq@info{Resetting active character \string #1}% - \catcode`#1=\active - \expandafter\let - \expandafter #1\csname csq@saved@\number`#1\endcsname + \csq@info{Resetting character \string#1}% + \csq@letspecial{#1}{csq@saved@\number`#1}% \else - \csq@info{Resetting catcode of character \string #1}% - \catcode`#1=#2 + \csq@info{Resetting catcode of \string#1}% + \catcode`#1=#2\relax \fi} \def\csq@do@verbspecial#1#2{% - \ifnum`#1<128 - \csq@edefspecial{#1}{\string #1}% + \csq@info{Redefining character \string#1}% + \ifnum`#1<128\relax + \csq@edefspecial{#1}{\string#1}% \else - \csq@edefspecial{#1}{% - \noexpand\@nameuse{csq@saved@\number`#1}}% + \csq@letspecial{#1}{csq@saved@\number`#1}% \fi} -\def\csq@do@fixdelim#1#2{% - \ifnum\catcode`#1=#2 - \else - \csq@info{Restoring catcode of character \string #1}% - \catcode`#1=#2 +\def\csq@do@doutfspecial#1{% + \csq@info{Redefining character \csq@utfprint{#1}}% + \csq@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}}} + +\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} + +\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} + +\def\csq@mkenable{% + \let\do\csq@do@dospecial + \csq@dospecials + \let\do\csq@do@doutfspecial + \csq@doutfspecials + \let\do\noexpand + \csq@activetrue} + +\def\csq@mkdisable{% + \ifcsq@active + \let\do\csq@do@undospecial + \csq@dospecials + \let\do\csq@do@undoutfspecial + \csq@doutfspecials + \let\do\noexpand + \csq@activefalse + \fi} + +\def\csq@mkverbatim{% + \ifcsq@active + \let\do\csq@do@verbspecial + \csq@dospecials + \let\do\csq@do@undoutfspecial + \csq@doutfspecials + \let\do\noexpand \fi} -% Register active characters +\def\csq@mkdelete{% + \csq@mkdisable + \let\do\csq@do@delspecial + \csq@dospecials + \let\do\csq@do@delutfspecial + \csq@doutfspecials + \let\do\noexpand + \let\csq@dospecials\@empty + \let\csq@doutfspecials\@empty + \let\csq@mkpdfstrings\@empty} + +\let\csq@mkpdfstrings\@empty +\csq@add\csq@mkhyperref{\csq@mkpdfstrings} + +% Regular specials -\def\csq@addspecial#1#2#3{% - \csq@checkquote{#1}{\csq@addspecial@i{#1}{#2}{#3}}} +% {}{}{}{} -% {}{}{} +\def\csq@addspecial#1#2#3#4{% + \csq@validate{#1} + {\csq@addspecial@i@s{#1}{\csqQQ}{#2}{#3}{#4}} + {\csq@addspecial@i@u{#1}{\csqQQ}{#2}{#3}{#4}}} -\def\csq@addspecial@i#1#2#3{% - \@namedef{csq@string@\number`#1}{\string #1}% - \@namedef{csq@active@\number`#1}{#2}% - \@namedef{csq@pdfstr@\number`#1}{#3}% +% {}{}{}{}{} + +\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}}% \ifnum\catcode`#1=\active - \expandafter\let\csname csq@saved@\number`#1\endcsname #1% + \csq@cslet{csq@saved@\number`#1}{#1}% \else - \@namedef{csq@saved@\number`#1}{#1}% - \fi - \csq@eadd\csq@dospecials{% - \noexpand\do{\noexpand #1}{\the\catcode`#1}}% - \ifnum`#1<128 - \csq@addto@dolist{#1}{\dospecials}{\do}% + \csq@csdef{csq@saved@\number`#1}{#1}% \fi - \csq@addto@dolist{#1}{\@sanitize}{\@makeother}} + \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}}% + \ifnum`#1<128\relax + \csq@addto@list{#1}{\dospecials}{\do}% + \csq@addto@list{#1}{\@sanitize}{\@makeother}% + \fi} -% {}{}{} +% {}{}{}{}{} -\def\csq@addpdfspecial#1#2#3{% - \csq@add\csq@mkpdfstrings{\csq@defpdfspecial{#1}{#2}{#3}}} +\def\csq@addspecial@i@u#1#2#3#4#5{% + \csq@info{Allocating character \csq@utfprint{#1}}% + \csq@csedef{csq@special@\csq@number{#1}}{% + \noexpand#2{\csq@number{#1}}}% + \csq@ifcsundefined{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}}}} + +% Block specials + +% {}{}{}{} \def\csq@addbspecial#1#2#3#4{% - \csq@checkquote{#1}{% - \@namedef{csq@saved@\number`#1}{}% - \csq@checkdelim{#2}{% - \@namedef{csq@delim@\number`#2}{}% - \csq@checkdelim{#3}{% - \@namedef{csq@delim@\number`#3}{}% - \ifnum`#2=`#3 - \csq@err@alloc{#2}% - \else - \csq@addbspecial@i{#1}{#2}{#3}{#4}% - \fi}}}} - -% {}{}{}{} - -\def\csq@addbspecial@i#1#2#3#4{% + \csq@validate{#1} + {\csq@addbspecial@i@s{#1}{#2}{#3}{#4}} + {\csq@addbspecial@i@u{#1}{#2}{#3}{#4}}} + +\def\csq@addbspecial@i@s#1#2#3#4{% \begingroup - \edef\csq@tempa{\endgroup - \noexpand\csq@addspecial@i - {\noexpand #1} - {\csname csq@block@\number`#1\endcsname}% - {\noexpand\csq@warn@pdfstrings{\string #1}}% - \noexpand\csq@defbspecial - {\csname csq@block@\number`#1\endcsname}}% - \csq@add\csq@tempa{{#2}{#3}{#4}}% + \def\csq@tempa{\endgroup\csq@addspecial@i@s{#1}{\csqBQ}{}}% + \csq@eadd\csq@tempa{% + {\expandafter\noexpand\csname csq@saved@\number`#1\endcsname + \noexpand\pdfstringdefWarn{\string#1}}{}}% \csq@tempa - \csq@eadd\csq@dodelimiters{% - \noexpand\do{\noexpand #2}{\the\catcode`#2}% - \noexpand\do{\noexpand #3}{\the\catcode`#3}}} + \csq@validate{#2} + {\csq@addbspecial@ii@s{\number`#1}{#2}{#3}{#4}} + {\csq@addbspecial@ii@u{\number`#1}{#2}{#3}{#4}}} + +\def\csq@addbspecial@i@u#1#2#3#4{% + \begingroup + \def\csq@tempa{\endgroup\csq@addspecial@i@u{#1}{\csqBQ}{}}% + \csq@eadd\csq@tempa{% + {\expandafter\noexpand\csname csq@saved@\csq@number{#1}\endcsname + \noexpand\pdfstringdefWarn{\csq@utfprint{#1}}}{}}% + \csq@tempa + \csq@validate{#2} + {\csq@addbspecial@ii@s{\csq@number{#1}}{#2}{#3}{#4}} + {\csq@addbspecial@ii@u{\csq@number{#1}}{#2}{#3}{#4}}} + +\def\csq@addbspecial@ii@s#1#2#3#4{% + \csq@addspecial@i@s{#2}{\csqBQsep}{}{}{}% + \begingroup + \let\csq@tempa\@empty + \def\csq@tempb{{#1}}% + \uccode`\~=`#2\relax + \uppercase{\csq@add\csq@tempb{{~}}}% + \csq@add\csq@tempb{{#3}{#4}}% + \csq@validate{#3} + {\expandafter\def\expandafter\csq@tempa + \expandafter{\expandafter\csq@addbspecial@iii@s\csq@tempb}} + {\expandafter\def\expandafter\csq@tempa + \expandafter{\expandafter\csq@addbspecial@iii@u\csq@tempb}}% + \expandafter\endgroup\csq@tempa} + +\def\csq@addbspecial@ii@u#1#2#3#4{% + \csq@addspecial@i@u{#2}{\csqBQsep}{}{}{}% + \csq@validate{#3} + {\csq@addbspecial@iii@s{#1}{#2}{#3}{#4}} + {\csq@addbspecial@iii@u{#1}{#2}{#3}{#4}}} + +\def\csq@addbspecial@iii@s#1#2#3#4{% + \csq@addspecial@i@s{#3}{\csqBQend}{}{}{}% + \begingroup + \def\csq@tempa{{#1}{#2}}% + \uccode`\~=`#3\relax + \uppercase{\csq@add\csq@tempa{~}}% + \csq@add\csq@tempa{{#4}}% + \expandafter\endgroup + \expandafter\csq@addbspecial@iv\csq@tempa} + +\def\csq@addbspecial@iii@u#1#2#3#4{% + \csq@addspecial@i@u{#3}{\csqBQend}{}{}{}% + \csq@addbspecial@iv{#1}{#2}{#3}{#4}} + +\def\csq@addbspecial@iv#1#2#3#4{% + \expandafter\csq@defbspecial + \expandafter{\csname csq@textdef@#1\endcsname}{#2}{#3}{#4}% + \expandafter\csq@defxbspecial + \expandafter{\csname csq@xtxtdef@#1\endcsname}{#4}} + +% Specials + +\newcommand*{\csqQQ}[1]{% + \csq@ifsafeactives + {\@nameuse{csq@string@#1}} + {\csq@iftypeset + {\csq@ifmmode + {\@nameuse{csq@saved@#1}} + {\@nameuse{csq@textdef@#1}}} + {\csq@ifstrings + {\@nameuse{csq@string@#1}} + {\noexpand\csqQQ{#1}}}}} + +\newcommand*{\csqBQ}[1]{% + \csq@ifsafeactives + {\@nameuse{csq@string@#1}} + {\csq@iftypeset + {\csq@ifmmode + {\@nameuse{csq@saved@#1}} + {\csq@ifnested + {\csq@err@nbquote} + {\csq@nbgobble{\@nameuse{csq@textdef@#1}}}}} + {\csq@ifstrings + {\@nameuse{csq@string@#1}} + {\noexpand\csqBQbeg{#1}}}}} + +\newcommand*{\csqBQbeg}[1]{% + \csq@ifsafeactives + {\@nameuse{csq@string@#1}} + {\csq@iftypeset + {\csq@ifmmode + {\@nameuse{csq@saved@#1}} + {\csq@ifnested + {\csq@err@nbquote} + {\csq@nbgobble{\@nameuse{csq@xtxtdef@#1}}}}} + {\csq@ifstrings + {\@nameuse{csq@string@#1}} + {\noexpand\csqBQbeg{#1}}}}} + +\newcommand*{\csqBQsep}[1]{% + \csq@ifsafeactives + {\@nameuse{csq@string@#1}} + {\csq@iftypeset + {\@nameuse{csq@saved@#1}} + {\csq@ifstrings + {\@nameuse{csq@string@#1}} + {\noexpand\csqBQsep{#1}}}}} + +\newcommand*{\csqBQend}[1]{% + \csq@ifsafeactives + {\@nameuse{csq@string@#1}} + {\csq@iftypeset + {\@nameuse{csq@saved@#1}} + {\csq@ifstrings + {\@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} -% Define and use active characters +% Define specials + +% {}{} \def\csq@edefspecial#1#2{% \begingroup - \catcode`\~=\active - \uccode`\~=`#1\relax - \uppercase{\endgroup\edef~}{#2}% - \catcode`#1=\active} + \uccode`\~=`#1\relax + \uppercase{\endgroup\edef~}{#2}} + +% {}{} -\def\csq@defpdfspecial#1#2#3{% +\def\csq@letspecial#1#2{% \begingroup - \catcode`\~=\active - \uccode`\~=`#1\relax - \uppercase{\endgroup\def~##1~}{#2##1#3}} + \uccode`\~=`#1\relax + \uppercase{\def\csq@tempa{\endgroup\let~}}% + \expandafter\csq@tempa\csname#2\endcsname} -% {}{}{}{} +% {}{}{}{} \def\csq@defbspecial#1#2#3#4{% - \long\def#1##1#3{\csq@bspecial{##1}{#2}{#4}}} + \long\def#1##1#3{\csq@bspecial@i{##1}{#2}{#4}}} -\def\csq@special{% - \ifx\if@safe@actives\iftrue - \expandafter\csq@special@string - \else - \ifx\protect\@typeset@protect - \ifmmode - \expandafter\expandafter\expandafter - \expandafter\expandafter\expandafter - \expandafter\csq@special@saved - \else - \expandafter\expandafter\expandafter - \expandafter\expandafter\expandafter - \expandafter\csq@special@active - \fi - \else - \ifx\protect\string - \string\csq@special - \else - \noexpand\csq@special - \fi - \fi - \fi} +% {}{}{} -\def\csq@special@saved#1{\@nameuse{csq@saved@#1}} -\def\csq@special@string#1{\@nameuse{csq@string@#1}} -\def\csq@special@active#1{\@nameuse{csq@active@#1}} -\def\csq@special@pdfstr#1{\@nameuse{csq@pdfstr@#1}} +\long\def\csq@bspecial@i#1#2#3{% + \long\def\csq@bspecial@ii##1#2##2&{% + \csq@ifblank{##2} + {#3{}{}{#1}} + {\csq@bspecial@iii#1&}}% + \long\def\csq@bspecial@iii##1#2##2&{% + #3{##2}{}{##1}}% + \csq@bspecial@ii#1#2&} -\csq@add\csq@mkpdfstrings{\let\csq@special\csq@special@pdfstr} +% {}{} -% {}{}{} +\def\csq@defxbspecial#1#2{% + \long\def#1##1\csqBQend##2{\csq@xbspecial@i{##1}{#2}}} -\begingroup - \catcode`\&=3 +% {}{} - \long\gdef\csq@bspecial#1#2#3{% - \long\def\csq@bspecial@i##1#2##2&{% - \csq@ifblank{##2} - {#3{}{}{#1}} - {\csq@bspecial@ii#1&}}% - \long\def\csq@bspecial@ii##1#2##2&{% - #3{##2}{}{##1}}% - \csq@bspecial@i#1#2&} +\long\def\csq@xbspecial@i#1#2{% + \long\def\csq@xbspecial@ii##1\csqBQsep##2&{% + \csq@ifblank{##2} + {#2{}{}{#1}} + {\csq@xbspecial@iii#1&}}% + \long\def\csq@xbspecial@iii##1\csqBQsep##2##3&{% + #2{##3}{}{##1}}% + \csq@xbspecial@ii#1\csqBQsep&} -\endgroup +% {}{}{} + +\def\csq@defpspecial#1#2#3{% + \begingroup + \uccode`\~=`#1\relax + \uppercase{\endgroup\def~##1~}{#2##1#3}} + +% {}{}{} + +\def\csq@defupspecial#1#2#3{% + \expandafter\def\csname u8:\csq@string{#1}\endcsname##1#1{#2##1#3}} % Validate user input -\def\csq@checkquote#1{% - \csq@ifsingle{#1} - {\csq@ifccode@quote{#1} - {\csq@ifcsundefined{csq@saved@\number`#1} - {\csq@ifcsundefined{csq@delim@\number`#1} - {\@firstofone} - {\csq@err@alloc{#1}\@gobble}} - {\csq@err@alloc{#1}\@gobble}} - {\csq@err@invquote\@gobble}} - {\csq@err@invquote\@gobble}} - -\def\csq@checkdelim#1{% - \csq@ifsingle{#1} - {\csq@ifccode@delim{#1} - {\csq@ifcsundefined{csq@saved@\number`#1} - {\@firstofone} - {\csq@err@alloc{#1}\@gobble}} - {\csq@err@invdelim\@gobble}} - {\csq@err@invdelim\@gobble}} - -\def\csq@ifccode@quote#1{% +% {}{}{} + +\def\csq@validate#1#2#3{% + \csq@ifutfchar{#1} + {\csq@ifvalidutf{#1} + {\csq@ifcsundefined{csq@special@\csq@number{#1}} + {#3} + {\csq@err@alloc}} + {\csq@err@invldutf}} + {\csq@ifvalidchar{#1} + {\csq@ifcsundefined{csq@special@\number`#1} + {#2} + {\csq@err@alloc}} + {\csq@err@invldchar}}} + +% {}{}{} + +\def\csq@ifutfchar#1{% + \csq@ifcsundefined{@inpenc@undefined} + {\@secondoftwo} + {\begingroup + \def\@inpenc@undefined@##1{\def\csq@tempa{##1}}% + \@inpenc@undefined + \ifx\csq@tempa\csq@utfenc + \aftergroup\@firstoftwo + \else + \aftergroup\@secondoftwo + \ifx\csq@tempa\csq@ucsenc + \csq@err@ucs + \fi + \fi + \endgroup}% + {\csq@ifsingle{#1} + {\ifnum`#1<128\relax + \expandafter\@secondoftwo + \else + \csq@err@invldutf + \expandafter\@gobbletwo + \fi} + {\@firstoftwo}} + {\csq@ifsingle{#1} + {\@secondoftwo} + {\csq@err@invldchar + \@gobbletwo}}} + +\def\csq@utfenc{utf8} +\def\csq@ucsenc{utf8x} + +% {}{}{} + +\long\def\csq@ifsingle#1{% + \csq@ifblank{#1} + {\@secondoftwo} + {\expandafter\csq@ifsingle@i + \string#1&&\@secondoftwo\@firstoftwo:}} +\long\def\csq@ifsingle@i#1#2#3#5#6:{#5} + +% {}{}{} + +\def\csq@ifvalidchar#1{% \begingroup - \@tempswafalse - \ifcase\catcode`#1 % 0 escape - \or % 1 begin group - \or % 2 end group - \or % 3 math shift - \or % 4 alignment - \or % 5 eol - \or % 6 parameter - \or\@tempswatrue % 7 superscript - \or\@tempswatrue % 8 subscript - \or % 9 ignored - \or % 10 space - \or % 11 letter - \or\@tempswatrue % 12 other - \or\@tempswatrue % 13 active - \or % 14 comment - \else % 15 invalid + \@tempswafalse + \ifnum\active=\catcode`#1\relax + \@tempswatrue + \else\ifnum12=\catcode`#1\relax + \@tempswatrue + \fi\fi + \if@tempswa + \csq@ifvalidchar@i{#1}% + \fi + \if@tempswa + \aftergroup\@firstoftwo + \else + \aftergroup\@secondoftwo + \fi + \endgroup} + +\def\csq@ifvalidchar@i#1{% + \def\break\fi##1\relax{\fi\@tempswafalse}% + \def\do##1{\ifnum`##1=`#1\relax\break\fi}% + \csq@resrvdchars\relax} + +\def\csq@resrvdchars{% + \do\[\do\]\do\@\do\*\do\~\do\-\do\`\do\'\do\.\do\,\do\;\do\:% + \do\!\do\?\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9} + +% {}{}{} + +\def\csq@ifvalidutf#1{% + \csq@ifblank{#1}{\@secondoftwo}{\csq@ifvalidutf@i#1&}} + +\def\csq@ifvalidutf@i#1#2&{% + \csq@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&}} + {\@secondoftwo}} + +% 0xC0-0xFD, 0x80-0xBF, 0x80-0xBF, ... + +\def\csq@ifutfstart#1{% + \ifnum`#1>191\relax + \ifnum`#1<254\relax + \expandafter\expandafter + \expandafter\@firstoftwo + \else + \expandafter\expandafter + \expandafter\@secondoftwo \fi - \expandafter\endgroup\if@tempswa - \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi} -\def\csq@ifccode@delim#1{% - \begingroup - \@tempswafalse - \ifcase\catcode`#1 % 0 escape - \or % 1 begin group - \or % 2 end group - \or\@tempswatrue % 3 math shift - \or\@tempswatrue % 4 alignment - \or % 5 eol - \or % 6 parameter - \or\@tempswatrue % 7 superscript - \or\@tempswatrue % 8 subscript - \or % 9 ignored - \or % 10 space - \or % 11 letter - \or\@tempswatrue % 12 other - \or\@tempswatrue % 13 active - \or % 14 comment - \else % 15 invalid +\def\csq@ifutfnext#1{% + \ifnum`#1>127\relax + \ifnum`#1<192\relax + \expandafter\expandafter + \expandafter\@firstoftwo + \else + \expandafter\expandafter + \expandafter\@secondoftwo \fi - \expandafter\endgroup\if@tempswa - \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi} @@ -1367,95 +1703,77 @@ % User interface \newcommand*{\MakeOuterQuote}[1]{% - \csq@addspecial{#1}{\csq@oqmark}{}% - \csq@addpdfspecial{#1}{\csq@pdf@ooqmark}{\csq@pdf@coqmark}} -\@onlypreamble\MakeOuterQuote + \csq@addspecial{#1}{\csq@oqmark} + {\csq@pdf@ooqmark}{\csq@pdf@coqmark}} \newcommand*{\MakeInnerQuote}[1]{% - \csq@addspecial{#1}{\csq@iqmark}{}% - \csq@addpdfspecial{#1}{\csq@pdf@oiqmark}{\csq@pdf@ciqmark}} -\@onlypreamble\MakeInnerQuote + \csq@addspecial{#1}{\csq@iqmark} + {\csq@pdf@oiqmark}{\csq@pdf@ciqmark}} \newcommand*{\MakeAutoQuote}[2]{% - \csq@addspecial{#1}{\csq@qopen}{\csq@pdf@ooqmark}% - \csq@addspecial{#2}{\csq@qclose}{\csq@pdf@coqmark}} -\@onlypreamble\MakeAutoQuote + \csq@addspecial{#1}{\csq@qopen}{\csq@pdf@ooqmark}{}% + \csq@addspecial{#2}{\csq@qclose}{\csq@pdf@coqmark}{}} \newcommand*{\MakeForeignQuote}[3]{% - \csq@addspecial{#2}{\csq@qopen@lang{#1}}{\csq@pdf@ooqmark}% - \csq@addspecial{#3}{\csq@qclose}{\csq@pdf@coqmark}} -\@onlypreamble\MakeForeignQuote + \csq@addspecial{#2}{\csq@bqgroup\csq@lang{#1}\csq@qopen@i}% + {\csq@pdf@ooqmark}{}% + \csq@addspecial{#3}{\csq@qclose}{\csq@pdf@coqmark}{}} \newcommand*{\MakeHyphenQuote}[3]{% - \csq@addspecial{#2}{\csq@qopen@hyph{#1}}{\csq@pdf@ooqmark}% - \csq@addspecial{#3}{\csq@qclose}{\csq@pdf@coqmark}} -\@onlypreamble\MakeHyphenQuote + \csq@addspecial{#2}{\csq@bqgroup\csq@hyph{#1}\csq@qopen@i}% + {\csq@pdf@ooqmark}{}% + \csq@addspecial{#3}{\csq@qclose}{\csq@pdf@coqmark}{}} \newcommand*{\MakeBlockQuote}[3]{% - \csq@addbspecial{#1}{#2}{#3}{% - \csq@bquote{}{\mkcitation}}} -\@onlypreamble\MakeBlockQuote + \csq@addbspecial{#1}{#2}{#3}{\csq@bquote{}{\mkcitation}}} \newcommand*{\MakeForeignBlockQuote}[4]{% - \csq@addbspecial{#2}{#3}{#4}{% - \csq@bquote{\csq@lang{#1}}{\mkcitation}}} -\@onlypreamble\MakeForeignBlockQuote + \csq@addbspecial{#2}{#3}{#4}% + {\csq@bquote{\csq@lang{#1}}{\mkcitation}}} \newcommand*{\MakeHyphenBlockQuote}[4]{% - \csq@addbspecial{#2}{#3}{#4}{% - \csq@bquote{\csq@hyph{#1}}{\mkcitation}}} -\@onlypreamble\MakeHyphenBlockQuote + \csq@addbspecial{#2}{#3}{#4}% + {\csq@bquote{\csq@hyph{#1}}{\mkcitation}}} -\newcommand*{\RestoreQuotes}{% - \csq@warn@location\RestoreQuotes} -\newcommand*{\DisableQuotes}{% - \csq@warn@location\DisableQuotes} +\newcommand*{\EnableQuotes}{} +\newcommand*{\DisableQuotes}{} +\newcommand*{\VerbatimQuotes}{} +\newcommand*{\DeleteQuotes}{\csq@mkdelete} \AtBeginDocument{% - \def\RestoreQuotes{% - \let\do\csq@do@dospecial - \csq@dospecials - \let\do\csq@do@fixdelim - \csq@dodelimiters - \csq@activetrue - \let\do\noexpand}% - \def\DisableQuotes{% - \let\do\csq@do@undospecial - \csq@dospecials - \csq@activefalse - \let\do\noexpand}} + \def\EnableQuotes{\csq@mkenable}% + \def\DisableQuotes{\csq@mkdisable}% + \def\VerbatimQuotes{\csq@mkverbatim}} % Author interface -\newcommand*{\@restorequotes}{} +\newcommand*{\@enablequotes}{} \newcommand*{\@disablequotes}{} \newcommand*{\@verbatimquotes}{} +\newcommand*{\@deletequotes}{% + \csq@quiettrue + \csq@mkdelete + \csq@quietfalse} \AtBeginDocument{% - \def\@restorequotes{% + \def\@enablequotes{% \csq@quiettrue - \let\do\csq@do@dospecial - \csq@dospecials - \let\do\csq@do@fixdelim - \csq@dodelimiters - \csq@quietfalse - \csq@activetrue - \let\do\noexpand}% + \csq@mkenable + \csq@quietfalse}% \def\@disablequotes{% \csq@quiettrue - \let\do\csq@do@undospecial - \csq@dospecials - \csq@quietfalse - \csq@activefalse - \let\do\noexpand}% + \csq@mkdisable + \csq@quietfalse}% \def\@verbatimquotes{% - \ifcsq@active - \csq@quiettrue - \let\do\csq@do@verbspecial - \csq@dospecials - \csq@quietfalse - \let\do\noexpand - \fi}} + \csq@quiettrue + \csq@mkverbatim + \csq@quietfalse}} + +% Legacy + +\newcommand*{\RestoreQuotes}{% + \csq@warn@legacy\RestoreQuotes\EnableQuotes} +\newcommand*{\@restorequotes}{\@enablequotes} %% Switch quote styles manually @@ -1473,7 +1791,7 @@ \fi \csq@ifblank{#1} {\csq@setstyle{#2}} - {\csq@setstyle{#2/#1}}} + {\csq@setstyle{#2@#1}}} \def\csq@resetqstyle{% \csq@info{Enabling multilingual support}% @@ -1483,9 +1801,10 @@ \newcommand*{\DeclareQuoteStyle}[2][]{% \begingroup + \let\if@safe@actives\iftrue \csq@ifblank{#1} - {\def\csq@tempa{#2}} - {\def\csq@tempa{#2/#1}}% + {\edef\csq@tempa{#2}} + {\edef\csq@tempa{#2@#1}}% \csq@ifcsundefined{csq@qstyle@\csq@tempa} {} {\csq@info{Redefining quotation style `\csq@tempa'}}% @@ -1540,13 +1859,14 @@ \newcommand*{\DeclareQuoteAlias}[3][]{% \begingroup + \let\if@safe@actives\iftrue \csq@ifblank{#1} - {\def\csq@tempa{#2}} - {\def\csq@tempa{#2/#1}}% + {\edef\csq@tempa{#2}} + {\edef\csq@tempa{#2@#1}}% \csq@ifcsundefined{csq@qstyle@\csq@tempa} {\csq@error - {Quote style `\csq@tempa' not defined} - {Define the style or alias first before using it}} + {Quote style not defined} + {Define the style or alias `\csq@tempa' first}} {\csq@ifcsundefined{csq@qstyle@#3} {} {\csq@info{Redefining alias `#3' -> `\csq@tempa'}}% @@ -1559,17 +1879,17 @@ %% Define quotes for PDF strings \newcommand*{\DeclarePlainStyle}[4]{% - \gdef\csq@pdf@ooqmark{#1}% - \gdef\csq@pdf@coqmark{#2}% - \gdef\csq@pdf@oiqmark{#3}% - \gdef\csq@pdf@ciqmark{#4}} + \def\csq@pdf@ooqmark{#1}% + \def\csq@pdf@coqmark{#2}% + \def\csq@pdf@oiqmark{#3}% + \def\csq@pdf@ciqmark{#4}} \@onlypreamble\DeclarePlainStyle %% Define package options \newcommand*{\DeclareQuoteOption}[1]{% - \define@key{csq}{#1}{\DeclareQuoteAlias{#1/##1}{#1}}} + \define@key{csq}{#1}{\DeclareQuoteAlias[##1]{#1}{#1}}} \AtEndOfPackage{% \def\DeclareQuoteOption#1{% @@ -1578,7 +1898,7 @@ %% Set defaults \newcommand*{\SetBlockThreshold}[1]{% - \csq@threshold=#1\relax} + \csq@tshold=#1\relax} \newcommand*{\SetBlockEnvironment}[1]{% \csq@ifcsundefined{#1} @@ -1593,12 +1913,21 @@ % Legacy commands \newcommand*{\setblockthreshold}{% - \csq@info@legacy\setblockthreshold\SetBlockThreshold} - + \csq@warn@legacy\setblockthreshold\SetBlockThreshold} \newcommand*{\setblockenvironment}{% - \csq@info@legacy\setblockenvironment\SetBlockEnvironment} + \csq@warn@legacy\setblockenvironment\SetBlockEnvironment} + +%% Author interface to internal marks -%% Frontend to internal marks +\newcommand*{\initoquote}{% + \csq@resetstyle + \csq@qlevel\@ne + \csq@theqmark@oinit} + +\newcommand*{\initiquote}{% + \csq@resetstyle + \csq@qlevel\tw@ + \csq@theqmark@iinit} \newcommand*{\textooquote}{% \csq@resetstyle @@ -1626,14 +1955,14 @@ %% Space factor codes -\@namedef{csq@sfcodes@OT1}{% +\csq@csdef{csq@sfcodes@OT1}{% \sfcode 96=\z@ % textquoteleft \sfcode 39=\z@ % textquoteright \sfcode 92=\z@ % textquotedblleft \sfcode 34=\z@ % textquotedblright } -\@namedef{csq@sfcodes@T1}{% +\csq@csdef{csq@sfcodes@T1}{% \sfcode 96=\z@ % textquoteleft \sfcode 39=\z@ % textquoteright \sfcode 16=\z@ % textquotedblleft @@ -1649,7 +1978,7 @@ \sfcode 34=\z@ % textquotedbl } -\@namedef{csq@sfcodes@LY1}{% +\csq@csdef{csq@sfcodes@LY1}{% \sfcode 96=\z@ % textquoteleft \sfcode 39=\z@ % textquoteright \sfcode147=\z@ % textquotedblleft @@ -1671,7 +2000,7 @@ \newcommand*{\seteverylineleft}[1]{% \csq@ifcsundefined{localleftbox} {\csq@warn@noomega\csq@currentstyle} - {\leavevmode\localleftbox{#1}}} + {\leavevmode\null\localleftbox{#1}}} \newcommand*{\seteverylineright}[1]{% \csq@ifcsundefined{localrightbox} @@ -1681,14 +2010,16 @@ % Improved spacing for French \newcommand*{\frenchnbspace}{% - \penalty\@M\hskip 0.8\fontdimen2\font - plus 0.3\fontdimen3\font minus 0.8\fontdimen4\font} + \penalty\@M + \hskip 0.8\fontdimen2\font + plus 0.3\fontdimen3\font + minus 0.8\fontdimen4\font} \newcommand*{\mkfrenchopenquote}[1]{% - \leavevmode #1\frenchnbspace} + \leavevmode#1\frenchnbspace} \newcommand*{\mkfrenchclosequote}[1]{% - \frenchnbspace #1} + \frenchnbspace#1} \newcommand*{\initfrenchquotes}{% \let\csq@themark\csq@frenchmark} @@ -1701,11 +2032,11 @@ \relax \else \ifnum\spacefactor=1005 - \relax + \relax \else - \ifnum\spacefactor=1006 - \relax - \fi + \ifnum\spacefactor=1006 + \relax + \fi \fi \fi \fi} @@ -1754,11 +2085,16 @@ [0.05em] {\textquoteright} {\textquoteright} -\DeclareQuoteStyle[quotes]{french}% verified +\DeclareQuoteStyle[quotes]{french} {\mkfrenchopenquote{\guillemotleft}} {\mkfrenchclosequote{\guillemotright}} {\mkfrenchopenquote{\textquotedblleft}} {\mkfrenchclosequote{\textquotedblright}} +\DeclareQuoteStyle[quotes*]{french} + {\mkfrenchopenquote{\guillemotleft}} + {\mkfrenchclosequote{\guillemotright}} + {\textquotedblleft} + {\textquotedblright} \DeclareQuoteStyle[guillemets]{french} [\initfrenchquotes] {\mkfrenchopenquote{\guillemotleft}} @@ -1782,13 +2118,13 @@ {\mkfrenchclosequote{\guillemotright}} \DeclareQuoteStyle[imprimerie]{french} [\initfrenchquotes] - [\seteverylineleft{\mkfrenchopenquote{\guillemotleft}}] - {\mkfrenchopenquote{\guillemotleft}} - [\mkfrenchopenquote{\guillemotleft}] - {\mkfrenchclosequote{\guillemotright}} - {\mkfrenchopenquote{\guillemotleft}} + [\seteverylineleft{\guillemotleft\nobreakspace}] + {\guillemotleft\nobreakspace} + [\guillemotleft\nobreakspace] + {\nobreakspace\guillemotright} + {\guillemotleft\nobreakspace} [\relax] - {\mkfrenchclosequote{\guillemotright}} + {\nobreakspace\guillemotright} \DeclareQuoteStyle[quotes]{german}% verified {\quotedblbase} {\textquotedblleft} @@ -1817,6 +2153,7 @@ {\guillemotleft} [\textquotedblright]% ??? {\guillemotright} + [0.025em] {\textquotedblleft} {\textquotedblright} \DeclareQuoteStyle[guillemets]{norwegian} @@ -1831,6 +2168,12 @@ [0.05em] {\quotesinglbase} {\textquoteright} +\DeclareQuoteStyle{spanish} + {\guillemotleft} + {\guillemotright} + [0.025em] + {\textquotedblleft} + {\textquotedblright} \DeclareQuoteStyle[quotes]{swedish}% verified {\textquotedblright} {\textquotedblright} @@ -1852,16 +2195,12 @@ {\csq@dummymark} {\csq@dummymark} -\def\csq@dummymark{\mbox{\kern0.1em\textbf{?}\kern0.1em}} -\def\csq@errormark{\mbox{\kern0.1em\rule{1ex}{1ex}\kern0.1em}} +\def\csq@dummymark{\textbf{?}} +\def\csq@errormark{\rule{1ex}{1ex}} % PDF strings -\DeclarePlainStyle - {\string"} - {\string"} - {\string'} - {\string'} +\DeclarePlainStyle{"}{"}{'}{'} %% Built-in aliases @@ -1891,32 +2230,49 @@ %% Package options +\newcommand*{\ExecuteQuoteOptions}[1]{% + \begingroup + \let\if@safe@actives\iftrue + \edef\csq@tempa{\endgroup + \noexpand\setkeys{csq}{#1}}% + \csq@tempa} + +\AtBeginDocument{% + \def\ExecuteQuoteOptions#1{% + \csq@warn@location\ExecuteQuoteOptions}} + % Core options \define@key{csq}{strict}[true]{% - \expandafter\ifx\csname if#1\endcsname\iftrue - \csq@info{Enabling strict warnings}% - \csq@stricttrue - \else - \csq@info{Disabling strict warnings}% - \csq@strictfalse - \fi} + \csq@ifcsundefined{csq@opt@strict@#1} + {\csq@err@invldopt{strict=#1}} + {\@nameuse{csq@opt@strict@#1}}} +\def\csq@opt@strict@true{% + \csq@info{Enabling strict warnings}% + \let\csq@warning\csq@warning@strict} +\def\csq@opt@strict@false{% + \csq@info{Disabling strict warnings}% + \let\csq@warning\csq@warning@loose} \define@key{csq}{babel}[true]{% - \expandafter\ifx\csname if#1\endcsname\iftrue - \csq@info{Enabling multilingual support}% - \csq@resettrue - \else - \csq@info{Disabling multilingual support}% - \csq@resetfalse - \fi} + \csq@ifcsundefined{csq@opt@babel@#1} + {\csq@err@invldopt{babel=#1}} + {\@nameuse{csq@opt@babel@#1}}} +\def\csq@opt@babel@true{% + \csq@info{Enabling multilingual support}% + \csq@resettrue + \csq@roncefalse} +\def\csq@opt@babel@false{% + \csq@info{Disabling multilingual support}% + \csq@resetfalse + \csq@roncefalse} +\def\csq@opt@babel@once{% + \csq@resetfalse + \csq@roncetrue} \define@key{csq}{style}{% - \csq@quiettrue - \DeclareQuoteAlias{#1}{default}% - \csq@quietfalse - \csq@info{Disabling multilingual support}% - \csq@resetfalse} + \csq@opt@babel@false + \DeclareQuoteAlias{#1}{default}} % Language options @@ -1937,10 +2293,10 @@ \csq@ifcsundefined{quote} {\csq@info{% The `quote' environment appears to be undefined.\MessageBreak - I'm defining a typical `quote' environment now}% + I'm defining a typical `quote' environment now} \def\quote{% \list{}{\rightmargin\leftmargin}% - \item\relax}% + \item\relax} \def\endquote{\endlist}} {} @@ -1948,47 +2304,19 @@ \SetBlockThreshold{3} \SetCiteCommand{\cite} -% Load configuration file - -\csq@info{Trying to load configuration file `csquotes.cfg'..} - -\let\csq@tempa\ExecuteOptions -\def\ExecuteOptions#1{\setkeys{csq}{#1}} - -\InputIfFileExists{csquotes.cfg} - {\csq@info{... configuration file loaded successfully}} - {\csq@info{... configuration file not used}} - -\let\ExecuteOptions\csq@tempa -\let\csq@tempa\@undefined - -% Process options - -\DeclareOption*{% - \begingroup - \edef\csq@tempa{\endgroup - \noexpand\setkeys{csq}{\CurrentOption}}% - \csq@tempa} - -\ProcessOptions* - %% Last minute setup \AtBeginDocument{% - \csq@setstyle{default}% - \let\do\csq@do@dospecial - \csq@dospecials - \let\do\csq@do@fixdelim - \csq@dodelimiters - \csq@activetrue - \let\do\noexpand \@ifpackageloaded{babel} {\csq@mkbabel} {\csq@mknobabel}% + \let\csq@mkbabel\@undefined + \let\csq@mknobabel\@undefined \@ifpackageloaded{hyperref} - {\let\csq@warn@pdfstrings\pdfstringdefWarn - \csq@add\pdfstringdefPreHook{\csq@mkpdfstrings}} - {\let\csq@warn@pdfstrings\@gobble}% + {\expandafter\pdfstringdefDisableCommands + \expandafter{\csq@mkhyperref}} + {}% + \let\csq@mkhyperref\@undefined \csq@add\@noligs{\@verbatimquotes}% \@ifpackageloaded{verbatim} {\addto@hook\every@verbatim{\@verbatimquotes}} @@ -1996,117 +2324,24 @@ \@ifpackageloaded{fancyvrb} {\csq@add\FV@CatCodes{\@verbatimquotes}} {}% + \csq@setstyle{default}% + \csq@mkenable \csq@checkblockcite} -\endinput +% Load configuration file -% AUTHOR INTERFACE +\csq@info{Trying to load configuration file `csquotes.cfg'..} +\InputIfFileExists{csquotes.cfg} + {\csq@info{... configuration file loaded successfully}} + {\csq@info{... configuration file not used}} -% Controlling active quotes +% Process options -% This package provides three commands for class and package authors -% who need to temporarily disable the active quotes for some reason. -% -% \@disablequotes -% -% This command restores the status quo ante of all active quotes. -% This can mean one of two things: -% -% 1) If a character had been active when it was defined as active -% quote, its previous definition will be restored. -% -% 2) If a character had not been active when it was defined as active -% quote, its previous category code will be restored. -% -% Note that all active quotes are made active \AtBeginDocument hence -% you will only need \@disablequotes if you're defining anything -% \AtBeginDocument or later. -% -% \@restorequotes -% -% This command restores csquotes's definitions of all active quotes -% and makes them active. The category codes of delimiter characters -% (used for block quotes) are also restored if they have changed. -% -% All changes made by \@disablequotes and \@verbatimquotes are local -% and may thus be restricted to a group. If you use proper grouping -% you may omit \@restorequotes. -% -% The author commands \@restorequotes and \@disablequotes differ from -% the user commands \RestoreQuotes and \DisableQuotes in two ways: -% -% 1) When used in the preamble, they will do nothing (the user -% commands would issue a warning since the active quotes are not -% yet defined at this point). -% -% 2) When used in the document body, they will essentially behave -% like the user commands, except that all informational messages -% are suppressed. The author commands will work quietly behind the -% scenes. -% -% \@verbatimquotes -% -% For verbatim environments and comparable applications, use -% \@verbatimquotes instead of \@disablequotes. \@verbatimquotes -% redefines the active quotes in a way that it suitable for a -% verbatim context. It will do the following: -% -% 1) If a character is in the Ascii range (character code <128), it -% will be redefined so that it expands to itself with category -% code 12. -% -% 2) If a character is not in the Ascii range, there are two -% possibilities: -% -% a) If the character had been active when it was defined as -% active quote, it will be redefined so that it expands to its -% previous definition. -% -% b) If the character had not been active when it was defined as -% active quote, it will be redefined so that it expands to -% itself with its previous category code. -% -% In addition to that, all Ascii characters are added to LaTeX's -% \dospecials list (which may override 1 above, but yield the same -% result). Non-Ascii characters are not added to \dospecials and may -% remain active, allowing the inputenc package to handle them in a -% verbatim context (due to 2a above, which implies that inputenc must -% be loaded before any active quotes are defined). Case 2b is usually -% undesirable in a verbatim context. However, if inputenc is loaded -% and the input encoding is declared properly, this will not happen. -% -% \@verbatimquotes is independent of any \dospecials processing. You -% may typeset all active quotes verbatim by using \@verbatimquotes -% exclusively. The advantage of \@verbatimquotes is that it does not -% depend on any category code changes. In contrast to \dospecials and -% \@makeother, the following is perfectly possible: -% -% \newcommand{\printverbquotes}[1]{{\@verbatimquotes #1}} -% -% Note that the standard LaTeX verbatim environments as well as all -% environments defined by way of the verbatim and fancyvrb packages -% are catered for automatically. When using an environment provided -% by these packages or when defining new environments with the aid of -% one of them, there is no need to add \@verbatimquotes explicitly. -% This also applies to the \verb command and the shortvrb package. - -% Frontend to internal marks - -% In some cases it may be desirable to gain access to the internal -% quotation marks of this package without any grouping or nesting -% control. They may be accessed by way of the following commands: -% -% \textooquote opening outer quotation mark -% \textmoquote middle outer quotation mark -% \textcoquote closing outer quotation mark -% -% \textoiquote opening inner quotation mark -% \textmiquote middle inner quotation mark -% \textciquote closing inner quotation mark -% -% These commands will simply print the respective quotation mark as -% defined with \DeclareQuoteStyle. Note that the initialization hooks -% for the respective quotation style are not expanded in this case. -% The internal marks will reflect all changes of the quotation style. -% If the multilingual interface is enabled, they are also synced with -% the current language. +\DeclareOption*{% + \begingroup + \edef\csq@tempa{\endgroup + \noexpand\setkeys{csq}{\CurrentOption}}% + \csq@tempa} +\ProcessOptions* + +\endinput -- cgit v1.2.3