diff options
author | Karl Berry <karl@freefriends.org> | 2019-10-13 21:40:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-10-13 21:40:52 +0000 |
commit | ed8702df3768e21a3ef87a2eec9ca8341aad9b7a (patch) | |
tree | d2eb8a06d685acdcb364d57efb2334dbd3b2914d /Master/texmf-dist/source/latex/koma-script/scrlayer-notecolumn.dtx | |
parent | 4b6c2d7660365ff9963bcecf7a802e8060eb1bbc (diff) |
koma-script (13oct19)
git-svn-id: svn://tug.org/texlive/trunk@52369 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/koma-script/scrlayer-notecolumn.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/koma-script/scrlayer-notecolumn.dtx | 252 |
1 files changed, 190 insertions, 62 deletions
diff --git a/Master/texmf-dist/source/latex/koma-script/scrlayer-notecolumn.dtx b/Master/texmf-dist/source/latex/koma-script/scrlayer-notecolumn.dtx index 324a5e83303..8a0c160a231 100644 --- a/Master/texmf-dist/source/latex/koma-script/scrlayer-notecolumn.dtx +++ b/Master/texmf-dist/source/latex/koma-script/scrlayer-notecolumn.dtx @@ -1,8 +1,8 @@ -% \CheckSum{1747} +% \CheckSum{1866} % \iffalse^^A meta-comment % ====================================================================== % scrlayer-notecolumn.dtx -% Copyright (c) Markus Kohm, 2013-2018 +% Copyright (c) Markus Kohm, 2013-2019 % % This file is part of the LaTeX2e KOMA-Script bundle. % @@ -20,7 +20,7 @@ % This work consists of all files listed in manifest.txt. % ---------------------------------------------------------------------- % scrlayer-notecolumn.dtx -% Copyright (c) Markus Kohm, 2013-2018 +% Copyright (c) Markus Kohm, 2013-2019 % % Diese Datei ist Teil der LaTeX2e KOMA-Script-Sammlung. % @@ -57,7 +57,7 @@ % Right brace \} Tilde \~} % % \iffalse^^A meta-comment -%%% From File: $Id: scrlayer-notecolumn.dtx 3011 2018-08-29 07:35:17Z kohm $ +%%% From File: $Id: scrlayer-notecolumn.dtx 3161 2019-06-27 06:41:04Z kohm $ %<identify>%%% (run: identify) %<init>%%% (run: init) %<options>%%% (run: options) @@ -67,9 +67,9 @@ \ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi \begingroup \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}} - \filedate$Date: 2018-08-29 09:35:17 +0200 (Wed, 29 Aug 2018) $ - \def\filerevision$#1: #2 ${\gdef\filerevision{v0.1.#2}} - \filerevision$Revision: 3011 $ + \filedate$Date: 2019-06-27 08:41:04 +0200 (Thu, 27 Jun 2019) $ + \def\filerevision$#1: #2 ${\gdef\filerevision{v0.3.#2}} + \filerevision$Revision: 3161 $ \edef\reserved@a{% \noexpand\endgroup \noexpand\ProvidesFile{scrlayer-notecolumn.dtx}% @@ -229,8 +229,8 @@ % % Here we test the used pdf\TeX{} primitives. % \changes{v0.1}{2015/10/07}{ready for renaming \cs{pdfsavepos} and -% \cs{pdflastypos} in luaTeX}^^A -% \changes{v0.1.2483}{2016/06/28}{grouping fixed}^^A +% \cs{pdflastypos} in luaTeX}%^^A +% \changes{v0.1.2483}{2016/06/28}{grouping fixed}%^^A % \begin{macrocode} \@tempswatrue \scr@ifundefinedorrelax{pdfsavepos}{% @@ -328,6 +328,29 @@ }% }{}% % \end{macrocode} +% \changes{3.27}{2019/02/14}{initialization of one colour stack per note +% column}%^^A +% For colour support we also need one colour stack per note column. A colour +% stack is a feature only available for pdf\TeX{} and lua\TeX{}. +% \begin{macrocode} + \@ifundefined{slnc@#2@colorstack}{% + \scr@ifundefinedorrelax{pdfcolorstackinit}{% + \scr@ifundefinedorrelax{pdffeedback}{}{% + \expandafter\chardef\csname slnc@#2@colorstack\endcsname= + \pdffeedback colorstackinit direct {\slnc@initial@black}% + \scrlayerOnAutoRemoveInterface[scrlayer-notecolumn.sty]{% + \expandafter\let\csname slnc@#2@colorstack\endcsname\relax + }% + }% + }{% + \expandafter\chardef\csname slnc@#2@colorstack\endcsname= + \pdfcolorstackinit direct {\slnc@initial@black}% + \scrlayerOnAutoRemoveInterface[scrlayer-notecolumn.sty]{% + \expandafter\let\csname slnc@#2@colorstack\endcsname\relax + }% + }% + }{}% +% \end{macrocode} % If there isn't a font element for the (new) note column, we define a new one % and add it to the auto-remove code: % \begin{macrocode} @@ -398,6 +421,27 @@ }% } % \end{macrocode} +% \begin{macro}{\slnc@initial@black} +% \changes{v0.2.3085}{2019/02/14}{new internal}%^^A +% The initial black is the colour used to initialize the colour stacks. As long +% as only pdf\TeX{} and lua\TeX{} provide colour stacks, we can initialize it +% with \texttt{0 g 0 G}. However it may be better to use the initial +% \cs{current@color} of the used colour package. Using \cs{default@color} would +% be even better, but this is not available until \cs{begin\{document\}}. +% \begin{macrocode} +\scrlayerAddToInterface\slnc@initial@black{% + \newcommand*{\slnc@initial@black}{0 g 0 G}% + \AfterPackage*{color}{% + \let\slnc@initial@black\current@color + \AtBeginDocument{\let\slnc@initial@black\default@color}% + }% + \AfterPackage*{xcolor}{% + \let\slnc@initial@black\current@color + \AtBeginDocument{\let\slnc@initial@black\default@color}% + }% +} +% \end{macrocode} +% \end{macro}%^^A \slnc@initial@black % \begin{macro}{\slnc@processnotecolumns} % This is a list of all declared note columns in \LaTeX{} syntax (using % \Macro{@cons} and \Macro{@elt} etc.). @@ -406,7 +450,7 @@ \newcommand*{\slnc@processnotecolumns}{}% } % \end{macrocode} -% \end{macro}^^A \slnc@processnotecolumns +% \end{macro}%^^A \slnc@processnotecolumns % \begin{macrocode} %</body> % \end{macrocode} @@ -687,11 +731,11 @@ % % \begin{macro}{\tf@slnc} % \changes{v0.1.2395}{2016/03/25}{write to \texttt{aux}-file with -% \cs{if@filesw}}^^A +% \cs{if@filesw}}%^^A % \begin{macro}{\slnc@initwrite} % \begin{macro}{\slnc@openwrite} % \changes{v0.1.2928}{2018/02/02}{use \cs{closein} instead of \cs{closeout} -% to close \cs{slnc@file}}^^A +% to close \cs{slnc@file}}%^^A % First of all we need a file to write the notes to. We use the % \File{aux}-file to write into the file, because we need to read the file % while the document will be typeset and the same time we need to write into @@ -727,9 +771,9 @@ % calculate the md5 checksum of the \File{slnc}-file. If it has been changed % we set |\if@tempswa| to |\iftrue| to provocate a rerun message. % \changes{v0.1.2872}{2018/01/17}{usage of Lua function -% \texttt{slncmdfivesum}}^^A +% \texttt{slncmdfivesum}}%^^A % \changes{v0.1.2972}{2018/04/01}{usage of not yet documented Xe\TeX{} -% primitive \cs{mdfivesum}}^^A +% primitive \cs{mdfivesum}}%^^A % \begin{macrocode} \AfterReadingMainAux{% \immediate\closeout\tf@slnc @@ -781,9 +825,9 @@ } %</body> % \end{macrocode} -% \end{macro}^^A \slnc@openwrite -% \end{macro}^^A \slnc@initwrite -% \end{macro}^^A \tf@slnc +% \end{macro}%^^A \slnc@openwrite +% \end{macro}%^^A \slnc@initwrite +% \end{macro}%^^A \tf@slnc % % \begin{macro}{\makenote} % \begin{description} @@ -798,9 +842,9 @@ % There is a star variant with the same parameters, that writes the % \meta{code} un-expanded. To do so, we need some internal commands. % \begin{macro}{\slnc@unexpanded} -% \changes{0.1.2583}{2017/02/08}{new (internal)}^^A +% \changes{0.1.2583}{2017/02/08}{new (internal)}%^^A % \begin{macro}{\slnc@makenote} -% \changes{0.1.2583}{2017/02/08}{new (internal)}^^A +% \changes{0.1.2583}{2017/02/08}{new (internal)}%^^A % \begin{macrocode} %<*body> \scrlayerAddToInterface\slnc@unexpanded{% @@ -840,10 +884,10 @@ }{} %</body> % \end{macrocode} -%^^A \end{counter}^^A slncpage -% \end{macro}^^A \slnc@unexpanded -% \end{macro}^^A \slnc@makenote -% \end{macro}^^A \makenote +%^^A \end{counter}%^^A slncpage +% \end{macro}%^^A \slnc@unexpanded +% \end{macro}%^^A \slnc@makenote +% \end{macro}%^^A \makenote % % \begin{macro}{\slnc@processnotes} % \begin{description} @@ -902,11 +946,15 @@ \expandafter\setbox\csname slnc@#1@box\endcsname\vbox{% \expandafter\hsize\csname slnc@#1@width\endcsname \normalfont\normalsize - {% % \end{macrocode} -% Question: Why is it not allowed to set a colour here? +% \changes{v0.2.3085}{2019/02/14}{using colour stack if available}%^^A +% If a color stack is available we switch to it before changing the font. So a +% color definition inside the font would overwrite every color change inside +% the column! But if we don't have a color stack, color switching is not +% permitted! % \begin{macrocode} - \let\color\@gobble + \slnc@switchcolorstack{#1}% + {% \usekomafont{notecolumn.#1}{% \slnc@notesyncfonttest{#1}% \expandafter\ifvoid\csname slnc@#1@box\endcsname @@ -916,7 +964,7 @@ \fi % \end{macrocode} % \changes{v0.1}{2015/10/07}{ready for renaming \cs{pdfpageheight} in -% luaTeX}^^A +% luaTeX}%^^A % From lua\TeX~0.80.1 \cs{pdfpageheight} will be renamed into % \cs{pageheight}. So we have to do an extra test for the new primitive. % \begin{macrocode} @@ -972,7 +1020,7 @@ \ifdim\@tempdima>\z@ \kern\@tempdima\fi \fi % \end{macrocode} -% \changes{v0.1.2582}{2017/02/08}{restore several commands}^^A +% \changes{v0.1.2582}{2017/02/08}{restore several commands}%^^A % Some commands have to be restored when processing the note. % \begin{macrocode} \slnc@restoreinnote @@ -1019,6 +1067,7 @@ \splitmaxdepth\baselineskip % \end{macrocode} % Bring back the colours: +% \changes{v0.2.3085}{2019/02/14}{\cs{slnc@switchcolorstack} added}%^^A % \begin{macrocode} \usekomafont{notecolumn.#1}{% \expandafter\vsplit\csname slnc@#1@box\endcsname to @@ -1027,7 +1076,8 @@ \expandafter\ifvoid\csname slnc@#1@box\endcsname \else \expandafter\setbox\csname slnc@#1@box\endcsname\vbox{% - \expandafter\unvbox\csname slnc@#1@box\endcsname + \slnc@switchcolorstack{#1}% + \expandafter\unvbox\csname slnc@#1@box\endcsname }% \fi \else @@ -1036,8 +1086,10 @@ %</trace> % \end{macrocode} % Bring back the colours: +% \changes{v0.2.3085}{2019/02/14}{\cs{slnc@switchcolorstack} added}%^^A % \begin{macrocode} \usekomafont{notecolumn.#1}{% + \slnc@switchcolorstack{#1}% \expandafter\box\csname slnc@#1@box\endcsname% }% \fi @@ -1049,10 +1101,61 @@ } } % \end{macrocode} +% \begin{macro}{\slnc@switchcolorstack} +% \changes{v0.2.3085}{2019/02/14}{new internal}%^^A +% This either redefines \cs{set@color} or switches to the colour stack of the +% note column given by the argument. +% \begin{macrocode} +\scrlayerAddToInterface{\slnc@switchcolorstack}{% + \newcommand*{\slnc@switchcolorstack}[1]{% + \scr@ifundefinedorrelax{slnc@#1@colorstack}{% + \def\set@color{% + \PackageWarningNoLine{scrlayer-notecolumn}{% + unsupported change of colour!\MessageBreak + It seems you are using a TeX engine,\MessageBreak + that does not support switching the\MessageBreak + colour stack like pdfTeX or luaTeX do.\MessageBreak + Because of this, usage of \string\color,\MessageBreak + \string\textcolor\space etc. inside a note + column\MessageBreak + is not supported% + }% + }% + }{% + \scr@ifundefinedorrelax{@pdfcolorstack}{% + }{% + \expandafter\let\expandafter\@pdfcolorstack + \csname slnc@#1@colorstack\endcsname + }% + \scr@ifundefinedorrelax{pdfcolorstack}{% + \scr@ifundefinedorrelax{pdfextension}{% + \PackageError{scrlayer-notecolumm}{% + colour stack defined but not usable% + }{% + \expandafter\string + \csname slnc@#1@colorstack\endcsname\space defined + \MessageBreak + but neither \string\pdfcolorstack\space nor + \string\pdfextension.\MessageBreak + This should never happen!% + }% + }{% + \pdfextension colorstack + \csname slnc@#1@colorstack\endcsname current\relax + }% + }{% + \pdfcolorstack + \csname slnc@#1@colorstack\endcsname current\relax + }% + }% + }% +} +% \end{macrocode} +% \end{macro}%^^A \slnc@switchcolorstack % \begin{macro}{\restoreinnote} -% \changes{0.1.2582}{2017/02/08}{new command}^^A +% \changes{0.1.2582}{2017/02/08}{new command}%^^A % \begin{macro}{\slnc@restoreinnote} -% \changes{0.1.2582}{2017/02/08}{new (internal)}^^A +% \changes{0.1.2582}{2017/02/08}{new (internal)}%^^A % Some commands have to be restored while processing the notes. By default % these are \cs{label}, \cs{index}, \cs{glossary}. More can be added using % \cs{restoreinnote}. The storage is \cs{slnc@restoreinnote}. @@ -1077,12 +1180,34 @@ \restoreinnote\glossary } % \end{macrocode} -% \end{macro}^^A \slnc@restoreinnote -% \end{macro}^^A \restoreinnote +% \end{macro}%^^A \slnc@restoreinnote +% \end{macro}%^^A \restoreinnote % \begin{macro}{\slnc@readnotes} % Read as long notes from the notes file until the number at \#2 of % \Macro{slnc@note} or \Macro{slnc@sync} in the file is greater than % \Counter{slncpage}. Put all these to the corresponding unprocessed list. +% \begin{macro}{\slnc@catcodes} +% \changes{v0.3}{2019/03/02}{new internal}%^^A +% We need a helper macro \cs{slnc@catcodes} to restore (some of) the catcodes +% before reading from file. +% \begin{macrocode} +\scrlayerAddToInterface\slnc@catcodes{% + \newcommand*{\slnc@catcodes}{}% +} +\AtBeginDocument{% + \begingroup + \def\do#1{% + \protected@xdef\slnc@catcodes{\slnc@catcodes + \catcode`\protect#1=\the\catcode`#1\relax + }% + }% + \dospecials + \let\protect\noexpand + \xdef\slnc@catcodes{\slnc@catcodes\catcode`\protect\@=11\relax}% + \endgroup +} +% \end{macrocode} +% \end{macro}%^^A \slnc@catcodes % \begin{macrocode} \scrlayerAddToInterface\slnc@readnotes{% \newcommand*\slnc@readnotes[1]{% @@ -1093,13 +1218,16 @@ \@tempswatrue \fi \@whilesw\if@tempswa\fi{% - \edef\reserved@a{% - \noexpand\makeatletter + \begingroup + \slnc@catcodes \endlinechar\m@ne - \read\noexpand\slnc@file to\noexpand\reserved@a - \endlinechar\the\endlinechar\relax - \catcode`\noexpand\@=\the\catcode`\@\relax - }% + \read\slnc@file to\reserved@a + \edef\reserved@a{% + \endgroup + \noexpand\def\noexpand\reserved@a{% + \unexpanded\expandafter{\reserved@a}% + }% + }% \reserved@a \expandafter\slnc@iofv\expandafter\reserved@b\reserved@a \@empty\@empty\@empty\@empty\@empty @@ -1155,7 +1283,7 @@ }% } % \end{macrocode} -% \end{macro}^^A \slnc@readnotes +% \end{macro}%^^A \slnc@readnotes % \begin{macro}{\slnc@iofv} % \begin{macro}{\slnc@iiofv} % \begin{macro}{\slnc@iiiofv} @@ -1170,9 +1298,9 @@ \newcommand\slnc@iiiofv[6]{\def#1{#4}}% } % \end{macrocode} -% \end{macro}^^A \slnc@iiiofv -% \end{macro}^^A \slnc@iiofv -% \end{macro}^^A \slnc@iofv +% \end{macro}%^^A \slnc@iiiofv +% \end{macro}%^^A \slnc@iiofv +% \end{macro}%^^A \slnc@iofv % \begin{macro}{\slnc@unprocessed} % The \#2 of the last read note column from notes file. % \begin{macrocode} @@ -1184,12 +1312,12 @@ % \begin{macro}{\slnc@file} % The input file with the unprocessed notes. % \changes{v0.1.2928}{2018/02/02}{use \cs{closein} instead of \cs{closeout} -% to close \cs{slnc@file}}^^A +% to close \cs{slnc@file}}%^^A % \begin{macro}{\slnc@mdfivesum} % \changes{v0.1.2872}{2018/01/17}{definition and usage of Lua function -% \texttt{slncmdfivesum}}^^A +% \texttt{slncmdfivesum}}%^^A % \changes{v0.1.2972}{2018/04/01}{usage of not yet documented Xe\TeX{} -% primitive \cs{mdfivesum}}^^A +% primitive \cs{mdfivesum}}%^^A % The MD5 sum of the file before opening it for reading. % \begin{macrocode} %<*body> @@ -1231,10 +1359,10 @@ } %</body> % \end{macrocode} -% \end{macro}^^A \slnc@mdfivesum -% \end{macro}^^A \slnc@file -% \end{macro}^^A \slnc@unprocessed -% \end{macro}^^A \slnc@processnotes +% \end{macro}%^^A \slnc@mdfivesum +% \end{macro}%^^A \slnc@file +% \end{macro}%^^A \slnc@unprocessed +% \end{macro}%^^A \slnc@processnotes % % \begin{option}{autoclearnotecolumns} % \begin{macrocode} @@ -1393,8 +1521,8 @@ \def\slnc@secondof#1#2#3\@nil{#2}% } % \end{macrocode} -% \end{macro}^^A \slnc@firstof -% \end{macro}^^A \slnc@secondof +% \end{macro}%^^A \slnc@firstof +% \end{macro}%^^A \slnc@secondof % \begin{macro}{\slnc@voidtest} % \begin{description} % \item[\Parameter{string}:] the name of a note column (must be fully @@ -1410,12 +1538,12 @@ } %</body> % \end{macrocode} -% \end{macro}^^A \slnc@voidtest -% \end{macro}^^A \clearnotecolumn +% \end{macro}%^^A \slnc@voidtest +% \end{macro}%^^A \clearnotecolumn % % \begin{macro}{\clearnotecolumns} -% \changes{v3.26}{2018/08/29}{\cs{scr@trim@spaces} added}^^A -% \changes{v3.26}{2018/08/29}{removed spurious \cs{expandafter}}^^A +% \changes{v3.26}{2018/08/29}{\cs{scr@trim@spaces} added}%^^A +% \changes{v3.26}{2018/08/29}{removed spurious \cs{expandafter}}%^^A % \begin{description} % \item[\OParameter{string list}:] comma separated list of note column names % (must be fully expandable and each element must expand to a string only, @@ -1565,7 +1693,7 @@ } %</body> % \end{macrocode} -% \end{macro}^^A \clearnotecolumns +% \end{macro}%^^A \clearnotecolumns % % % \section{Syncronisation of Text and Note} @@ -1578,8 +1706,8 @@ % synchronisation of the text with the note. % % \begin{macro}{\syncwithnotecolumn} -% \changes{v3.26}{2018/08/29}{\cs{scr@trim@spaces} added}^^A -% \changes{v3.26}{2018/08/29}{removed spurious \cs{expandafter}}^^A +% \changes{v3.26}{2018/08/29}{\cs{scr@trim@spaces} added}%^^A +% \changes{v3.26}{2018/08/29}{removed spurious \cs{expandafter}}%^^A % \begin{description} % \item[\OParameter{string}:] the name of the note column to sync with (this % must be fully expandable and expand to the name of a note column). By @@ -1707,7 +1835,7 @@ }% % \end{macrocode} % \changes{v0.1}{2015/10/07}{ready for renaming \cs{pdfpageheight} in -% luaTeX}^^A +% luaTeX}%^^A % From lua\TeX~0.80.1 \cs{pdfpageheight} will be renamed into % \cs{pageheight}. So we have to do an extra test for the new primitive. % \begin{macrocode} @@ -1765,8 +1893,8 @@ } %</body> % \end{macrocode} -% \end{macro}^^A \slnc@vadjust -% \end{macro}^^A \syncwithnotecolumn +% \end{macro}%^^A \slnc@vadjust +% \end{macro}%^^A \syncwithnotecolumn % % % \iffalse^^A meta-comment |