From 866a54256a3e665b4272e65691b8ebe5c1f97fb6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 1 Jan 2019 22:50:26 +0000 Subject: clrstrip (1jan19) git-svn-id: svn://tug.org/texlive/trunk@49570 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/clrstrip/clrstrip.dtx | 87 ++++++++++------------ 1 file changed, 39 insertions(+), 48 deletions(-) (limited to 'Master/texmf-dist/source/latex/clrstrip') diff --git a/Master/texmf-dist/source/latex/clrstrip/clrstrip.dtx b/Master/texmf-dist/source/latex/clrstrip/clrstrip.dtx index 4ef03235e70..61fcded2752 100644 --- a/Master/texmf-dist/source/latex/clrstrip/clrstrip.dtx +++ b/Master/texmf-dist/source/latex/clrstrip/clrstrip.dtx @@ -57,7 +57,7 @@ and the derived files clrstrip.pdf and %<*driver> \ProvidesFile{clrstrip.dtx} [% - \csname clrstrip@date\endcsname\ + \csname clrstrip@date\endcsname\space place contents into a full width colour strip% ] \documentclass{l3doc} @@ -85,9 +85,9 @@ and the derived files clrstrip.pdf and \end{document} % %<*pkg> -\newcommand*\clrstrip@date{2018/09/27} +\newcommand*\clrstrip@date{2018-12-31} \ProvidesPackage{clrstrip} - [\clrstrip@date place contents into a full width colour strip] + [\clrstrip@date\space place contents into a full width colour strip] \RequirePackage{keyval} % % \fi @@ -119,7 +119,7 @@ and the derived files clrstrip.pdf and % % It is meant to be lightweight and fast. So while packages like \pkg{tcolorbox} % provide very pretty output, this package has a simplistic look achieved with -% under 100~lines of code. +% less than 100~lines of code. % % It is written as a docstrip file: executing |latex clrstrip.dtx| generates the % \file{clrstrip.sty} file and typesets this documentation; execute @@ -164,9 +164,9 @@ and the derived files clrstrip.pdf and % And the code boxes in this section (except this one) are surrounded by % \begin{colorstrip}{gray!15}[inner=2ex] % |\begin{colorstrip}{gray!15}[inner bot=0pt, inner top=2ex]|\\ -% |\begin{verbatim} |\\ -% |\end{verbatim} |\\ -% |\end{colorstrip} | +% |\begin{verbatim}|\\ +% |\end{verbatim} |\\ +% |\end{colorstrip}| % \end{colorstrip} % % \section{Documentation} @@ -229,12 +229,12 @@ and the derived files clrstrip.pdf and % Ignores every value given to it. If used the indentation of the first line % in a \env{colorstrip} will be prevented using the \LaTeX\ macros % \cs{@afterindentfalse} and \cs{@afterheading}. This is the package default -% since version 2018/09/25. +% since version 2018-09-25. % \item[noindent] % Ignores every value given to it. If used the indentation of the first line % in a \env{colorstrip} will be prevented using the \TeX\ primitives % \cs{noindent} and \cs{ignorespaces}. This was the package default before -% version 2018/09/25. +% version 2018-09-25. % \end{options} % % \subsection{Dependencies} @@ -297,8 +297,8 @@ and the derived files clrstrip.pdf and % \end{variable} % % \begin{variable}{\clrstrip@width} -% Stores the lower inner padding. Gets reused to store the overall depth of -% the colour strip locally. +% Stores the width the text block inside of the colour strip should be wide. +% Might be reused to calculate the skip to centre the text block locally. % \begin{macrocode} \newlength\clrstrip@width % \end{macrocode} @@ -327,15 +327,6 @@ and the derived files clrstrip.pdf and % \end{macrocode} % \end{variable} % -% \begin{variable}{\clrstrip@preventIndent} -% Stores whether \cs{@afterheading} should be used to prevent the indentation -% of the first line (if true) or \cs{noindent} (if false) -% \begin{macrocode} -\newif\ifclrstrip@afterheading -\clrstrip@afterheadingtrue -% \end{macrocode} -% \end{variable} -% % \subsection{Internal Macros} % % \begin{macro}{\clrstrip@key} @@ -345,23 +336,21 @@ and the derived files clrstrip.pdf and % \end{macrocode} % \end{macro} % -% \begin{macro}{\clrstrip@strip@a,\clrstrip@strip@b} -% Draws the colour strip using \cs{vrule}. \cs{clrstrip@strip@a} is used to -% expand the optional argument for \cs{clrstrip@strip@b} and should be called -% with the expanded mandatory argument as its argument. \cs{clrstrip@strip@b} -% then sets the colour and draws the \cs{vrule}. +% \begin{macro}{\clrstrip@strip} +% Draws the colour strip using \cs{vrule}. \cs{clrstrip@strip} should be +% called with the expanded \cs{clrstrip@marg} as its argument. It tests +% whether the first optional argument is empty, sets the colour accordingly +% and draws the \cs{vrule}. The arguments to \cs{color} need to be expanded as +% \pkg{color} doesn't work with the unexpanded once depending on the chosen +% colour model. % \begin{macrocode} -\newcommand*\clrstrip@strip@a[1] - {% - \expandafter\clrstrip@strip@b\expandafter{\clrstrip@oarg}{#1}% - } -\newcommand*\clrstrip@strip@b[2] +\newcommand*\clrstrip@strip[1] {% \begingroup - \if\relax\detokenize{#1}\relax - \color{#2}% + \ifx\clrstrip@oarg\@empty + \color{#1}% \else - \color[#1]{#2}% + \expandafter\color\expandafter[\clrstrip@oarg]{#1}% \fi \advance\clrstrip@innerT\ht\clrstrip@box \advance\clrstrip@innerB\dp\clrstrip@box @@ -395,19 +384,21 @@ and the derived files clrstrip.pdf and % \end{macrocode} % \end{macro} % +% \begin{macro}{\clrstrip@afterheading,\clrstrip@noindent} +% These two macros are the two options to suppress the indentation in a +% \env{colorstrip}. +% \begin{macrocode} +\newcommand*\clrstrip@afterheading{\@afterindentfalse\@afterheading} +\newcommand*\clrstrip@noindent{\noindent\ignorespaces} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\clrstrip@preventIndent} -% Used to prevent the indentation of the first line in a \env{colorstrip}. +% Used to prevent the indentation of the first line in a \env{colorstrip}. It +% will be let to one of \cs{clrstrip@afterheading} or \cs{clrstrip@noindent}. % \begin{macrocode} -\newcommand*\clrstrip@preventIndent - {% - \ifclrstrip@afterheading - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi - {\@afterindentfalse\@afterheading} - {\noindent\ignorespaces}% - } +\newcommand*\clrstrip@preventIndent{} +\let\clrstrip@preventIndent\clrstrip@afterheading % \end{macrocode} % \end{macro} % @@ -422,8 +413,8 @@ and the derived files clrstrip.pdf and \clrstrip@key{outer bot}{\clrstrip@outerB#1\relax} \clrstrip@key{width}{\clrstrip@width#1\relax} \clrstrip@key{left}{\clrstrip@left#1\relax} -\clrstrip@key{afterheading}[]{\clrstrip@afterheadingtrue} -\clrstrip@key{noindent}[]{\clrstrip@afterheadingfalse} +\clrstrip@key{afterheading}[]{\let\clrstrip@preventIndent\clrstrip@afterheading} +\clrstrip@key{noindent}[]{\let\clrstrip@preventIndent\clrstrip@noindent} % \end{macrocode} % % \subsection{User Level Macros} @@ -454,12 +445,12 @@ and the derived files clrstrip.pdf and \par \vskip\clrstrip@outerT \noindent - \expandafter\clrstrip@strip@a\expandafter{\clrstrip@marg}% + \expandafter\clrstrip@strip\expandafter{\clrstrip@marg}% \ifdim\clrstrip@left=1sp \advance\clrstrip@width-\linewidth \clrstrip@left-.5\clrstrip@width \fi - \rlap{\hskip\clrstrip@left\usebox\clrstrip@box}% + \rlap{\hskip\clrstrip@left\copy\clrstrip@box}% \par \vskip\clrstrip@outerB } -- cgit v1.2.3