diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/koma-script/scrlayer.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/koma-script/scrlayer.dtx | 211 |
1 files changed, 147 insertions, 64 deletions
diff --git a/Master/texmf-dist/source/latex/koma-script/scrlayer.dtx b/Master/texmf-dist/source/latex/koma-script/scrlayer.dtx index 4d051a66ba7..951299b9585 100644 --- a/Master/texmf-dist/source/latex/koma-script/scrlayer.dtx +++ b/Master/texmf-dist/source/latex/koma-script/scrlayer.dtx @@ -1,4 +1,4 @@ -% \CheckSum{3819} +% \CheckSum{3896} % \iffalse^^A meta-comment % ====================================================================== % scrlayer.dtx @@ -57,18 +57,18 @@ % Right brace \} Tilde \~} % % \iffalse^^A meta-comment -%<identify>%%% From File: $Id: scrlayer.dtx 2125 2015-06-09 07:58:46Z kohm $ (identify) -%<init>%%% From File: $Id: scrlayer.dtx 2125 2015-06-09 07:58:46Z kohm $ (init) -%<options>%%% From File: $Id: scrlayer.dtx 2125 2015-06-09 07:58:46Z kohm $ (options) -%<body>%%% From File: $Id: scrlayer.dtx 2125 2015-06-09 07:58:46Z kohm $ (body) -%<final>%%% From File: $Id: scrlayer.dtx 2125 2015-06-09 07:58:46Z kohm $ (final) +%<identify>%%% From File: $Id: scrlayer.dtx 2172 2015-07-30 09:39:05Z kohm $ (identify) +%<init>%%% From File: $Id: scrlayer.dtx 2172 2015-07-30 09:39:05Z kohm $ (init) +%<options>%%% From File: $Id: scrlayer.dtx 2172 2015-07-30 09:39:05Z kohm $ (options) +%<body>%%% From File: $Id: scrlayer.dtx 2172 2015-07-30 09:39:05Z kohm $ (body) +%<final>%%% From File: $Id: scrlayer.dtx 2172 2015-07-30 09:39:05Z kohm $ (final) %<*dtx> \ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi \begingroup \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}} - \filedate$Date: 2015-06-09 09:58:46 +0200 (Tue, 09 Jun 2015) $ + \filedate$Date: 2015-07-30 11:39:05 +0200 (Thu, 30 Jul 2015) $ \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}} - \filerevision$Revision: 2125 $ + \filerevision$Revision: 2172 $ \endgroup \ProvidesFile{scrlayer.dtx}[\filedate\space\filerevision\space %</dtx> @@ -1096,6 +1096,18 @@ % There are basic, primitive attributes and compounding attributes. The basic % attributes are: % \begin{description} +% \item[\texttt{mode=\meta{command sequence}}:] the mode that should be used +% to output the \texttt{contents}. A command \cs{layer\meta{command +% sequence}mode} with one argument need to be defined. +% \changes{v3.19}{2015/07/30}{new layer attribute \texttt{mode}}^^A +% \begin{macrocode} +\DefineFamilyKey[.definelayer]{KOMAarg}{mode}{% + \scr@ifundefinedorrelax{layer#1mode}{\FamilyKeyStateUnknownValue}{% + \@namedef{scr@l@\scr@current@layer @mode}{#1}% + \FamilyKeyStateProcessed + }% +} +% \end{macrocode} % \item[\texttt{hoffset=\meta{dimension expression}}:] offset from the left % edge of the paper. % \begin{macrocode} @@ -1370,8 +1382,6 @@ % % Attribute modifications are attributes, that modify existing basic % attributes: -% There are basic, primitive attributes and compounding attributes. The basic -% attributes are: % \begin{description} % \changes{v3.16}{2015/01/26}{new layer attribute \texttt{addhoffset}}^^A % \item[\texttt{addhoffset=\meta{dimension expression}}:] add to offset from @@ -1698,6 +1708,7 @@ }% }{% \FamilyKeyStateProcessed + \scrlayer@clone@attribute{\scr@current@layer}{#1}{mode}% \scrlayer@clone@attribute{\scr@current@layer}{#1}{x}% \scrlayer@clone@attribute{\scr@current@layer}{#1}{y}% \scrlayer@clone@attribute{\scr@current@layer}{#1}{w}% @@ -1717,7 +1728,7 @@ % \end{macrocode} % \begin{macro}{\scrlayer@clone@attribute} % \begin{macro}{\scrlayer@clone@switch} -% Two helpers used to at option \texttt{clone} to clone either a macro-based +% Two helpers used at option \texttt{clone} to clone either a macro-based % attribute or a if-based attribute. % \begin{macrocode} \newcommand*{\scrlayer@clone@attribute}[3]{% @@ -1739,6 +1750,7 @@ % \begin{macrocode} \newcommand{\DeclareLayer}[2][]{% \def\scr@current@layer{#2}% + \@namedef{scr@l@#2@mode}{text}% \@namedef{scr@l@#2@x}{\z@}% \@namedef{scr@l@#2@y}{\z@}% \@namedef{scr@l@#2@w}{\paperwidth}% @@ -1787,7 +1799,7 @@ % \begin{macrocode} %<*package&body> \newcommand*{\IfLayerExists}[1]{% - \scr@ifundefinedorrelax{scr@l@#1@x}{% + \scr@ifundefinedorrelax{scr@l@#1@mode}{% \expandafter\@secondoftwo }{% \expandafter\@firstoftwo @@ -1847,7 +1859,17 @@ \newcommand{\ModifyLayer}[2][]{% \IfLayerExists{#2}{% \def\scr@current@layer{#2}% - \FamilyExecuteOptions[.definelayer]{KOMAarg}{#1}% + \edef\reserved@a{% + \unexpanded{% + \FamilyExecuteOptions[.definelayer]{KOMAarg}{#1}% + \ifstr{\csname scr@l@#2@mode\endcsname}% + }{\csname scr@l@#2@mode\endcsname}% + }\reserved@a{}{% + \PackageWarning{scrlayer}{% + change of layer mode could result in unexpected\MessageBreak + output and errors% + }% + }% \let\scr@current@layer\@empty }{% \PackageError{scrlayer}{layer `#2' not yet defined}{% @@ -1903,6 +1925,7 @@ %<*package&body> \newcommand*{\DestroyLayer}[1]{% \IfLayerExists{#1}{% + \expandafter\let\csname scr@l@#1@mode\endcsname\relax \expandafter\let\csname scr@l@#1@x\endcsname\relax \expandafter\let\csname scr@l@#1@y\endcsname\relax \expandafter\let\csname scr@l@#1@w\endcsname\relax @@ -1948,6 +1971,7 @@ % % % \begin{macro}{\layercontentsmeasure} +% \changes{v3.19}{2015/07/27}{\cs{@gobble} eliminated}^^A % This may used by used as the only value of the layer option % \texttt{contents} to show measure lines around the layer. The left and the % top measure line will be in centimeter, the right and the bottom measure @@ -1957,88 +1981,100 @@ %<*package&body> \newcommand*{\layercontentsmeasure}{% \smash{\begin{picture}(0,0) - (0,\if t\scr@l@valign -\ht\strutbox - \else - \if b\scr@l@valign -\dimexpr\layerheight-\dp\strutbox\relax - \else -.5\dimexpr \layerheight+\ht\strutbox-\dp\strutbox\relax - \fi - \fi\@gobble) + (0,\LenToUnit{% + \if t\layervalign -\ht\strutbox + \else + \if b\layervalign -\dimexpr\layerheight-\dp\strutbox\relax + \else -.5\dimexpr \layerheight+\ht\strutbox-\dp\strutbox\relax + \fi + \fi}) % \end{macrocode} % 1st horizontal cm % \begin{macrocode} - \put(0,0){\line(1,0){\layerwidth\@gobble}}% + \setlength{\unitlength}{1mm}% + \put(0,0){\line(1,0){\LenToUnit{\layerwidth}}}% \@tempcnta=\numexpr \dimexpr\layerwidth + .5mm\relax/\dimexpr 1mm\relax\relax - \multiput(0,0)(1mm\@gobble,0){\@tempcnta}{% - \line(0,-1){1mm\@gobble}% + \multiput(0,0)(1,0){\@tempcnta}{% + \line(0,-1){1}% }% \@tempcnta=\numexpr \dimexpr\layerwidth + 2.5mm\relax/\dimexpr 5mm\relax\relax - \multiput(0,0)(5mm\@gobble,0){\@tempcnta}{% - \line(0,-1){2mm\@gobble}% + \multiput(0,0)(5,0){\@tempcnta}{% + \line(0,-1){2}% }% \@tempcnta=\numexpr \dimexpr\layerwidth + .5cm\relax/\dimexpr 1cm\relax\relax - \multiput(0,0)(10mm\@gobble,0){\@tempcnta}{% - \put(0,0){\line(0,-1){3mm\@gobble}}% - \put(0,-3.5mm\@gobble){% + \multiput(0,0)(10,0){\@tempcnta}{% + \put(0,0){\line(0,-1){3}}% + \put(0,-3.5){% \makebox(0,0)[ct]{\the\numexpr\@tempcnta-\@multicnt\relax}}% }% % \end{macrocode} % 2nd horizontal in: % \begin{macrocode} - \put(0,-\layerheight\@gobble){\line(1,0){\layerwidth\@gobble}}% + \put(0,\LenToUnit{-\layerheight}){\line(1,0){\LenToUnit{\layerwidth}}}% \@tempcnta=\numexpr \dimexpr\layerwidth + .05in\relax/\dimexpr .1in\relax\relax - \multiput(0,-\layerheight\@gobble)(.1in\@gobble,0){\@tempcnta}{% - \line(0,1){1mm\@gobble}% + \multiput(0,\LenToUnit{-\layerheight})(2.54,0){\@tempcnta}{% + \line(0,1){1}% }% \@tempcnta=\numexpr \dimexpr\layerwidth + .25in\relax/\dimexpr .5in\relax\relax - \multiput(0,-\layerheight\@gobble)(.5in\@gobble,0){\@tempcnta}{% - \line(0,1){2mm\@gobble}% + \multiput(0,\LenToUnit{-\layerheight})(12.7,0){\@tempcnta}{% + \line(0,1){2}% }% \@tempcnta=\numexpr \dimexpr\layerwidth + .5in\relax/\dimexpr 1in\relax\relax - \multiput(0,-\layerheight\@gobble)(1in\@gobble,0){\@tempcnta}{% - \put(0,0){\line(0,1){3mm\@gobble}}% - \put(0,3.5mm\@gobble){% + \multiput(0,\LenToUnit{-\layerheight})(25.4,0){\@tempcnta}{% + \put(0,0){\line(0,1){3}}% + \put(0,3.5){% \makebox(0,0)[cb]{\the\numexpr\@tempcnta-\@multicnt\relax}}% }% % \end{macrocode} % 3rd vertical cm: % \begin{macrocode} - \put(0,0){\line(0,-1){\layerheight\@gobble}}% + \put(0,0){\line(0,-1){\LenToUnit{\layerheight}}}% \@tempcnta\numexpr \dimexpr\layerheight + .5mm\relax/\dimexpr 1mm\relax\relax - \multiput(0,0)(0,-1mm\@gobble){\@tempcnta}{% - \line(1,0){1mm\@gobble}% + \multiput(0,0)(0,-1){\@tempcnta}{% + \line(1,0){1}% }% \@tempcnta\numexpr \dimexpr\layerheight + 2.5mm\relax/\dimexpr 5mm\relax\relax - \multiput(0,0)(0,-5mm\@gobble){\@tempcnta}{% - \line(1,0){2mm\@gobble}% + \multiput(0,0)(0,-5){\@tempcnta}{% + \line(1,0){2}% }% \@tempcnta\numexpr \dimexpr\layerheight + .5cm\relax/\dimexpr 1cm\relax\relax - \multiput(0,0)(0,-1cm\@gobble){\@tempcnta}{% - \put(0,0){\line(1,0){3mm\@gobble}}% - \put(3.5mm\@gobble,0){% + \multiput(0,0)(0,-10){\@tempcnta}{% + \put(0,0){\line(1,0){3}}% + \put(3.5,0){% \makebox(0,0)[cl]{\the\numexpr\@tempcnta-\@multicnt\relax}}% }% % \end{macrocode} % 4th vertical in: % \begin{macrocode} - \put(\layerwidth\@gobble,0){\line(0,-1){\layerheight\@gobble}}% + \put(\LenToUnit{\layerwidth},0){\line(0,-1){\LenToUnit{\layerheight}}}% \@tempcnta\numexpr \dimexpr\layerheight + .05in\relax/\dimexpr .1in\relax\relax - \multiput(\layerwidth\@gobble,0)(0,-.1in\@gobble){\@tempcnta}{% - \line(-1,0){1mm\@gobble}% + \multiput(\LenToUnit{\layerwidth},0)(0,-2.54){\@tempcnta}{% + \line(-1,0){1}% }% \@tempcnta\numexpr \dimexpr\layerheight + .25in\relax/\dimexpr .5in\relax\relax - \multiput(\layerwidth\@gobble,0)(0,-.5in\@gobble){\@tempcnta}{% - \line(-1,0){2mm\@gobble}% + \multiput(\LenToUnit{\layerwidth},0)(0,-12.7){\@tempcnta}{% + \line(-1,0){2}% }% \@tempcnta\numexpr \dimexpr\layerheight + .5in\relax/\dimexpr 1in\relax\relax - \multiput(\layerwidth\@gobble,0)(0,-1in\@gobble){\@tempcnta}{% - \put(0,0){\line(-1,0){3mm\@gobble}}% - \put(-3.5mm\@gobble,0){% + \multiput(\LenToUnit{\layerwidth},0)(0,-25.4){\@tempcnta}{% + \put(0,0){\line(-1,0){3}}% + \put(-3.5,0){% \makebox(0,0)[cr]{\the\numexpr\@tempcnta-\@multicnt\relax}}% }% \end{picture}}% } +% \end{macrocode} +% \begin{macro}{\LenToUnit} +% \changes{v3.19}{2015/07/27}{new} +% Due to an incompatibility of package \textsf{curve2e} I've eliminated +% \cs{@gobble} in the definition of \cs{layercontentsmeasure} and replaced it +% sometimes by \cs{LenToUnit} with the (not long) definition suggested by +% \textsf{curve2e} itself. +% \begin{macrocode} +\providecommand*{\LenToUnit}[1]{\strip@pt\dimexpr#1*\p@/\unitlength} %</package&body> % \end{macrocode} +% \end{macro}^^A \LenToUnit % \end{macro}^^A \layercontentsmeasure % % @@ -2788,7 +2824,9 @@ (\csname scr@l@#3@w\endcsname,% \csname scr@l@#3@h\endcsname)% [\csname scr@l@#3@align\endcsname]% - {\csname scr@l@#3@contents\endcsname}% + {\csname layer\csname scr@l@#3@mode\endcsname + mode\expandafter\endcsname + \csname scr@l@#3@contents\endcsname}% \fi \fi \fi @@ -2818,26 +2856,26 @@ \edef\layeryoffset{#2}% \edef\layerwidth{#3}% \edef\layerheight{#4}% - \def\scr@l@valign{t}% - \def\scr@l@halign{l}% + \def\layervalign{t}% + \def\layerhalign{l}% \edef\reserved@b{#5}% \expandafter\@tfor\expandafter\reserved@a\expandafter:\expandafter=% \reserved@b\do{% \if t\reserved@a - \def\scr@l@valign{t}% + \def\layervalign{t}% \else \if c\reserved@a - \def\scr@l@valign{c}% - \def\scr@l@halign{c}% + \def\layervalign{c}% + \def\layerhalign{c}% \else \if b\reserved@a - \def\scr@l@valign{b}% + \def\layervalign{b}% \else \if l\reserved@a - \def\scr@l@halign{l}% + \def\layerhalign{l}% \else \if r\reserved@a - \def\scr@l@halign{r}% + \def\layerhalign{r}% \else \PackageWarning{scrlayer}{% Unknown alignment `\reserved@a' ignored}% @@ -2849,12 +2887,12 @@ }% \parbox[t][\z@][t]{\z@}{% \vskip\layeryoffset - \if b\scr@l@valign\vskip-\layerheight\fi - \if c\scr@l@valign\vskip-.5\dimexpr\layerheight\relax\fi + \if b\layervalign\vskip-\layerheight\fi + \if c\layervalign\vskip-.5\dimexpr\layerheight\relax\fi \makebox[\z@][l]{% \hskip\layerxoffset - \makebox[\z@][\scr@l@halign]{% - \parbox[\scr@l@valign][\layerheight][\scr@l@valign]{\layerwidth}{% + \makebox[\z@][\layerhalign]{% + \parbox[\layervalign][\layerheight][\layervalign]{\layerwidth}{% \vskip\z@\strut{% \ifscrlayer@forceignoreuppercase \expandafter\let\csname MakeUppercase \endcsname\@firstofone @@ -2873,6 +2911,51 @@ % \end{macrocode} % \end{macro}^^A \scr@@layerbox % \end{macro}^^A \scr@layerbox +% +% \begin{macro}{\layerrawmode} +% \changes{v3.19}{2015/07/30}{new command}^^A +% \begin{macro}{\layertextmode} +% \changes{v3.19}{2015/07/30}{new command}^^A +% This is the command to output layers in raw mode. This is very simple: +% \begin{macrocode} +%<*package&body> +\newcommand{\layerrawmode}[1]{#1} +\newcommand{\layertextmode}[1]{#1} +%</package&body> +% \end{macrocode} +% \end{macro}^^A \layertextmode +% \end{macro}^^A \layerrawmode +% +% \begin{macro}{\layerpicturemode} +% \changes{v3.19}{2015/07/30}{new command}^^A +% This is a bit more complicated. It is the layer output for \texttt{picture} +% layers. In this case we use a picture environment and internally define some +% additional commands. +% \begin{macrocode} +%<*package&body> +\newcommand{\layerpicturemode}[1]{% + \begin{picture}(0,0) + (0,\LenToUnit{% + \if t\layervalign \dimexpr\layerheight-\ht\strutbox\relax + \else + \if b\layervalign \dp\strutbox + \else .5\dimexpr\layerheight-\ht\strutbox+\dp\strutbox\relax + \fi + \fi}) + \long\def\putLL##1{\put(0,0){##1}}% + \long\def\putUL##1{\put(0,\LenToUnit{\layerheight}){##1}}% + \long\def\putLR##1{\put(\LenToUnit{\layerwidth},0){##1}}% + \long\def\putUR##1{\put(\LenToUnit{\layerwidth},% + \LenToUnit{\layerheight}){##1}}% + \long\def\putC##1{\put(\LenToUnit{.5\dimexpr\layerwidth\relax},% + \LenToUnit{.5\dimexpr\layerheight\relax}){##1}}% + #1% + \end{picture}% +} +%</package&body> +% \end{macrocode} +% \end{macro}^^A \layerpicturemode +% % \begin{option}{draft} % \begin{macro}{\ifscrlayer@draft} % \begin{description} |