diff options
author | Karl Berry <karl@freefriends.org> | 2019-01-01 22:50:26 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-01-01 22:50:26 +0000 |
commit | 866a54256a3e665b4272e65691b8ebe5c1f97fb6 (patch) | |
tree | 6ed3664a09ffa27b1cfc1a245984091ed9bd905e | |
parent | 360b2217b3fb6cbf371c80bd9c4ed3352dc9a60c (diff) |
clrstrip (1jan19)
git-svn-id: svn://tug.org/texlive/trunk@49570 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/clrstrip/clrstrip.pdf | bin | 389020 -> 388970 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/clrstrip/clrstrip.dtx | 87 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/clrstrip/clrstrip.sty | 40 |
3 files changed, 53 insertions, 74 deletions
diff --git a/Master/texmf-dist/doc/latex/clrstrip/clrstrip.pdf b/Master/texmf-dist/doc/latex/clrstrip/clrstrip.pdf Binary files differindex 2337c77740f..0c49b53922c 100644 --- a/Master/texmf-dist/doc/latex/clrstrip/clrstrip.pdf +++ b/Master/texmf-dist/doc/latex/clrstrip/clrstrip.pdf 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} %</driver> %<*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} %</pkg> % \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 } diff --git a/Master/texmf-dist/tex/latex/clrstrip/clrstrip.sty b/Master/texmf-dist/tex/latex/clrstrip/clrstrip.sty index f785157d92d..590b039b110 100644 --- a/Master/texmf-dist/tex/latex/clrstrip/clrstrip.sty +++ b/Master/texmf-dist/tex/latex/clrstrip/clrstrip.sty @@ -29,9 +29,9 @@ %% and the derived files clrstrip.pdf and %% clrstrip.sty. %% -\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} \newsavebox\clrstrip@box \newlength\clrstrip@innerT @@ -47,20 +47,14 @@ \clrstrip@left1sp \newcommand*\clrstrip@oarg{} \newcommand*\clrstrip@marg{} -\newif\ifclrstrip@afterheading -\clrstrip@afterheadingtrue \newcommand*\clrstrip@key{\define@key{clrstrip}} -\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 @@ -84,16 +78,10 @@ \hsize\clrstrip@width \clrstrip@preventIndent } -\newcommand*\clrstrip@preventIndent - {% - \ifclrstrip@afterheading - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi - {\@afterindentfalse\@afterheading} - {\noindent\ignorespaces}% - } +\newcommand*\clrstrip@afterheading{\@afterindentfalse\@afterheading} +\newcommand*\clrstrip@noindent{\noindent\ignorespaces} +\newcommand*\clrstrip@preventIndent{} +\let\clrstrip@preventIndent\clrstrip@afterheading \clrstrip@key{inner}{\clrstrip@innerT#1\relax\clrstrip@innerB#1\relax} \clrstrip@key{outer}{\clrstrip@outerT#1\relax\clrstrip@outerB#1\relax} \clrstrip@key{inner top}{\clrstrip@innerT#1\relax} @@ -102,8 +90,8 @@ \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} \newcommand*\colorstripSet{\setkeys{clrstrip}} \newenvironment{colorstrip}[2][] {% @@ -116,12 +104,12 @@ \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 } |