diff options
author | Karl Berry <karl@freefriends.org> | 2010-06-03 00:03:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-06-03 00:03:21 +0000 |
commit | ed4b7e6d104db218c36f82e81edbcf3260befdbf (patch) | |
tree | e0fd631dae906579d45a0487e74cae8feedffb08 /Master/texmf-dist/tex | |
parent | 2a2fbc131c15823a6094173b0ae4b08d06500381 (diff) |
csquotes 5.0 (2jun10)
git-svn-id: svn://tug.org/texlive/trunk@18701 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/csquotes/csq-compat.def | 106 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/csquotes/csquotes.cfg | 10 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/csquotes/csquotes.def | 58 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/csquotes/csquotes.sty | 876 |
4 files changed, 618 insertions, 432 deletions
diff --git a/Master/texmf-dist/tex/latex/csquotes/csq-compat.def b/Master/texmf-dist/tex/latex/csquotes/csq-compat.def new file mode 100644 index 00000000000..0a8f667b209 --- /dev/null +++ b/Master/texmf-dist/tex/latex/csquotes/csq-compat.def @@ -0,0 +1,106 @@ +% $Id: csq-compat.def,v 5.0 2010/06/02 19:13:37 lehman stable $ + +\ProvidesFile{csquotes.def} +[\csq@rcsid $Id: csq-compat.def,v 5.0 2010/06/02 19:13:37 lehman stable $ + csquotes backwards compatibility] + +\def\csq@getversion#1{% + \expandafter\csq@getversion@i + \expandafter{\csq@vertonum#1\relax}} + +\def\csq@getversion@i#1{% + \ifcsdef{csq@version@#1} + {\csq@info{Enabling v\csq@numtover#1\relax\space mode}% + \csuse{csq@version@#1}} + {\ifnumless{#1+1}\csq@version + {\expandafter\csq@getversion@i + \expandafter{\the\numexpr#1+1}} + {\expandafter\csq@getversion@i + \expandafter{\csq@version}}}} + +\def\csq@vertonum#1.#2\relax{#1#2} +\def\csq@numtover#1#2\relax{#1.#2} + +\csdef{csq@version@\csq@version}{% + \DeclareAutoPunct{.,;:!?}% + \renewcommand{\mktextquote}[6]{##1##2##4##3##6##5}% + \renewcommand{\mkblockquote}[4]{##1##2##4##3}% + \renewcommand{\mkbegdispquote}[2]{}% + \renewcommand{\mkenddispquote}[2]{##2##1}% + \renewcommand{\mkcitation}[1]{\space(##1)}% + \ifdef\csq@leg@DeclarePlainStyle + {\let\DeclarePlainStyle\csq@leg@DeclarePlainStyle + \undef\csq@leg@DeclarePlainStyle} + {}} + +\csdef{csq@version@44}{% + \DeclareAutoPunct{}% + \providecommand*{\ifstringblank}{\ifblank}% + \providecommand*{\ifquotepunct}{\ifpunct}% + \providecommand*{\ifquoteterm}{\ifterm}% + \providecommand*{\ifquotecomma}{\ifpunctmark{,}}% + \providecommand*{\ifquotesemicolon}{\ifpunctmark{;}}% + \providecommand*{\ifquotecolon}{\ifpunctmark{:}}% + \providecommand*{\ifquoteperiod}{\ifpunctmark{.}}% + \providecommand*{\ifquoteexclam}{\ifpunctmark{!}}% + \providecommand*{\ifquotequestion}{\ifpunctmark{?}}% + \providecommand*{\setblockthreshold}{\SetBlockThreshold}% + \providecommand*{\setblockenvironment}{\SetBlockEnvironment}% + \providecommand*{\RestoreQuotes}{\EnableQuotes}% + \providecommand*{\@restorequotes}{\@enablequotes}% + \providecommand*{\cquote}{\textcquote}% + \providecommand*{\foreigncquote}{\foreigntextcquote}% + \providecommand*{\hyphencquote}{\hyphentextcquote}% + \providecommand*{\mkpretextpunct}[1]{}% + \providecommand*{\mkmidtextpunct}[1]{}% + \providecommand*{\mkfintextpunct}[1]{##1}% + \providecommand*{\mkpreblockpunct}[1]{}% + \providecommand*{\mkmidblockpunct}[1]{}% + \providecommand*{\mkfinblockpunct}[1]{##1}% + \providecommand*{\mkpredisppunct}[1]{}% + \providecommand*{\mkmiddisppunct}[1]{}% + \providecommand*{\mkfindisppunct}[1]{##1}% + \providecommand*{\quotetext}{}% + \let\endquotetext\@empty + \providecommand*{\quoteblock}{}% + \let\endquoteblock\@empty + \renewcommand{\mktextquote}[6]{% + ##1\quotetext##2\endquotetext\mkpretextpunct{##4}% + ##3\mkmidtextpunct{##4}##6\mkfintextpunct{##4}##5} + \renewcommand{\mkblockquote}[4]{% + \quoteblock##1\endquoteblock\mkpreblockpunct{##2}% + \mkmidblockpunct{##2}##4\mkfinblockpunct{##2}##3} + \renewcommand{\mkbegdispquote}[2]{\quoteblock} + \renewcommand{\mkenddispquote}[2]{% + \endquoteblock\mkpredisppunct{##1}% + \mkmiddisppunct{##1}##2\mkfindisppunct{##1}}% + \renewcommand{\mkcitation}[1]{\space(##1)}% + \ifdef\csq@leg@DeclarePlainStyle + {\let\DeclarePlainStyle\csq@leg@DeclarePlainStyle + \undef\csq@leg@DeclarePlainStyle} + {}} + +\csdef{csq@version@36}{% + \csuse{csq@version@44}% + \providecommand{\blockcite}[1]{\space(##1)}% + \renewcommand*{\mkcitation}{\blockcite}% + \ifdef\csq@leg@DeclarePlainStyle + {\let\DeclarePlainStyle\csq@leg@DeclarePlainStyle + \undef\csq@leg@DeclarePlainStyle} + {}} + +\csdef{csq@version@30}{% + \csuse{csq@version@36}% + \ifdef\csq@leg@DeclarePlainStyle + {} + {\let\csq@leg@DeclarePlainStyle\DeclarePlainStyle + \renewrobustcmd*{\DeclarePlainStyle}[2]{% + \csq@leg@DeclarePlainStyle{##1}{##1}{##2}{##2}}}} + +\csdef{csq@version@29}{% + \csq@error + {Incompatible version} + {Backwards compatibility with versions + prior to 3.0 not supported}} + +\endinput diff --git a/Master/texmf-dist/tex/latex/csquotes/csquotes.cfg b/Master/texmf-dist/tex/latex/csquotes/csquotes.cfg index 4a2c445c558..9004271d451 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 4.4 2009/05/30 13:12:20 lehman stable $ +% $Id: csquotes.cfg,v 5.0 2010/06/02 19:22:07 lehman stable $ -\ProvidesFile{csquotes.cfg}[2009/05/30 v4.4 csquotes configuration] +\ProvidesFile{csquotes.cfg} % Put your definitions here. @@ -17,7 +17,7 @@ % processed before any options specified in the document preamble, % so you can still override them in the preamble. -\ExecuteQuoteOptions{strict=true,babel=try} +\ExecuteQuoteOptions{strict=true,autostyle=try} % CHANGING THE DEFAULT PARAMETERS @@ -217,8 +217,8 @@ % DEFINING ENVIRONMENTS FOR PARAGRAPH QUOTATIONS % Here are some alternative environments for paragraph quotations -% (block and display), as discussed in the tutorial. The first one -% decreases the font size of the 'quote' environment by one step: +% (block and display). The first one decreases the font size of +% the 'quote' environment by one step: \RequirePackage{relsize} diff --git a/Master/texmf-dist/tex/latex/csquotes/csquotes.def b/Master/texmf-dist/tex/latex/csquotes/csquotes.def index 5c71357e7ed..43e7d3b8796 100644 --- a/Master/texmf-dist/tex/latex/csquotes/csquotes.def +++ b/Master/texmf-dist/tex/latex/csquotes/csquotes.def @@ -1,18 +1,36 @@ -% $Id: csquotes.def,v 4.4d 2010/02/06 18:19:34 lehman stable $ +% $Id: csquotes.def,v 5.0 2010/06/02 19:13:37 lehman stable $ \ProvidesFile{csquotes.def} -[\csq@rcsid $Id: csquotes.def,v 4.4d 2010/02/06 18:19:34 lehman stable $ +[\csq@rcsid $Id: csquotes.def,v 5.0 2010/06/02 19:13:37 lehman stable $ csquotes generic definitions] % Set defaults -\ExecuteQuoteOptions{babel=tryonce,maxlevel=2} +\ExecuteQuoteOptions{autostyle=tryonce,autopunct,maxlevel=2} \SetBlockEnvironment{quote} \SetBlockThreshold{3} \SetCiteCommand{\cite} % Predefined backend styles +\DeclareQuoteStyle[quotes]{croatian}% verified + {\quotedblbase} + {\textquotedblright} + [0.05em]% unsure + {\quotesinglbase} + {\textquoteright} +\DeclareQuoteStyle[guillemets]{croatian}% verified + {\guillemotright} + {\guillemotleft} + [0.025em] + {\quotesinglbase} + {\textquoteright} +\DeclareQuoteStyle[guillements*]{croatian}% verified + {\guillemotleft} + {\guillemotright} + [0.025em] + {\quotesinglbase} + {\textquoteright} \DeclareQuoteStyle[quotes]{danish} {\quotedblbase} {\textquotedblleft} @@ -183,6 +201,7 @@ % Predefined aliases +\DeclareQuoteAlias[quotes]{croatian}{croatian} \DeclareQuoteAlias[quotes]{danish}{danish} \DeclareQuoteAlias[american]{english}{american} \DeclareQuoteAlias[american]{english}{canadian} @@ -336,7 +355,7 @@ %\DeclareQuoteGlyph{LCY}{60}% = << ligature = \guillemotleft %\DeclareQuoteGlyph{LCY}{62}% = >> ligature = \guillemotright -% Unicode (XeTeX) +% Unicode (for XeTeX) \DeclareQuoteGlyph{EU1}{"0022}% = neutral quot. mark, double = \textquotedbl \DeclareQuoteGlyph{EU1}{"0027}% = neutral quot. mark, single = \textquotesingle \DeclareQuoteGlyph{EU1}{"00AB}% = angle quot. mark, left-pointing double = \guillemotleft @@ -352,6 +371,37 @@ \DeclareQuoteGlyph{EU1}{"2039}% = angle quot. mark, left-pointing single = \guilsinglleft \DeclareQuoteGlyph{EU1}{"203A}% = angle quot. mark, right-pointing single = \guilsinglright +\DeclareQuoteGlyph{U}{"0022}% = neutral quot. mark, double = \textquotedbl +\DeclareQuoteGlyph{U}{"0027}% = neutral quot. mark, single = \textquotesingle +\DeclareQuoteGlyph{U}{"00AB}% = angle quot. mark, left-pointing double = \guillemotleft +\DeclareQuoteGlyph{U}{"00BB}% = angle quot. mark, right-pointing double = \guillemotright +\DeclareQuoteGlyph{U}{"2018}% = comma quot. mark, single turned = \textquoteleft +\DeclareQuoteGlyph{U}{"2019}% = comma quot. mark, single = \textquoteright +\DeclareQuoteGlyph{U}{"201A}% = comma quot. mark, low single = \quotesinglbase +\DeclareQuoteGlyph{U}{"201B}% = comma quot. mark, single reversed = n.a. +\DeclareQuoteGlyph{U}{"201C}% = comma quot. mark, double turned = \textquotedblleft +\DeclareQuoteGlyph{U}{"201D}% = comma quot. mark, double = \textquotedblright +\DeclareQuoteGlyph{U}{"201E}% = comma quot. mark, low double = \quotedblbase +\DeclareQuoteGlyph{U}{"201F}% = comma quot. mark, double reversed = n.a. +\DeclareQuoteGlyph{U}{"2039}% = angle quot. mark, left-pointing single = \guilsinglleft +\DeclareQuoteGlyph{U}{"203A}% = angle quot. mark, right-pointing single = \guilsinglright + +% Unicode (for LuaTeX) +\DeclareQuoteGlyph{EU2}{"0022}% = neutral quot. mark, double = \textquotedbl +\DeclareQuoteGlyph{EU2}{"0027}% = neutral quot. mark, single = \textquotesingle +\DeclareQuoteGlyph{EU2}{"00AB}% = angle quot. mark, left-pointing double = \guillemotleft +\DeclareQuoteGlyph{EU2}{"00BB}% = angle quot. mark, right-pointing double = \guillemotright +\DeclareQuoteGlyph{EU2}{"2018}% = comma quot. mark, single turned = \textquoteleft +\DeclareQuoteGlyph{EU2}{"2019}% = comma quot. mark, single = \textquoteright +\DeclareQuoteGlyph{EU2}{"201A}% = comma quot. mark, low single = \quotesinglbase +\DeclareQuoteGlyph{EU2}{"201B}% = comma quot. mark, single reversed = n.a. +\DeclareQuoteGlyph{EU2}{"201C}% = comma quot. mark, double turned = \textquotedblleft +\DeclareQuoteGlyph{EU2}{"201D}% = comma quot. mark, double = \textquotedblright +\DeclareQuoteGlyph{EU2}{"201E}% = comma quot. mark, low double = \quotedblbase +\DeclareQuoteGlyph{EU2}{"201F}% = comma quot. mark, double reversed = n.a. +\DeclareQuoteGlyph{EU2}{"2039}% = angle quot. mark, left-pointing single = \guilsinglleft +\DeclareQuoteGlyph{EU2}{"203A}% = angle quot. mark, right-pointing single = \guilsinglright + \endinput % Auxiliary commands for some styles diff --git a/Master/texmf-dist/tex/latex/csquotes/csquotes.sty b/Master/texmf-dist/tex/latex/csquotes/csquotes.sty index 9c7ba32b7a8..76e3948194f 100644 --- a/Master/texmf-dist/tex/latex/csquotes/csquotes.sty +++ b/Master/texmf-dist/tex/latex/csquotes/csquotes.sty @@ -1,4 +1,4 @@ -% $Id: csquotes.sty,v 4.4d 2010/02/06 18:19:34 lehman stable $ +% $Id: csquotes.sty,v 5.0 2010/06/02 19:13:37 lehman stable $ % Copyright (c) 2003-2010 Philipp Lehman. % @@ -18,9 +18,12 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{csquotes} -[\csq@rcsid $Id: csquotes.sty,v 4.4d 2010/02/06 18:19:34 lehman stable $ +[\csq@rcsid $Id: csquotes.sty,v 5.0 2010/06/02 19:13:37 lehman stable $ context-sensitive quotations] +\def\csq@version$#1: #2.#3 ${#2#3} +\edef\csq@version{\csq@version$Revision: 5.0 $} + %% Compatibility and requirements \RequirePackage{etoolbox} @@ -82,9 +85,9 @@ %% General things -\newif\ifcsq@block -\newif\ifcsq@quiet -\newif\ifcsq@active +\newtoggle{csq@block} +\newtoggle{csq@quiet} +\newtoggle{csq@active} \newcount\csq@reset \newcount\csq@gtype @@ -129,12 +132,7 @@ % Miscellaneous tests -\newcommand*{\ifblockquote}{% - \ifcsq@block - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi} +\newcommand*{\ifblockquote}{\iftoggle{csq@block}} \def\csq@ifsafeactives{% \ifx\if@safe@actives\iftrue @@ -157,25 +155,10 @@ \expandafter\@secondoftwo \fi} -\def\csq@ifmmode{% - \ifmmode - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi} - \def\csq@ifnested{% - \ifcsq@block - \expandafter\@firstoftwo - \else - \ifnum\csq@qlevel>\z@ - \expandafter\expandafter - \expandafter\@firstoftwo - \else - \expandafter\expandafter - \expandafter\@secondoftwo - \fi - \fi} + \iftoggle{csq@block} + {\@firstoftwo} + {\ifnumgreater\csq@qlevel\z@}} % Parsers for UTF-8 @@ -216,23 +199,24 @@ %% User feedback +\protected\def\csq@warning@loose#1{% + \csq@warning{#1}\@gobbletwo} +\protected\def\csq@warning@strict#1{% + \csq@error} +\let\csq@warnorerr\csq@warning@loose + \protected\def\csq@error#1#2{% \PackageError{csquotes}{#1}{#2.}} -\protected\def\csq@warning@loose#1#2#3{% +\protected\def\csq@warning#1{% \PackageWarning{csquotes}{#1}} -\protected\def\csq@warning@strict#1#2#3{% - \PackageError{csquotes}{#2}{#3.}} -\let\csq@warning\csq@warning@loose \protected\def\csq@info#1{% - \ifcsq@quiet - \else - \PackageInfo{csquotes}{#1\csq@noline}% - \fi} - + \iftoggle{csq@quiet} + {} + {\PackageInfo{csquotes}{#1\csq@noline}}} \let\csq@noline\@gobble -\AtEndOfPackage{\let\csq@noline\@empty} +\AtBeginDocument{\let\csq@noline\@empty} % Errors @@ -243,7 +227,7 @@ \csq@eqgroup \csq@errormark} -\protected\def\csq@mismatch{% +\protected\def\csq@mismatch#{% \csq@errormark \csq@err@mismatch} @@ -267,8 +251,13 @@ \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}} + manual\MessageBreak for valid option keys and values}} + +\protected\def\csq@err@sfcodes#1{% + \csq@error + {'\string#1' not available} + {'\string#1' may not be used here because the\MessageBreak + punctuation tracker is not working at this point}} \protected\def\csq@err@glevel{% \csq@mismatch{% @@ -307,7 +296,7 @@ {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 + are part of LaTeX's syntax or reserved\MessageBreak for a specific purpose are invalid}} \protected\def\csq@err@utf{% @@ -341,26 +330,27 @@ % Warnings \protected\def\csq@warn@loadfirst#1{% - \csq@warning + \csq@warnorerr {Load '#1' before 'csquotes'} {'#1' package loaded too late} {Always load '#1' before 'csquotes'}} -\protected\def\csq@warn@nobabel#1{% - \csq@warning - {The 'babel' package is not available.\MessageBreak #1} +\protected\def\csq@warn@multilang#1{% + \csq@warnorerr + {No multilingual support.\MessageBreak #1} {#1} - {Load the 'babel' package to use this feature}} + {Multilingual support does not seem to be available.\MessageBreak + Try loading the 'babel' or the 'polyglossia' package}} -\protected\def\csq@warn@nostyle#1{% - \csq@warning +\protected\def\csq@warn@style#1{% + \csq@warnorerr {No style for language '#1'.\MessageBreak Using fallback style} {No style for language '#1'} {Define a style or alias for this language first}} \protected\def\csq@warn@location#1{% - \csq@warning + \csq@warnorerr {'\string#1' invalid at this point.\MessageBreak Ignoring command} {'\string#1' invalid at this point} @@ -369,7 +359,7 @@ package for details}} \protected\def\csq@warn@sfcodes#1{% - \csq@warning + \csq@warnorerr {No space factor codes for '#1' encoding.\MessageBreak Punctuation tracker may fail} {Punctuation tracker may fail at this point} @@ -377,14 +367,6 @@ See \string\DeclareQuoteGlyph\MessageBreak in the 'csquotes' manual for details}} -\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}% - \let#1#2#2} - %% Outer quotations \protected\def\csq@oqmark{% @@ -528,9 +510,9 @@ \csq@tempa} \appto\@parboxrestore{% - \let\csq@bquote@i\csq@bquote@iii + \let\csq@bquote@i\csq@bquote@ii \csq@qlevel\z@ - \csq@blockfalse} + \togglefalse{csq@block}} %% Restore kerning @@ -636,7 +618,11 @@ \csq@setfrcodes \fi \let\frenchspacing\csq@setfrcodes - \let\nonfrenchspacing\csq@setencodes} + \let\nonfrenchspacing\csq@setencodes + \let\csq@setsfcodes\relax} + +\def\csq@ifsfcodes{% + \ifnumequal\csq@sf@question{\sfcode`\?}} \def\csq@setfrcodes{% \ifnum\sfcode`\A=\@m @@ -697,75 +683,62 @@ 1000% \fi} -\newcommand*{\ifquotecomma}{% - \ifnum\csq@spacefactor=\csq@sf@comma - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi} +% {<true>}{<false>} -\newcommand*{\ifquotesemicolon}{% - \ifnum\csq@spacefactor=\csq@sf@semicolon - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi} +\newcommand*{\ifpunct}{% + \csq@ifsfcodes + {\ifnumgreater\csq@spacefactor\csq@sf@threshold@low + {\ifnumless\csq@spacefactor\csq@sf@threshold@high} + {\@secondoftwo}} + {\csq@err@sfcodes\ifpunct + \@secondoftwo}} -\newcommand*{\ifquotecolon}{% - \ifnum\csq@spacefactor=\csq@sf@colon - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi} +% {<text>}{<true>}{<false>} -\newcommand*{\ifquoteperiod}{% - \ifnum\csq@spacefactor=\csq@sf@period - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi} +\newrobustcmd*{\iftextpunct}[1]{% + \csq@ifpuncttest{#1}{\ifpunct}} -\newcommand*{\ifquoteexclam}{% - \ifnum\csq@spacefactor=\csq@sf@exclam - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi} +% {<true>}{<false>} -\newcommand*{\ifquotequestion}{% - \ifnum\csq@spacefactor=\csq@sf@question - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi} +\newcommand*{\ifterm}{% + \csq@ifsfcodes + {\ifnumgreater\csq@spacefactor\csq@sf@threshold@term + {\ifnumless\csq@spacefactor\csq@sf@threshold@high} + {\@secondoftwo}} + {\csq@err@sfcodes\ifterm + \@secondoftwo}} -\newcommand*{\ifquotepunct}{% - \ifnum\csq@spacefactor>\csq@sf@threshold@low - \ifnum\csq@spacefactor<\csq@sf@threshold@high - \expandafter\expandafter - \expandafter\@firstoftwo - \else - \expandafter\expandafter - \expandafter\@secondoftwo - \fi - \else - \expandafter\@secondoftwo - \fi} +% {<text>}{<true>}{<false>} -\newcommand*{\ifquoteterm}{% - \ifnum\csq@spacefactor>\csq@sf@threshold@term - \ifnum\csq@spacefactor<\csq@sf@threshold@high - \expandafter\expandafter - \expandafter\@firstoftwo - \else - \expandafter\expandafter - \expandafter\@secondoftwo - \fi - \else - \expandafter\@secondoftwo - \fi} +\newrobustcmd*{\iftextterm}[1]{% + \csq@ifpuncttest{#1}{\ifterm}} + +% {<character>}{<true>}{<false>} + +\newrobustcmd*{\ifpunctmark}[1]{% + \csq@ifsfcodes + {\ifbool{hmode} + {\ifnumequal{\sfcode`#1}\spacefactor} + {\@secondoftwo}} + {\csq@err@sfcodes\ifpunctmark + \@secondoftwo}} + +% {<text>}{<character>}{<true>}{<false>} + +\newrobustcmd*{\iftextpunctmark}[2]{% + \csq@ifpuncttest{#1}{\ifpunctmark{#2}}} + +\def\csq@ifpuncttest#1#2{% + \begingroup + \setbox\@tempboxa=\hbox{% + \csq@ifsfcodes\relax\csq@setsfcodes + #1#2 + {\aftergroup\@firstoftwo} + {\aftergroup\@secondoftwo}}% + {\endgroup\@firstoftwo} + {\endgroup\@secondoftwo}} -%% Babel interface +%% Multilingual interface \def\csq@setstyle#1{% \begingroup @@ -775,7 +748,7 @@ \def\noexpand\csq@currentstyle{#1}% \noexpand\csuse{csq@qstyle@#1}}% \csq@tempa} - {\csq@warning + {\csq@warnorerr {Quote style '#1' not defined.\MessageBreak Ignoring command} {Quote style '#1' not defined} {Define the style or alias first} @@ -786,7 +759,7 @@ \ifx\csq@currentstyle\languagename \else \ifcsundef{csq@qstyle@\languagename} - {\csq@warn@nostyle\languagename + {\csq@warn@style\languagename \csq@setstyle{fallback}} {\csq@setstyle{\languagename}}% \fi @@ -802,6 +775,13 @@ {\csuse{otherlanguage*}{\csq@mainlang}} {}} +\protected\long\def\csq@switchlang#1{% + \ifdef\csq@mainlang + {\begingroup + \csuse{otherlanguage*}{\csq@mainlang}#1% + \endgroup} + {#1}} + % \lowercase: workaround for page headers of book.cls et al. \def\csq@lang#1{% @@ -810,8 +790,8 @@ \def\csq@nolang#1{% \begingroup - \lowercase{\def\csq@tempa{#1}}% - \csq@warn@nobabel{Cannot switch to language '\csq@tempa'}% + \lowercase{\def\csq@tempa{#1}}% + \csq@warn@multilang{Cannot switch to language '\csq@tempa'}% \endgroup} \def\csq@hyph#1{% @@ -820,8 +800,8 @@ \def\csq@nohyph#1{% \begingroup - \lowercase{\def\csq@tempa{#1}}% - \csq@warn@nobabel{No hyphenation rules for '\csq@tempa'}% + \lowercase{\def\csq@tempa{#1}}% + \csq@warn@multilang{No hyphenation rules for '\csq@tempa'}% \endgroup} \def\csq@hyphenrules#1{% @@ -835,7 +815,7 @@ \lefthyphenmin#1\relax \righthyphenmin#2\relax} -\appto\csq@mkbabel{% +\appto\csq@hook@multilang{% \appto\@parboxrestore{\csq@resetlang}% \ifundef\l@usenglish {\ifundef\l@USenglish @@ -850,36 +830,36 @@ \ifcase\csq@reset \or \or - \csq@info{Enabling multilingual support}% + \csq@info{Enabling multilingual quotes}% \csq@reset\@ne \else \csq@info{Adjusting default style}% - \ifcsundef{csq@qstyle@\bbl@main@language} - {\csq@warn@nostyle\bbl@main@language - \DeclareQuoteAlias{fallback}{default}} - {\DeclareQuoteAlias{\bbl@main@language}{default}}% + \ifcsdef{csq@qstyle@\csq@main@language} + {\DeclareQuoteAlias{\csq@main@language}{default}} + {\csq@warn@style\csq@main@language + \DeclareQuoteAlias{fallback}{default}}% \fi} -\appto\csq@mknobabel{% +\appto\csq@hook@nomultilang{% \ifcase\csq@reset \or - \csq@warn@nobabel{Cannot enable multilingual support}% + \csq@warn@multilang{Cannot enable multilingual quotes}% \or \or - \csq@warn@nobabel{Cannot adjust default style}% + \csq@warn@multilang{Cannot adjust default style}% \fi \csq@reset\z@ - \def\csq@resetqstyle{% - \csq@warn@nobabel{Cannot enable multilingual support}}% \let\csq@lang\csq@nolang - \let\csq@hyph\csq@nohyph} + \let\csq@hyph\csq@nohyph + \def\csq@resetqstyle{% + \csq@warn@multilang{Cannot enable multilingual quotes}}} %% Markup with control sequences % Argument parsers -% {<macro>}[<arg1>][<arg2>] => -% <macro>{\mkcitation}{<arg1>}{<arg2>} +% {<macro>}[<cite>][<punct>] => +% <macro>{\mkcitation}{<cite>}{<punct>} \def\csq@getcargs#1{% \@ifnextchar[%] @@ -894,8 +874,8 @@ \long\def\csq@getcargs@ii#1#2[#3]{% #1{\mkcitation}{#2}{#3}} -% {<macro>}[<arg1>][<arg2>]{<arg3>}[<arg4>] => -% <macro>{\mkccitation}{\csq@cite[<arg1>][<arg2>]{<arg3>}}{<arg4>} +% {<macro>}[<pre>][<post>]{<key>}[<punct>] => +% <macro>{\mkccitation}{\csq@cite[<pre>][<post>]{<key>}}{<punct>} \def\csq@getccargs#1{% \@ifnextchar[%] @@ -915,34 +895,71 @@ \long\def\csq@getccargs@iii#1#2#3[#4]{% #1{\mkccitation}{\csq@cite#2{#3}}{#4}} +% {<macro>}<punct> => <macro>{<apunct>}<tpunct> + +\protected\long\def\csq@getpunct#1{% + \begingroup + \def\csq@tempa{\endgroup#1}% + \futurelet\@let@token\csq@getpunct@i} + +\def\csq@getpunct@i{% + \expandafter\csq@getpunct@ii\csq@allpunct&} + +\def\csq@getpunct@ii#1{% + \ifx#1&% + \expandafter\csq@getpunct@v + \fi + \if\noexpand#1\noexpand\@let@token + \expandafter\csq@getpunct@iii + \fi + \csq@getpunct@ii} + +\def\csq@getpunct@iii#1\csq@getpunct@ii#2&{% + \expandafter\csq@getpunct@iv\csq@autopunct&} + +\def\csq@getpunct@iv#1{% + \ifx#1&% + \expandafter\csq@getpunct@vi + \fi + \if\noexpand#1\noexpand\@let@token + \expandafter\csq@getpunct@vii + \fi + \csq@getpunct@iv} + +\def\csq@getpunct@v#1\csq@getpunct@ii{\csq@tempa{}\@empty} +\def\csq@getpunct@vi#1\csq@getpunct@iv{\csq@tempa{}} +\def\csq@getpunct@vii#1\csq@getpunct@iv#2{\csq@tempa{#3}\@empty} + +% Punctuation + +\newrobustcmd*{\DeclareAutoPunct}[1]{% + \ifblank{#1} + {\def\csq@autopunct{}} + {\edef\csq@autopunct{\detokenize{#1}}}} + +\let\csq@autopunct\@empty +\def\csq@allpunct{.,;:!?} + % Plain quotes \newrobustcmd*{\enquote}{% - \csq@ifmmode - {\csq@err@mmode\enquote} - {\@ifstar - {\csq@quote@ii{}} - {\csq@quote@i{}}}} + \@ifstar{\csq@quote@ii{}}{\csq@quote@i{}}} \long\def\csq@quote@i#1#2{% \csq@bqgroup #1\csq@oqopen@i #2\csq@qclose} \long\def\csq@quote@ii#1#2{% \csq@bqgroup #1\csq@iqopen@i #2\csq@qclose} -% Plain quotes + babel +% Plain quotes + language switching \newrobustcmd*{\foreignquote}{% - \csq@ifmmode - {\csq@err@mmode\foreignquote} - {\@ifstar\csq@fquote@ii\csq@fquote@i}} + \@ifstar\csq@fquote@ii\csq@fquote@i} \def\csq@fquote@i#1{\csq@quote@i{\csq@lang{#1}}} \def\csq@fquote@ii#1{\csq@quote@ii{\csq@lang{#1}}} \newrobustcmd*{\hyphenquote}{% - \csq@ifmmode - {\csq@err@mmode\hyphenquote} - {\@ifstar\csq@hquote@ii\csq@hquote@i}} + \@ifstar\csq@hquote@ii\csq@hquote@i} \def\csq@hquote@i#1{\csq@quote@i{\csq@hyph{#1}}} \def\csq@hquote@ii#1{\csq@quote@ii{\csq@hyph{#1}}} @@ -972,7 +989,7 @@ {\expandafter\csq@pdf@quote@ii\@gobble} {\csq@pdf@quote@i}} -\appto\csq@mkhyperref{% +\appto\csq@hook@hyperref{% \let\enquote\csq@pdf@quote \let\foreignquote\csq@pdf@fquote \let\hyphenquote\csq@pdf@fquote} @@ -980,82 +997,83 @@ % Text quotes \newrobustcmd*{\textquote}{% - \csq@ifmmode - {\csq@err@mmode\textquote} - {\@ifstar - {\csq@getcargs{\csq@tquote{\csq@iqopen@i}}} - {\csq@getcargs{\csq@tquote{\csq@oqopen@i}}}}} + \@ifstar + {\csq@getcargs{\csq@tquote{}{\csq@iqopen}}} + {\csq@getcargs{\csq@tquote{}{\csq@oqopen}}}} -% {<init><macro>}{<hook>}{<cite>}{<punct>}{<text>} +% {<init>}{<qopen>}{<citehook>}{<cite>}{<punct>}{<text>} -\long\def\csq@tquote#1#2#3#4#5{% - \csq@bqgroup - \def\csq@tempa{% - \mkpretextpunct{#4}% - \csq@qclose - \mkmidtextpunct{#4}}% - \ifblank{#3} - {} - {\appto\csq@tempa{#2{#3}}}% - #1\quotetext#5\endquotetext - \csq@tempa\mkfintextpunct{#4}} - -% Text quotes + babel +\long\def\csq@tquote#1#2#3#4#5#6{% + \csq@getpunct{\csq@tquote@i{#1}{#2}{#3}{#4}{#5}{#6}}} + +% {<init>}{<qopen>}{<citehook>}{<cite>}{<punct>}{<text>}{<apunct>}<tpunct> + +\long\def\csq@tquote@i#1#2#3#4#5#6#7#8{% + \begingroup + \csq@setsfcodes + \edef\csq@tempa{% + \unexpanded{% + \mktextquote + {#2}% + {#6}% + {\csq@qclose}% + {#5}{#7}}% + {\ifblank{#4} + {} + {\unexpanded{\csq@switchlang{#3{#4}}}}}}% + #1\csq@tempa#8% + \endgroup} + +% {<qopen>}{<text>}{<qclose>}{<punct>}{<apunct>}{<cite>} + +\newcommand{\mktextquote}[6]{#1#2#4#3#6#5} + +% Text quotes + language switching \newrobustcmd*{\foreigntextquote}{% - \csq@ifmmode - {\csq@err@mmode\foreigntextquote} - {\@ifstar\csq@ftquote@ii\csq@ftquote@i}} + \@ifstar\csq@ftquote@ii\csq@ftquote@i} \def\csq@ftquote@i#1{% - \csq@getcargs{\csq@tquote{\csq@lang{#1}\csq@oqopen@i}}} + \csq@getcargs{\csq@tquote{\csq@lang{#1}}{\csq@oqopen}}} \def\csq@ftquote@ii#1{% - \csq@getcargs{\csq@tquote{\csq@lang{#1}\csq@iqopen@i}}} + \csq@getcargs{\csq@tquote{\csq@lang{#1}}{\csq@iqopen}}} \newrobustcmd*{\hyphentextquote}{% - \csq@ifmmode - {\csq@err@mmode\hyphentextquote} - {\@ifstar\csq@htquote@ii\csq@htquote@i}} + \@ifstar\csq@htquote@ii\csq@htquote@i} \def\csq@htquote@i#1{% - \csq@getcargs{\csq@tquote{\csq@hyph{#1}\csq@oqopen@i}}} + \csq@getcargs{\csq@tquote{\csq@hyph{#1}}{\csq@oqopen}}} \def\csq@htquote@ii#1{% - \csq@getcargs{\csq@tquote{\csq@hyph{#1}\csq@iqopen@i}}} + \csq@getcargs{\csq@tquote{\csq@hyph{#1}}{\csq@iqopen}}} % Integrated text quotes \newrobustcmd*{\textcquote}{% - \csq@ifmmode - {\csq@err@mmode\textcquote} - {\@ifstar - {\csq@getccargs{\csq@tquote{\csq@iqopen@i}}} - {\csq@getccargs{\csq@tquote{\csq@oqopen@i}}}}} + \@ifstar + {\csq@getccargs{\csq@tquote{}{\csq@iqopen}}} + {\csq@getccargs{\csq@tquote{}{\csq@oqopen}}}} -% Integrated text quotes + babel +% Integrated text quotes + language switching \newrobustcmd*{\foreigntextcquote}{% - \csq@ifmmode - {\csq@err@mmode\foreigntextcquote} - {\@ifstar\csq@ftcquote@ii\csq@ftcquote@i}} + \@ifstar\csq@ftcquote@ii\csq@ftcquote@i} \def\csq@ftcquote@i#1{% - \csq@getccargs{\csq@tquote{\csq@lang{#1}\csq@oqopen@i}}} + \csq@getccargs{\csq@tquote{\csq@lang{#1}}{\csq@oqopen}}} \def\csq@ftcquote@ii#1{% - \csq@getccargs{\csq@tquote{\csq@lang{#1}\csq@iqopen@i}}} + \csq@getccargs{\csq@tquote{\csq@lang{#1}}{\csq@iqopen}}} \newrobustcmd*{\hyphentextcquote}{% - \csq@ifmmode - {\csq@err@mmode\hyphentextcquote} - {\@ifstar\csq@htcquote@ii\csq@htcquote@i}} + \@ifstar\csq@htcquote@ii\csq@htcquote@i} \def\csq@htcquote@i#1{% - \csq@getccargs{\csq@tquote{\csq@hyph{#1}\csq@oqopen@i}}} + \csq@getccargs{\csq@tquote{\csq@hyph{#1}}{\csq@oqopen}}} \def\csq@htcquote@ii#1{% - \csq@getccargs{\csq@tquote{\csq@hyph{#1}\csq@iqopen@i}}} + \csq@getccargs{\csq@tquote{\csq@hyph{#1}}{\csq@iqopen}}} % PDF strings -\appto\csq@mkhyperref{% +\appto\csq@hook@hyperref{% \def\textquote{\pdfstringdefWarn\textquote}% \def\foreigntextquote{\pdfstringdefWarn\foreigntextquote}% \def\hyphentextquote{\pdfstringdefWarn\hyphentextquote}% @@ -1066,47 +1084,47 @@ % Block quotes \newrobustcmd*{\blockquote}{% - \csq@ifmmode - {\csq@err@mmode\blockquote} - {\csq@getcargs{\csq@bquote{}}}} + \csq@getcargs{\csq@bquote{}}} + +% {<init>}{<citehook>}{<cite>}{<punct>}{<text>} -\def\csq@bquote{% +\long\def\csq@bquote#1#2#3#4#5{% \csq@ifnested - {\csq@err@nbquote\@gobblefive} - {\ifinner - \expandafter\csq@bquote@iii - \else - \expandafter\csq@bquote@i - \fi}} + {\csq@err@nbquote} + {\csq@getpunct{% + \ifbool{inner}{\csq@bquote@ii}{\csq@bquote@i}% + {#1}{#2}{#3}{#4}{#5}}}} -% {<init>}{<hook>}{<cite>}{<punct>}{<text>} +% {<init>}{<citehook>}{<cite>}{<punct>}{<text>}{<apunct>}<tpunct> \long\def\csq@bquote@i#1#2#3#4#5{% \begingroup \@blockquote@prehook \@fileswfalse - \csq@blockfalse + \let\csq@bslash\\% \let\csq@newline\newline + \togglefalse{csq@block}% + \def\csq@isblock{\toggletrue{csq@block}}% \setbox\@tempboxa=\vbox{% - \def\par{\aftergroup\csq@blocktrue\@par}% - \def\newline{\aftergroup\csq@blocktrue + \def\par{\aftergroup\csq@isblock\@par}% + \def\\{\aftergroup\csq@isblock\let\\\csq@bslash\\}% + \def\newline{\aftergroup\csq@isblock \let\newline\csq@newline\newline}% \parfillskip\z@ \@plus 1fil\relax \parindent\z@ - \vrule \@height1\baselineskip \@width\z@ #1#5}% + \vrule \@height1\baselineskip \@width\z@ #1#5#4}% \ifdim\ht\@tempboxa>\csq@tshold\baselineskip - \csq@blocktrue - \fi - \ifcsq@block - \aftergroup\@firstoftwo - \else - \aftergroup\@secondoftwo + \toggletrue{csq@block}% \fi + \iftoggle{csq@block} + {\aftergroup\@firstoftwo} + {\aftergroup\@secondoftwo}% \@blockquote@posthook \endgroup - \csq@bquote@ii\csq@bquote@iii{#1}{#2}{#3}{#4}{#5}} + \csq@bquote@iii\csq@bquote@ii{#1}{#2}{#3}{#4}{#5}} -\let\csq@nbgobble\@firstofone +\newrobustcmd*{\BlockquoteDisable}{% + \gappto\@blockquote@prehook} \newcommand*{\@blockquote@prehook}{% \def\@elt##1{\global\value{##1}\the\value{##1}\relax}% @@ -1114,8 +1132,9 @@ \let\@elt\relax \let\csq@nbgobble\@gobble \let\csq@bquote\@gobblefive + \let\csq@warnorerr\@gobblethree \let\csq@error\@gobbletwo - \let\csq@warning\@gobblethree + \let\csq@warning\@gobble \let\csq@info\@gobble \let\label\@gobble \let\index\@gobble @@ -1124,71 +1143,63 @@ \newcommand*{\@blockquote@posthook}{% \csq@tempa} -\long\def\csq@bquote@ii#1#2#3#4#5{% +\let\csq@nbgobble\@firstofone + +% {<init>}{<citehook>}{<cite>}{<punct>}{<text>}{<apunct>}<tpunct> + +\def\csq@bquote@ii#1{\csq@tquote@i{#1}{\csq@oqopen}} + +\long\def\csq@bquote@iii#1#2#3#4#5#6#7{% \begin{\csq@blockenvironment}% - \csq@blocktrue - \begingroup#1% - \csq@setsfcodes - \quoteblock - #5% - \mkpreblockpunct{#4}% - \endquoteblock - \mkmidblockpunct{#4}% - \endgroup - \ifblank{#3} - {} - {#2{#3}}% - \mkfinblockpunct{#4}% + \csq@setsfcodes + \toggletrue{csq@block}% + \edef\csq@tempa{% + \unexpanded{% + \mkblockquote + {#5}% + {#4}{#6}}% + {\ifblank{#3} + {} + {\unexpanded{\csq@switchlang{#2{#3}}}}}}% + #1\csq@tempa#7% \end{\csq@blockenvironment}} -\long\def\csq@bquote@iii#1#2#3#4#5{% - \csq@bqgroup - \def\csq@tempa{% - \mkpreblockpunct{#4}% - \csq@qclose - \mkmidblockpunct{#4}}% - \ifblank{#3} - {} - {\appto\csq@tempa{#2{#3}}}% - #1\csq@oqopen@i\quotetext#5\endquotetext - \csq@tempa\mkfinblockpunct{#4}} +% {<text>}{<punct>}{<apunct>}{<cite>} -\newrobustcmd*{\BlockquoteDisable}{\gappto\@blockquote@prehook} +\newcommand{\mkblockquote}[4]{#1#2#4#3} -% Block quotes + babel +% Block quotes + language switching \newrobustcmd*{\foreignblockquote}[1]{% - \csq@ifmmode - {\csq@err@mmode\foreignblockquote} - {\csq@getcargs{\csq@bquote{\csq@lang{#1}}}}} + \csq@getcargs{\csq@bquote{\csq@lang{#1}}}} \newrobustcmd*{\hyphenblockquote}[1]{% - \csq@ifmmode - {\csq@err@mmode\hyphenblockquote} - {\csq@getcargs{\csq@bquote{\csq@hyph{#1}}}}} + \csq@getcargs{\csq@bquote{\csq@hyph{#1}}}} + +\newrobustcmd*{\hybridblockquote}[1]{% + \csq@getcargs{\csq@bquote{% + \iftoggle{csq@block}\csq@lang\csq@hyph{#1}}}} % Integrated block quotes \newrobustcmd*{\blockcquote}{% - \csq@ifmmode - {\csq@err@mmode\blockcquote} - {\csq@getccargs{\csq@bquote{}}}} + \csq@getccargs{\csq@bquote{}}} -% Integrated block quotes + babel +% Integrated block quotes + language switching \newrobustcmd*{\foreignblockcquote}[1]{% - \csq@ifmmode - {\csq@err@mmode\foreignblockcquote} - {\csq@getccargs{\csq@bquote{\csq@lang{#1}}}}} + \csq@getccargs{\csq@bquote{\csq@lang{#1}}}} \newrobustcmd*{\hyphenblockcquote}[1]{% - \csq@ifmmode - {\csq@err@mmode\hyphenblockcquote} - {\csq@getccargs{\csq@bquote{\csq@hyph{#1}}}}} + \csq@getccargs{\csq@bquote{\csq@hyph{#1}}}} + +\newrobustcmd*{\hybridblockcquote}[1]{% + \csq@getccargs{\csq@bquote{% + \iftoggle{csq@block}\csq@lang\csq@hyph{#1}}}} % PDF strings -\appto\csq@mkhyperref{% +\appto\csq@hook@hyperref{% \def\blockquote{\pdfstringdefWarn\blockquote}% \def\foreignblockquote{\pdfstringdefWarn\foreignblockquote}% \def\hyphenblockquote{\pdfstringdefWarn\hyphenblockquote}% @@ -1199,97 +1210,71 @@ % Display quotes \newenvironment*{displayquote} - {\csq@getcargs{\csq@dquote{}}} + {\csq@getcargs{\csq@bdquote{}}} {\csq@edquote} -% {<init>}{<hook>}{<cite>}{<punct>} - -\def\csq@dquote#1#2#3#4{% - \ifblank{#3} - {\let\csq@tempb\@empty} - {\def\csq@tempb{#2{#3}}}% - \def\csq@tempc{#4}% - \csq@bdquote{#1}} +% {<init>}{<citehook>}{<cite>}{<punct>} -\def\csq@bdquote#1{% +\def\csq@bdquote#1#2#3#4{% \csuse{\csq@blockenvironment}% - \csq@blocktrue - \begingroup#1% \csq@setsfcodes - \quoteblock} + \toggletrue{csq@block}% + #1\ifblank{#3} + {\def\csq@tempb{\mkenddispquote{#4}{}}% + \mkbegdispquote{#4}{}} + {\def\csq@tempb{\mkenddispquote{#4}{\csq@switchlang{#2{#3}}}}% + \mkbegdispquote{#4}{\csq@switchlang{#2{#3}}}}% + \ignorespaces} \def\csq@edquote{% - \ifdim\lastskip>\z@\unskip\fi - \expandafter\mkpredisppunct - \expandafter{\csq@tempc}% - \endquoteblock - \expandafter\mkmiddisppunct - \expandafter{\csq@tempc}% - \endgroup + \unspace \csq@tempb - \expandafter\mkfindisppunct - \expandafter{\csq@tempc}% \csuse{end\csq@blockenvironment}} -% Display quotes + babel +\providerobustcmd*{\unspace}{% + \ifbool{hmode} + {\ifdimgreater\lastskip\z@ + {\unskip\unspace} + {\ifnumgreater\lastpenalty\z@ + {\unpenalty\unspace} + {}}} + {}} + +% {<punct>}{<cite>} + +\newcommand{\mkbegdispquote}[2]{} +\newcommand{\mkenddispquote}[2]{#1#2} + +% Display quotes + language switching \newenvironment*{foreigndisplayquote}[1] - {\csq@getcargs{\csq@dquote{\csq@lang{#1}}}} + {\csq@getcargs{\csq@bdquote{\csq@lang{#1}}}} {\csq@edquote} \newenvironment*{hyphendisplayquote}[1] - {\csq@getcargs{\csq@dquote{\csq@hyph{#1}}}} + {\csq@getcargs{\csq@bdquote{\csq@hyph{#1}}}} {\csq@edquote} % Integrated display quotes \newenvironment*{displaycquote} - {\csq@getccargs{\csq@dcquote{}}} + {\csq@getccargs{\csq@bdquote{}}} {\csq@edquote} -% {<init>}{<hook>}{<cite>}{<punct>} - -\def\csq@dcquote#1#2#3#4{% - \def\csq@tempb{#2{#3}}% - \def\csq@tempc{#4}% - \csq@bdquote{#1}} - -% Integrated display quotes + babel +% Integrated display quotes + language switching \newenvironment*{foreigndisplaycquote}[1] - {\csq@getccargs{\csq@dcquote{\csq@lang{#1}}}} + {\csq@getccargs{\csq@bdquote{\csq@lang{#1}}}} {\csq@edquote} \newenvironment*{hyphendisplaycquote}[1] - {\csq@getccargs{\csq@dcquote{\csq@hyph{#1}}}} + {\csq@getccargs{\csq@bdquote{\csq@hyph{#1}}}} {\csq@edquote} % Hooks -\newcommand*{\mkcitation}[1]{\space(#1)} -\newcommand*{\mkccitation}[1]{\space#1} - -\newcommand*{\mkpretextpunct}[1]{} -\newcommand*{\mkmidtextpunct}[1]{} -\newcommand*{\mkfintextpunct}[1]{#1} -\newcommand*{\mkpreblockpunct}[1]{} -\newcommand*{\mkmidblockpunct}[1]{} -\newcommand*{\mkfinblockpunct}[1]{#1} -\newcommand*{\mkpredisppunct}[1]{} -\newcommand*{\mkmiddisppunct}[1]{} -\newcommand*{\mkfindisppunct}[1]{#1} - -\newenvironment*{quotetext}{}{} -\newenvironment*{quoteblock}{}{} - -% Legacy commands - -\newrobustcmd*{\cquote}{% - \csq@warn@legacy\cquote\textcquote} -\newrobustcmd*{\foreigncquote}{% - \csq@warn@legacy\foreigncquote\foreigntextcquote} -\newrobustcmd*{\hyphencquote}{% - \csq@warn@legacy\hyphencquote\hyphentextcquote} +\newcommand{\mkcitation}[1]{\space(#1)} +\newcommand{\mkccitation}[1]{\space#1} %% Markup with active characters @@ -1355,26 +1340,26 @@ \let\do\csq@do@doutfspecial \csq@doutfspecials \let\do\noexpand - \csq@activetrue} + \toggletrue{csq@active}} \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} + \iftoggle{csq@active} + {\let\do\csq@do@undospecial + \csq@dospecials + \let\do\csq@do@undoutfspecial + \csq@doutfspecials + \let\do\noexpand + \togglefalse{csq@active}} + {}} \def\csq@mkverbatim{% - \ifcsq@active - \let\do\csq@do@verbspecial - \csq@dospecials - \let\do\csq@do@undoutfspecial - \csq@doutfspecials - \let\do\noexpand - \fi} + \iftoggle{csq@active} + {\let\do\csq@do@verbspecial + \csq@dospecials + \let\do\csq@do@undoutfspecial + \csq@doutfspecials + \let\do\noexpand} + {}} \def\csq@mkdelete{% \csq@mkdisable @@ -1388,7 +1373,7 @@ \let\csq@mkpdfstrings\@empty} \let\csq@mkpdfstrings\@empty -\appto\csq@mkhyperref{\csq@mkpdfstrings} +\appto\csq@hook@hyperref{\csq@mkpdfstrings} \ifdef\inpenc@prehook % inputenc 2006/05/05 v1.1b {\AtBeginDocument{% @@ -1525,7 +1510,7 @@ \csq@ifsafeactives {\csuse{csq@string@#1}} {\csq@iftypeset - {\csq@ifmmode + {\ifbool{mmode} {\csuse{csq@saved@#1}} {\csuse{csq@textdef@#1}}} {\csq@ifstrings @@ -1536,7 +1521,7 @@ \csq@ifsafeactives {\csuse{csq@string@#1}} {\csq@iftypeset - {\csq@ifmmode + {\ifbool{mmode} {\csuse{csq@saved@#1}} {\csq@ifnested {\csq@err@nbquote} @@ -1549,7 +1534,7 @@ \csq@ifsafeactives {\csuse{csq@string@#1}} {\csq@iftypeset - {\csq@ifmmode + {\ifbool{mmode} {\csuse{csq@saved@#1}} {\csq@ifnested {\csq@err@nbquote} @@ -1576,7 +1561,7 @@ {\csuse{csq@string@#1}} {\noexpand\csqBQend{#1}}}}} -\appto\csq@mkhyperref{% +\appto\csq@hook@hyperref{% \def\csqQQ#1{\csuse{csq@pdfdef@#1}}% \def\csqBQ#1{\csuse{csq@pdfdef@#1}}% \def\csqBQbeg#1{\csuse{csq@pdfdef@#1}}% @@ -1828,6 +1813,11 @@ \csq@addbspecial{#2}{#3}{#4}% {\csq@bquote{\csq@hyph{#1}}{\mkcitation}}} +\newrobustcmd*{\MakeHybridBlockQuote}[4]{% + \csq@addbspecial{#2}{#3}{#4}% + {\csq@bquote{\iftoggle{csq@block}\csq@lang\csq@hyph{#1}}% + {\mkcitation}}} + \newrobustcmd*{\EnableQuotes}{} \newrobustcmd*{\DisableQuotes}{} \newrobustcmd*{\VerbatimQuotes}{} @@ -1841,27 +1831,21 @@ % Author interface \newrobustcmd*{\@enablequotes}{% - \csq@quiettrue + \toggletrue{csq@quiet}% \csq@mkenable - \csq@quietfalse} + \togglefalse{csq@quiet}} \newrobustcmd*{\@disablequotes}{% - \csq@quiettrue + \toggletrue{csq@quiet}% \csq@mkdisable - \csq@quietfalse} + \togglefalse{csq@quiet}} \newrobustcmd*{\@verbatimquotes}{% - \csq@quiettrue + \toggletrue{csq@quiet}% \csq@mkverbatim - \csq@quietfalse} + \togglefalse{csq@quiet}} \newrobustcmd*{\@deletequotes}{% - \csq@quiettrue + \toggletrue{csq@quiet}% \csq@mkdelete - \csq@quietfalse} - -% Legacy - -\newrobustcmd*{\RestoreQuotes}{% - \csq@warn@legacy\RestoreQuotes\EnableQuotes} -\newrobustcmd*{\@restorequotes}{\@enablequotes} + \togglefalse{csq@quiet}} %% Switch quote styles manually @@ -1874,7 +1858,7 @@ \def\csq@setqstyle[#1]#2{% \ifnum\csq@reset=\@ne - \csq@info{Disabling multilingual support}% + \csq@info{Disabling multilingual quotes}% \csq@reset\z@ \fi \ifblank{#1} @@ -1882,7 +1866,7 @@ {\csq@setstyle{#2/#1}}} \def\csq@resetqstyle{% - \csq@info{Enabling multilingual support}% + \csq@info{Enabling multilingual quotes}% \csq@reset\@ne} %% Define quote styles @@ -2004,21 +1988,11 @@ {\csq@err@undef{#1}} {\def\csq@cite{#1}}} -% Legacy commands - -\newrobustcmd*{\setblockthreshold}{% - \csq@warn@legacy\setblockthreshold\SetBlockThreshold} -\newrobustcmd*{\setblockenvironment}{% - \csq@warn@legacy\setblockenvironment\SetBlockEnvironment} - -%% Internal interface for biblatex +%% Interface for biblatex +\newrobustcmd*{\@setquotesfcodes}{\csq@setsfcodes} \newcommand*{\@quotelevel}{} \let\@quotelevel\csq@qlevel - -\newrobustcmd*{\@setquotesfcodes}{% - \csq@setsfcodes} - \newcommand*{\@ifquotemarker}{% \ifdim\lastskip=\csq@kernmarker\relax \expandafter\@firstoftwo @@ -2029,26 +2003,26 @@ %% Author interface to auto quotes \newrobustcmd*{\openautoquote}{% - \csq@ifmmode + \ifbool{mmode} {\csq@err@mmode\openautoquote} {\csq@oqopen}} \newrobustcmd*{\closeautoquote}{% - \csq@ifmmode + \ifbool{mmode} {\csq@err@mmode\closeautoquote} {\csq@qclose}} \newrobustcmd*{\openinnerquote}{% - \csq@ifmmode + \ifbool{mmode} {\csq@err@mmode\openinnerquote} {\csq@iqopen}} \newrobustcmd*{\closeinnerquote}{% - \csq@ifmmode + \ifbool{mmode} {\csq@err@mmode\closeinnerquote} {\csq@qclose}} -\appto\csq@mkhyperref{% +\appto\csq@hook@hyperref{% \def\openautoquote{\csq@pdf@ooqmark}% \def\closeautoquote{\csq@pdf@coqmark}% \def\openinnerquote{\csq@pdf@oiqmark}% @@ -2112,6 +2086,33 @@ \expandafter\csq@fixkern \fi} +%% Ellipses + +\newrobustcmd*{\textelp}{% + \begingroup + \@ifstar + {\@tempswatrue\csq@textelp} + {\@tempswafalse\csq@textelp}} + +\long\def\csq@textelp#1{% + \ifblank{#1} + {\endgroup\mktextelp} + {\expandafter\endgroup\if@tempswa + \expandafter\mktextinselp + \else + \expandafter\mktextelpins + \fi + {#1}}} + +\newrobustcmd*{\textins}{% + \@ifstar\mktextmod\mktextins} + +\newcommand{\mktextelp}{[\textellipsis\unkern]} +\newcommand{\mktextelpins}[1]{[\textellipsis\unkern] [#1]} +\newcommand{\mktextinselp}[1]{[#1] [\textellipsis\unkern]} +\newcommand{\mktextins}[1]{[#1]} +\newcommand{\mktextmod}[1]{[#1]} + %% Auxiliary commands for some styles % French @@ -2171,43 +2172,54 @@ % Core options \define@key{csq}{strict}[true]{% - \ifcsundef{csq@opt@strict@#1} - {\csq@err@opt{strict=#1}} - {\csuse{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} + \ifstrequal{#1}{true} + {\csq@info{Enabling strict warnings}% + \let\csq@warnorerr\csq@warning@strict} + {\csq@info{Disabling strict warnings}% + \let\csq@warnorerr\csq@warning@loose}} -\define@key{csq}{babel}[true]{% - \ifcsundef{csq@opt@babel@#1} - {\csq@err@opt{babel=#1}} - {\csuse{csq@opt@babel@#1}}} -\def\csq@opt@babel@false{% - \csq@info{Disabling multilingual support}% +\define@key{csq}{autopunct}[true]{% + \ifstrequal{#1}{true} + {\let\csq@autopunct\csq@allpunct} + {\let\csq@autopunct\@empty}} + +\define@key{csq}{style}{% + \csq@opt@autostyle@false + \DeclareQuoteAlias{#1}{default}} + +\define@key{csq}{autostyle}[true]{% + \ifcsdef{csq@opt@autostyle@#1} + {\csuse{csq@opt@autostyle@#1}} + {\csq@err@opt{autostyle=#1}}} +\def\csq@opt@autostyle@false{% + \csq@info{Disabling multilingual quotes}% \csq@reset\z@} -\def\csq@opt@babel@true{% - \csq@info{Enabling multilingual support}% +\def\csq@opt@autostyle@true{% + \csq@info{Enabling multilingual quotes}% \csq@reset\@ne} -\def\csq@opt@babel@try{% +\def\csq@opt@autostyle@try{% \csq@reset\tw@} -\def\csq@opt@babel@once{% +\def\csq@opt@autostyle@once{% \csq@reset\thr@@} -\def\csq@opt@babel@tryonce{% +\def\csq@opt@autostyle@tryonce{% \csq@reset4\relax} +\define@key{csq}{babel}[true]{% + \csq@warning{% + Option 'babel' depreciated.\MessageBreak + Using 'autostyle'}% + \setkeys{csq}{autostyle=#1}} + \define@key{csq}{maxlevel}{% - \ifnum#1<2 - \csq@err@opt{babel=#1}% - \else - \csq@maxlvl#1\relax - \fi} + \ifnumless{#1}\tw@ + {\csq@err@opt{maxlevel=#1}} + {\csq@maxlvl#1\relax}} -\define@key{csq}{style}{% - \csq@opt@babel@false - \DeclareQuoteAlias{#1}{default}} +\define@key{csq}{version}{% + \ifdef\csq@getversion + {} + {\input{csq-compat.def}}% + \csq@getversion{#1}} %% Initial setup @@ -2226,17 +2238,34 @@ % Deferred last minute setup \AtEndPreamble{% - \providecommand*{\ifstringblank}{\ifblank}% - \@ifpackageloaded{babel} - {\csq@mkbabel} - {\csq@mknobabel}% - \undef\csq@mkbabel - \undef\csq@mknobabel + \ifnumgreater\csq@reset\z@ + {\csq@info{Checking for multilingual support..}% + \@ifpackageloaded{polyglossia} + {\csq@info{... found 'polyglossia' package}% + \csq@warning + {Using preliminary 'polyglossia' interface.\MessageBreak + Some of the multilingual features may not\MessageBreak + work as expected\@gobble}% + \def\csq@main@language{\xpg@main@language}% + \csq@hook@multilang} + {\@ifpackageloaded{babel} + {\csq@info{... found 'babel' package}% + \def\csq@main@language{\bbl@main@language}% + \csq@hook@multilang} + {\csq@info{... none found}% + \csq@hook@nomultilang}}} + {\@ifpackageloaded{polyglossia} + {} + {\@ifpackageloaded{babel} + {} + {\csq@hook@nomultilang}}}% + \undef\csq@hook@multilang + \undef\csq@hook@nomultilang \@ifpackageloaded{hyperref} {\expandafter\pdfstringdefDisableCommands - \expandafter{\csq@mkhyperref}} + \expandafter{\csq@hook@hyperref}} {}% - \undef\csq@mkhyperref + \undef\csq@hook@hyperref \appto\@noligs{\@verbatimquotes}% \@ifpackageloaded{verbatim} {\addto@hook\every@verbatim{\@verbatimquotes}} @@ -2288,6 +2317,7 @@ \edef\csq@tempa{\endgroup \noexpand\setkeys{csq}{\CurrentOption}}% \csq@tempa} + \ProcessOptions* \endinput |