From f1ecfdedac68a0b0aff5e22b7b69fb42ce8067c5 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 22 Feb 2012 23:31:50 +0000 Subject: quoting (22feb12) git-svn-id: svn://tug.org/texlive/trunk@25474 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/quoting/quoting.dtx | 67 ++++++++++++++++------ Master/texmf-dist/source/latex/quoting/quoting.ins | 4 +- 2 files changed, 52 insertions(+), 19 deletions(-) (limited to 'Master/texmf-dist/source/latex/quoting') diff --git a/Master/texmf-dist/source/latex/quoting/quoting.dtx b/Master/texmf-dist/source/latex/quoting/quoting.dtx index a89e3d8d9d1..e96027cd215 100644 --- a/Master/texmf-dist/source/latex/quoting/quoting.dtx +++ b/Master/texmf-dist/source/latex/quoting/quoting.dtx @@ -2,7 +2,7 @@ % % This is file `quoting.dtx'. % -% Copyright (C) 2011 by Thomas Titz +% Copyright (C) 2011--2012 by Thomas Titz % % Permission is granted to distribute and/or modify this work under the % terms of the LaTeX Project Public License (LPPL), version 1.3c or @@ -42,6 +42,7 @@ \def\quo/{\textsf{quoting}} \def\quoa/{\textsf{quotation}} \def\quoe/{\textsf{quote}} +\widowpenalty=10000 \begin{document} \DocInput{quoting.dtx} \end{document} @@ -49,7 +50,7 @@ % % \fi % -% \CheckSum{154} +% \CheckSum{168} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -113,7 +114,7 @@ % % Why didn't Leslie Lamport, the initial developer of \LaTeX, implement % a single environment for displayed text and provide control over its -% first-line indentation by other means, e.\,g. the presence of a blank +% first-line indentation by other means, e.g. the presence of a blank % line (or a |\par| command) before the environment? The likely reason % is that Lamport envisaged an additional application of the \quoe/ % environment, namely \blockcquote[p.~24]{Lam94}{a sequence of short @@ -201,19 +202,36 @@ % pointing out \quo/'s behaviour with respect to \textsf{sloppypar}, % \textsf{center} \& friends.} % +% \changes{v0.1b}{2012/02/21}{Improved syntax of options \textsf{font} +% and \textsf{font+}} +% % \item[font]\SpecialOptIndex{font} The font used for typesetting the % contents of a \quo/ environment. Permitted values are the names % (without preceding backslash) of \LaTeX's font-switching/formatting % commands; e.\,g, use \textsf{font=itshape} to typeset quotes in % italics. (By default, \quo/ uses the font/formatting of the -% surrounding text.) To specify several font properties, invoke -% \textsf{font+} in addition to \textsf{font}. +% surrounding text.) To specify several font properties, use a +% comma-separated list of font/formatting names, e.g., +% \textsf{font=\{itshape,raggedright\}} (note the surrounding +% braces).\footnote{Before \quo/ v0.1b, \textsf{font+} had to be invoked +% for specifying several font properties.} % % \item[font+]\SpecialOptIndex{font+} Font properties used for % typesetting the contents of a \quo/ environment in addition to those % properties specified by \textsf{font} (and previous calls of % \textsf{font+}). % +% \changes{v0.1b}{2012/02/21}{New options \textsf{begintext} +% and \textsf{endtext}} +% +% \item[begintext]\SpecialOptIndex{begintext} Additional text (e.g., an +% opening quotation mark) to be typeset at the start of a \quo/ +% environment. By default, no text is added. +% +% \item[endtext]\SpecialOptIndex{endtext} Additional text (e.g., a +% closing quotation mark) to be typeset at the end of a \quo/ +% environment. By default, no text is added. +% % \item[leftmargin]\SpecialOptIndex{leftmargin} The width of the % environment's left-hand indentation relative to the surrounding text. % The default value is |\leftmargin|.\footnote{Note that the value of @@ -254,7 +272,7 @@ % \DescribeMacro{\quotingfont} % The options \textsf{font} and \textsf{font+} do not accept values % which itself take an argument. In such cases you must resort to -% redefining the command |\quotingfont|, e.\,g. by including +% redefining the command |\quotingfont|, e.g. by including % |\renewcommand*{\quotingfont}{\setstretch{1.5}}| in your document % preamble (with the \textsf{setspace} package loaded). % @@ -319,10 +337,10 @@ % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{quoting} - [2011/09/08 v0.1a Consolidated environment for displayed text] + [2012/02/21 v0.1b Consolidated environment for displayed text] % \end{macrocode} % We require the packages \textsf{kvoptions} (to conveniently specify -% options as key--value pairs) and \textsf{etoolbox} (e.\,g. for length +% options as key--value pairs) and \textsf{etoolbox} (e.g. for length % assignments and boolean switch handling). % \begin{macrocode} \RequirePackage{etoolbox,kvoptions} @@ -353,29 +371,40 @@ % \end{macro} % \begin{macro}{\quotingfont} % The \textsf{keyval} command |\define@key| is used to define the keys -% \textsf{font} and \textsf{font+}. We convert their value to a command -% and use this command to define |\quotingfont| resp. to append its -% definition. +% \textsf{font} and \textsf{font+}. With the help of |\docsvlist| +% (provided by \textsf{etoolbox}), we convert their comma-separated list +% of values to commands and use these commands to define |\quotingfont| +% resp. to append its definition. % \begin{macrocode} \newcommand*{\quotingfont}{} \define@key{quo}{font}{% - \def\quotingfont{\csname #1\endcsname}% + \def\quotingfont{}% + \renewcommand*{\do}[1]{\appto{\quotingfont}{\csname ##1\endcsname}}% + \docsvlist{#1}% } \define@key{quo}{font+}{% - \appto{\quotingfont}{\csname #1\endcsname}% + \renewcommand*{\do}[1]{\appto{\quotingfont}{\csname ##1\endcsname}}% + \docsvlist{#1}% } % \end{macrocode} % \end{macro} +% \begin{macro}{\quo@begintext} +% \begin{macro}{\quo@endtext} % \begin{macro}{\quo@leftmargin} % \begin{macro}{\quo@rightmargin} -% We use \textsf{kvoptions} to define the keys \textsf{leftmargin} and -% \textsf{rightmargin} and to set their default values. +% We use \textsf{kvoptions} to define the keys \textsf{begintext}, +% \textsf{endtext}, \textsf{leftmargin}, and \textsf{rightmargin} and to +% set default values for the latter two. % \begin{macrocode} +\DeclareStringOption{begintext} +\DeclareStringOption{endtext} \DeclareStringOption[\leftmargin]{leftmargin} \DeclareStringOption[\quo@leftmargin]{rightmargin} % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % \begin{macro}{\quo@toppartop} % \begin{macro}{\quo@vskip} % The length |\quo@toppartop| is set to the sum of |\topsep| and @@ -552,7 +581,8 @@ % environment's first paragraph when indicated, and switch to % |\quotingfont|. (With regard to orphans, we make use of |\@item|'s % internal mechanism to prevent orphans directly after sectioning -% commands \cite[p.~229]{Bra09}.) +% commands \cite[p.~229]{Bra09}.) Lastly, we typeset the replacement +% text of the \textsf{begintext} key. % \begin{macrocode} \item\relax \ifbool{quo@noorphanfirst}{% @@ -560,8 +590,10 @@ }{% }% \quotingfont + \quo@begintext\ignorespaces % \end{macrocode} -% At the end of \quo/, the following actions are taken: +% At the end of \quo/ (and having typeset the replacement text of +% \textsf{endtext}), the following actions are taken: % \begin{itemize} % % \item The \LaTeX\ kernel switch |@endpe| is set to false (so that @@ -577,6 +609,7 @@ % \end{itemize} % \begin{macrocode} }{% + \unskip\quo@endtext \endlist \boolfalse{@endpe}% \ifbool{quo@noorphanafter}{% diff --git a/Master/texmf-dist/source/latex/quoting/quoting.ins b/Master/texmf-dist/source/latex/quoting/quoting.ins index a3bfa8d0751..1c6da2428d0 100644 --- a/Master/texmf-dist/source/latex/quoting/quoting.ins +++ b/Master/texmf-dist/source/latex/quoting/quoting.ins @@ -1,7 +1,7 @@ %% %% This is file `quoting.ins'. %% -%% Copyright (C) 2011 by Thomas Titz +%% Copyright (C) 2011--2012 by Thomas Titz %% %% Permission is granted to distribute and/or modify this work under the %% terms of the LaTeX Project Public License (LPPL), version 1.3c or @@ -19,7 +19,7 @@ \preamble -Copyright (C) 2011 by Thomas Titz +Copyright (C) 2011--2012 by Thomas Titz Permission is granted to distribute and/or modify this work under the terms of the LaTeX Project Public License (LPPL), version 1.3c or -- cgit v1.2.3