From 02871b0d86e21ea1537b193d7fbb2d34114eb32a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 8 Sep 2011 22:44:07 +0000 Subject: quoting (8sep11) git-svn-id: svn://tug.org/texlive/trunk@23875 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/quoting/quoting.dtx | 89 +++++++++++++++++----- 1 file changed, 69 insertions(+), 20 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 94fb880630c..a89e3d8d9d1 100644 --- a/Master/texmf-dist/source/latex/quoting/quoting.dtx +++ b/Master/texmf-dist/source/latex/quoting/quoting.dtx @@ -49,7 +49,7 @@ % % \fi % -% \CheckSum{120} +% \CheckSum{154} % % \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 @@ -75,6 +75,7 @@ % \DoNotIndex{\ifbool,\item,\@M,\NeedsTeXFormat,\newbool,\newcommand} % \DoNotIndex{\newenvironment,\newlength,\par,\ProvidesPackage,\relax} % \DoNotIndex{\RequirePackage,\setlength,\z@} +% \DoNotIndex{\else,\fi,\ifcase,\ifcsname,\or} % % \title{The \quo/ package\thanks{This document corresponds to % \quo/~\fileversion, dated \filedate.}} @@ -185,6 +186,21 @@ % % \begin{description}[font=\sffamily] % +% \changes{v0.1a}{2011/09/08}{New option \textsf{indentfirst}} +% +% \item[indentfirst]\SpecialOptIndex{indentfirst} An option that allows +% to override \quo/'s indentation mechanism and to manually switch +% on/off first-line indentation. The permitted values are \textsf{auto}, +% \textsf{true}, and \textsf{false}. The default value is +% \textsf{auto}.\footnote{The \textsf{indentfirst} option may act as a +% fallback solution for cases where \quo/'s indentation mechanism fails. +% Currently, first lines will always be indented a)~immediately after +% \texttt{\textbackslash begin\{document\}} b)~after a +% \textsf{sloppypar}, \textsf{center}, \textsf{flushleft}, or +% \textsf{flushright} environment. Thanks to Enrico Gregorio for +% pointing out \quo/'s behaviour with respect to \textsf{sloppypar}, +% \textsf{center} \& friends.} +% % \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 @@ -256,6 +272,12 @@ % \url{http://www.tug.org/texlive/Contents/live/texmf-dist/doc/latex/base/source2e.pdf} % (accessed August 2, 2011). % +% \bibitem{dec09} +% ``\textbackslash DeclareStringOption''. +% Series of messages on \textsf{comp.text.tex}, December 14, 2009. +% \url{http://groups.google.com/group/comp.text.tex/browse_thread/thread/1fb53938ac0026c5} +% (accessed September 6, 2011). +% % \bibitem{Fis95} % Fischel, William~A. % \emph{Regulatory takings: Law, economics, and politics}. @@ -297,7 +319,7 @@ % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{quoting} - [2011/08/08 v0.1 Consolidated environment for displayed text] + [2011/09/08 v0.1a 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 @@ -310,6 +332,25 @@ % \begin{macrocode} \SetupKeyvalOptions{family=quo,prefix=quo@} % \end{macrocode} +% \begin{macro}{\quo@indentfirsttype} +% The key \textsf{indentfirst} takes a list of three values with +% associated functions and yields an error message if an unknown value +% is given. We use code snippets presented by Heiko Oberdiek and Joseph +% Wright in a series of messages on \textsf{comp.text.tex} \cite{dec09}. +% \begin{macrocode} +\def\quo@in@false{\def\quo@indentfirsttype{0}} +\def\quo@in@true{\def\quo@indentfirsttype{1}} +\def\quo@in@auto{\def\quo@indentfirsttype{2}} +\define@key{quo}{indentfirst}{% + \ifcsname quo@in@#1\endcsname + \csname quo@in@#1\expandafter\endcsname + \else + \PackageError{quoting}{Unknown value #1 for option indentfirst}% + \fi +} +\setkeys{quo}{indentfirst=auto} +% \end{macrocode} +% \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 @@ -450,8 +491,11 @@ }% % \end{macrocode} % The length |\itemindent| is responsible for the first-line indentation -% of \quo/. |\itemindent| will be set to |\parindent| if the following -% conditions are met: +% of \quo/. Its value (0\,pt or |\parindent|) is controlled first and +% foremost by the state of the key \textsf{indentfirst} (\textsf{false}, +% \textsf{true}, or \textsf{auto}). In case automatic first-line +% indentation is enabled, |\itemindent| will be set to |\parindent| +% if the following conditions are met: % \begin{itemize} % % \item We are in vertical mode (which usually means that a blank line @@ -467,31 +511,36 @@ % both |@nobreak| and |@afterindent| are set to true. % % \end{itemize} -% Otherwise, |\itemindent| will be set to 0\,pt. % \begin{macrocode} - \setlength{\itemindent}{% - \ifbool{vmode}{% - \ifbool{quo@afterquo}{% - \z@ - }{% - \ifbool{@nobreak}{% - \ifbool{@afterindent}{% - \parindent + \ifcase\quo@indentfirsttype\relax + \setlength{\itemindent}{\z@}% + \or + \setlength{\itemindent}{\parindent}% + \or + \setlength{\itemindent}{% + \ifbool{vmode}{% + \ifbool{quo@afterquo}{% + \z@ + }{% + \ifbool{@nobreak}{% + \ifbool{@afterindent}{% + \parindent + }{% + \z@ + }% }{% - \z@ + \parindent }% - }{% - \parindent }% + }{% + \z@ }% - }{% - \z@ }% - }% + \fi % \end{macrocode} % The lengths |\leftmargin|, |\rightmargin|, |\listparindent|, and % |\parsep| are set, the latter two in accordance with the settings for -% normal running text. +% the surrounding text. % \begin{macrocode} \setlength{\leftmargin}{\quo@leftmargin}% \setlength{\rightmargin}{\quo@rightmargin}% -- cgit v1.2.3