summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/koma-script/source/scrkernel-pseudolengths.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/koma-script/source/scrkernel-pseudolengths.dtx')
-rw-r--r--macros/latex/contrib/koma-script/source/scrkernel-pseudolengths.dtx382
1 files changed, 178 insertions, 204 deletions
diff --git a/macros/latex/contrib/koma-script/source/scrkernel-pseudolengths.dtx b/macros/latex/contrib/koma-script/source/scrkernel-pseudolengths.dtx
index b3d2f623cf..4c891a8620 100644
--- a/macros/latex/contrib/koma-script/source/scrkernel-pseudolengths.dtx
+++ b/macros/latex/contrib/koma-script/source/scrkernel-pseudolengths.dtx
@@ -1,8 +1,7 @@
-% \CheckSum{223}
% \iffalse meta-comment
% ======================================================================
% scrkernel-pseudolengths.dtx
-% Copyright (c) Markus Kohm, 2006-2019
+% Copyright (c) Markus Kohm, 2002-2022
%
% This file is part of the LaTeX2e KOMA-Script bundle.
%
@@ -18,54 +17,17 @@
% The Current Maintainer and author of this work is Markus Kohm.
%
% This work consists of all files listed in manifest.txt.
-% ----------------------------------------------------------------------
-% scrkernel-pseudolengths.dtx
-% Copyright (c) Markus Kohm, 2006-2019
-%
-% Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz,
-% Version 1.3c, verteilt und/oder veraendert werden.
-% Die neuste Version dieser Lizenz ist
-% http://www.latex-project.org/lppl.txt
-% und Version 1.3c ist Teil aller Verteilungen von LaTeX
-% Version 2005/12/01 oder spaeter und dieses Werks.
-%
-% Dieses Werk hat den LPPL-Verwaltungs-Status "author-maintained"
-% (allein durch den Autor verwaltet).
-%
-% Der Aktuelle Verwalter und Autor dieses Werkes ist Markus Kohm.
-%
-% Dieses Werk besteht aus den in manifest.txt aufgefuehrten Dateien.
% ======================================================================
-% \fi
-%
-% \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
-% Lower-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
-% Digits \0\1\2\3\4\5\6\7\8\9
-% Exclamation \! Double quote \" Hash (number) \#
-% Dollar \$ Percent \% Ampersand \&
-% Acute accent \' Left paren \( Right paren \)
-% Asterisk \* Plus \+ Comma \,
-% Minus \- Point \. Solidus \/
-% Colon \: Semicolon \; Less than \<
-% Equals \= Greater than \> Question mark \?
-% Commercial at \@ Left bracket \[ Backslash \\
-% Right bracket \] Circumflex \^ Underscore \_
-% Grave accent \` Left brace \{ Vertical bar \|
-% Right brace \} Tilde \~}
-%
-% \iffalse
-%%% From File: $Id: scrkernel-pseudolengths.dtx 3262 2019-10-10 08:25:29Z kohm $
+%%% From File: $Id: scrkernel-pseudolengths.dtx 3701 2022-02-14 09:17:40Z kohm $
%<option>%%% (run: option)
%<body>%%% (run: body)
%<*dtx>
-% \fi
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
\begingroup
\def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
- \filedate$Date: 2019-10-10 10:25:29 +0200 (Thu, 10 Oct 2019) $
+ \filedate$Date: 2022-02-14 10:17:40 +0100 (Mo, 14. Feb 2022) $
\def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
- \filerevision$Revision: 1872 $
+ \filerevision$Revision: 3701 $
\edef\reserved@a{%
\noexpand\endgroup
\noexpand\ProvidesFile{scrkernel-pseudolengths.dtx}%
@@ -74,93 +36,106 @@
(pseudo length)]
}%
\reserved@a
-% \iffalse
-\documentclass{scrdoc}
-\usepackage[english,ngerman]{babel}
-\CodelineIndex
-\RecordChanges
-\GetFileInfo{scrkernel-pseudolengths.dtx}
-\title{\KOMAScript{} \partname\ \texttt{\filename}%
- \footnote{Dies ist Version \fileversion\ von Datei \texttt{\filename}.}}
-\date{\filedate}
-\author{Markus Kohm}
-
+\documentclass[USenglish]{koma-script-source-doc}
+\usepackage{babel}
+\usepackage{hvlogos}
+\setcounter{StandardModuleDepth}{2}
\begin{document}
- \maketitle
- \tableofcontents
- \DocInput{\filename}
+\DocInput{scrkernel-pseudolengths.dtx}
\end{document}
%</dtx>
-% \fi
+% \fi^^A meta-comment
+%
+% \changes{v2.95}{2002/06/20}{first version after splitting \file{scrclass.dtx}}
+% \changes{v3.36}{2022/02/14}{switch over from \cls*{scrdoc} to
+% \cls*{koma-script-source-doc}}
+% \changes{v3.36}{2022/02/14}{whole implementation documentation in English}
+%
+% \GetFileInfo{scrkernel-pseudolengths.dtx}
+% \title{Handling of Lengths Stored in Macros for
+% \href{https://komascript.de}{\KOMAScript} Letter Class and Packages}
+% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}}
+% \date{Revision \fileversion{} of \filedate}
+% \maketitle
+% \begin{abstract}
+% \file{scrkernel-pseudolength.dtx} provides storing lengths in macros. This
+% feature has been introduced with \cls*{scrlttr2} in 2002, because at that
+% time there where only 256 skip registers for \LaTeX{} lengths and
+% \cls*{scrlttr2} needs several lengths to specify the positions of several
+% notepaper elements. Some time later The \LaTeX{} Team (at long last) has
+% decided to recommend \eTeX{} as \TeX{} engine for
+% \LaTeX.\!\footnote{Currently \pdfTeX{} with \eTeX{} extensions is the
+% recommended \TeX{} engine for \LaTeX.} \,Therefore the usage of the so
+% called \emph{pseudo lengths} in \KOMAScript{} wouldn't be necessary any
+% longer. But they exist and will be used at least for compatibility also in
+% future versions of \cls*{scrlttr2} and \pkg*{scrletter}.
+% \end{abstract}
+% \tableofcontents
+%
+% \section{User Manual}
+%
+% You can find the user documentation the commands implemented here in the
+% \KOMAScript{} manual, either the German \file{scrguide} or the English
+% \file{scrguien}.
+%
+% \MaybeStop{\PrintIndex}
+%
+% \section{Implementation of Package \pkg*{typearea} and Additional Class
+% Features}
%
-% \selectlanguage{ngerman}
-%
-% \changes{v2.95}{2006/03/22}{%
-% erste Version aus der Aufteilung von \textsf{scrclass.dtx}}
-%
-% \section{Pseudo-Längen für Briefe}
-%
-% Pseudo-Längen wurden für \textsf{scrlttr2} eingeführt, um Längenregister zu
-% sparen. Tatsächlich hat das \LaTeX-Team kurz darauf entschieden, dass
-% künftig \eTeX{} die empfohlene Maschine für \LaTeX{} sein soll, wodurch die
-% Einführung von Pseudo-Längen nachträglich überflüssig wurde. Es gibt sie nun
-% aber einmal und aus Gründen der Kompatiblität wird es sie für Briefe auch
-% weiterhin geben.
-%
-% \StopEventually{\PrintIndex\PrintChanges}
-%
-% \iffalse
+% \begin{macrocode}
%<*letter>
-% \fi
-%
-% \iffalse
-%<*option>
-% \fi
-%
-% \subsection{Option}
-% Das Prinzip der Pseudo-Längen wird nicht durch Optionen beeinflusst.
+% \end{macrocode}
+%
+% \subsection{Options}
+% The method of pseudo lengths is not influenced by options.
%
%
-% \iffalse
-%</option>
-%<*body>
-% \fi
+% \subsection{Commands and macros for pseudo lengths}
%
-% \subsection{Anweisungen für Pseudo-Längen}
+% For the calculation of the positions of several elements of the notepaper
+% several lengths are needed. To not use a lot \LaTeX{} lengths (and therefore
+% \TeX{} skip registers) they are stored in macros. So we also need some
+% additional commands to not only store lengths values in macros but also for
+% arithmetic operations on such macros and even to test, if a pseudo lengths
+% exists or not.
%
-% Zu Berechnung der Feldpositionen werden verschiedene Dimensions-Variablen
-% benötigt. Um jedoch nicht unnötig viele Längenregister zu verbrauchen, wird
-% hier mit einer Pseudo-Längen-Arithmetik gearbeitet.
%
-% \selectlanguage{english}%^^A
-% \begin{macro}{\Ifplength}
-% \changes{v3.27}{2019/03/29}{new}%^^A
+% \begin{command}{\Ifplength}
+% \changes{v3.27}{2019/03/29}{added}
% \begin{macro}{\if@plength}
-% \changes{v3.27}{2019/03/29}{new (internal)}%^^A
+% \changes{v3.27}{2019/03/29}{added}
+% \changes{v3.36}{2022/02/14}{deprecated}
% Test whether or not a given pseudo-length (\texttt{\#1}) already exists. If
-% so execute the second argument, otherwise the third. It's somehow
-% inconsistent to use \cs{Ifplength} instead of \cs{ifplength}, but as it does
-% not act as a \TeX{} switch but a \LaTeX{} command it is better not to use
-% \cs{if\dots}.
+% so execute argument \texttt{\#2}, otherwise \texttt{\#3}.
% \begin{macrocode}
-\newcommand*{\if@plength}[1]{%
+%<*body>
+\newcommand*{\Ifplength}[1]{%
\@ifundefined{ltr@len@#1}{\@secondoftwo}{\@firstoftwo}%
}
-\newcommand*{\Ifplength}{\if@plength}
+\newcommand*{\if@plength}{%
+%<class> \ClassWarning{\KOMAClassName}{%
+%<package> \PackageWarning{scrletter}{%
+ Internal macro `\string\if@plength' is deprecated.\MessageBreak
+ Please use `\string\Ifplength' instead}%
+ \Ifplength
+}
% \end{macrocode}
-% \end{macro}%^^A\Ifplength
-% \end{macro}%^^A\if@plength
-% \selectlanguage{ngerman}%^^A
+% \end{macro}^^A \if@plength
+% \end{command}^^A \Ifplength
+%
%
+% \begin{command}{\newplength}
+% \changes{v2.8q}{2001/10/06}{added}
+% \changes{v2.8q}{2001/10/06}{retired compatibility to
+% \cls[https://www.ctan.org/pkg/koma-script-obsolete]{scrlettr}}
+% \changes{v3.26}{2018/04/26}{user command instead of internal macro}
+% \changes{v3.27}{2019/03/29}{changed error message}
% \begin{macro}{\@newplength}
-% \changes{v2.8q}{2001/10/06}{Neu}%^^A
-% \changes{v2.8q}{2001/10/06}{Kompatibilität zu \texttt{scrlettr.cls}%^^A
-% aufgegeben}
-% \changes{v3.27}{2019/03/29}{Fehlermeldung angepasst}%^^A
-% Dieses Makro definiert eine neue Pseude-Länge und setzt sie auf den
-% Wert 0. Eine Pseudo-Länge ist ein Makro, das eine Länge enthält.
+% \changes{v3.36}{2022/02/14}{deprecated}
+% Define a new pseudo length (\texttt{\#1}) and initialize it with 0.
% \begin{macrocode}
-\newcommand*{\@newplength}[1]{%
+\newcommand*{\newplength}[1]{%
\@ifundefined{ltr@len@#1}{%
\expandafter\let\csname ltr@len@#1\endcsname=\z@%
}{%
@@ -169,63 +144,64 @@
}{%
pseudo-length \expandafter\string\csname ltr@len@#1\endcsname
already defined%
- }{%
+ }{%
You've tried to define a new pseudo-length using\MessageBreak
\string\@newplength\space
or \string\newplength.\MessageBreak
- Please, try another name}%
+ Please, try another name%
}%
- }
+ }%
+}
+\newcommand*{\@newplength}{%
+%<class> \ClassWarning{\KOMAClassName}{%
+%<package> \PackageWarning{scrletter}{%
+ Internal macro `\string\@newplength' is deprecated.\MessageBreak
+ Please use `\string\newplength' instead}%
+ \newplength
+}
% \end{macrocode}
% \end{macro}
+% \end{command}
%
-% \begin{macro}{\newplength}
-% \changes{v3.26}{2018/04/26}{Neu}
-% Anweisung auf Anwenderebene verfügbar.
-% \begin{macrocode}
-\newcommand*{\newplength}{\@newplength}
-% \end{macrocode}
-% \end{macro}
%
-% \begin{macro}{\useplength}
-% \changes{v2.8q}{2001/10/06}{Neu}%^^A
-% \changes{v2.97c}{2007/09/17}{\cs{dimexpr} statt \cs{number} verwendet,
-% wenn \eTeX{} verwendet wird}
-% \changes{v3.25}{2017/11/29}{\eTeX{} ist zwingend}
-% \changes{v3.25}{2017/11/29}{\cs{dimexpr} durch \cs{glueexpr} ersetzt}%^^A
-% Natürlich muss auf eine solche Pseudo-Länge auch wieder lesend
-% zugeriffen werden können. Wir definieren dies hier so, dass es
-% außerdem möglich ist, ein Vorzeichen oder einen Faktor zu verwenden. Dafür
-% wird allerdings \eTeX{} benötigt.
+% \begin{command}{\useplength}
+% \changes{v2.8q}{2001/10/06}{added}
+% \changes{v2.97c}{2007/09/17}{with \eTeX{} using \cs{dimexpr} instead of \cs{number}}
+% \changes{v3.25}{2017/11/29}{\eTeX{} is mandatory}
+% \changes{v3.25}{2017/11/29}{\cs{dimexpr} replaced by \cs{glueexpr}}
+% Read the value of a pseudo length like a skip register. This can be done
+% using \cs{glueexpr}.
% \begin{macrocode}
\newcommand*{\useplength}[1]{%
\glueexpr \csname ltr@len@#1\endcsname\relax}%
% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\setlengthtoplength}
-% \changes{v2.8q}{2001/10/06}{Neu}%^^A
-% Eine echte Länge soll auf das Vielfache einer Pseudo-Länge gesetzt
-% werden. Dabei wird der Faktor als optionaler Parameter übergeben.
-% Der erste obligatorische Parameter ist die Länge, der zweite
-% obligatorische Parameter ist die Pseudo-Länge.
+% \end{command}
+%
+% \begin{command}{\setlengthtoplength}
+% \changes{v2.8q}{2001/10/06}{added}
+% Set a real \LaTeX{} length (usually a \TeX{} skip, but \TeX{} dimensions are
+% also valid) to a multiple of a pseudo length. The factor is given by the
+% optional argument \texttt{\#1}. The length is mandatory argument \textrm{\#2}
+% and the name of the pseudo length the also mandatory \texttt{\#3}.
% \begin{macrocode}
\newcommand*{\setlengthtoplength}[3][]{%
\setlength{#2}{\useplength{#3}}%
\setlength{#2}{#1#2}}
% \end{macrocode}
-% \end{macro}
+% \end{command}
%
+% \begin{command}{\setplength}
+% \changes{v2.8q}{2001/10/06}{added}
+% \changes{v3.25}{2017/11/29}{\cs{glueexpr} eingefügt}
+% \changes{v3.36}{2018/04/26}{user command instead of internal macro}
% \begin{macro}{\@setplength}
-% \changes{v2.8q}{2001/10/06}{Neu}%^^A
-% \changes{v3.25}{2017/11/29}{\cs{glueexpr} eingefügt}%^^A
-% Natürlich wird ebenfalls eine Möglichkeit benötigt, einer
-% Pseudo-Länge einen Wert zuzuweisen. Dies geschieht unter lokaler
-% Anwendung einer Länge, damit sichergestellt ist, dass eine
-% Längenangabe übergeben wird. Dabei wird das zuvor definierte Makro
-% \cs{setlengthtoplength} verwendet.
+% \changes{v3.36}{2022/02/14}{deprecated}
+% We also need a command to set a pseudo length (\texttt{\#2}) to a new value
+% (\texttt{\#3}). Locally we use a length to do so, because we want error
+% messages about illegal values here and not when using the pseudo value. Once
+% more an optional factor (\texttt{\#1}) is provided (but does not make much sense).
% \begin{macrocode}
-\newcommand*{\@setplength}[3][]{%
+\newcommand*{\setplength}[3][]{%
\begingroup%
\setlength{\@tempskipa}{\glueexpr #3\relax}%
\setlength{\@tempskipa}{#1\@tempskipa}%
@@ -235,27 +211,24 @@
}%
\@tempa
}
+\newcommand*{\@setplength}{%
+%<class> \ClassWarning{\KOMAClassName}{%
+%<package> \PackageWarning{scrletter}{%
+ Internal macro `\string\@setplength' is deprecated.\MessageBreak
+ Please use `\string\setplength' instead}%
+ \setplength
+}
% \end{macrocode}
% \end{macro}
+% \end{command}
%
-% \begin{macro}{\setplength}
-% \changes{v3.26}{2018/04/26}{Neu}%^^A
-% Anweisung auf Anwenderebene verfügbar.
-% \begin{macrocode}
-\newcommand*{\setplength}{\@setplength}
-% \end{macrocode}
-% \end{macro}
%
-% \begin{macro}{\setplengthtowidth}
-% \changes{v3.26}{2018/04/26}{Neu}
-% \begin{macro}{\setplengthtoheight}
-% \changes{v3.26}{2018/04/26}{Neu}
-% \begin{macro}{\setplengthtodepth}
-% \changes{v3.26}{2018/04/26}{Neu}
-% \begin{macro}{\setplengthtototalheight}
-% \changes{v3.26}{2018/04/26}{Neu}
-% Man kann auch die Breite, Höhe, Tiefe oder Höhe + Tiefe eines Inhalts
-% verwenden, um eine Pseudolänge zu definieren.
+% \begin{command}{\setplengthtowidth,\setplengthtoheight,\setplengthtodepth,
+% \setplengthtototalheight}
+% \changes{v3.26}{2018/04/26}{added}
+% First three commands are similar to \cs{settowidth}, \cs{settoheight} and
+% \cs{settodepth} but with pseudo length instead of a \LaTeX{} length. The
+% last one is a combination of \cs{setplengthtoheight} + \cs{setplengthtodepth}.
% \begin{macrocode}
\newcommand*{\setplengthtowidth}[3][]{%
\begingroup
@@ -300,33 +273,35 @@
\@tempa
}
% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
+% \end{command}
+%
%
-% \begin{macro}{\addtolengthplength}
-% \changes{v2.8q}{2001/10/06}{Neu}%^^A
-% Wenn wir schon dabei sind, soll statt dem Setzen auch das Addieren
-% funktionieren. Hier ist die Erschwernis, dass der Faktor nur für
-% die Pseudo-Länge und nicht für das Endergebnis gelten soll.
+% \begin{command}{\addtolengthplength}
+% \changes{v2.8q}{2001/10/06}{added}
+% This provides a plus operation of a pseudo length \texttt{\#3} to a \LaTeX{}
+% length \texttt{\#2}. Again an optional factor \texttt{\#1} is possible.
% \begin{macrocode}
\newcommand*{\addtolengthplength}[3][]{%
\begingroup%
\setlengthtoplength[{#1}]{\@tempskipa}{#3}%
\edef\@tempa{\endgroup%
\noexpand\addtolength{#2}{\the\@tempskipa}}%
- \@tempa%
- }
+ \@tempa%
+}
% \end{macrocode}
+% \end{command}
+%
%
+% \begin{command}{\addtoplength}
+% \changes{v2.8q}{2001/10/06}{added}
+% \changes{v3.25}{2017/11/29}{using \cs{glueexpr}}
+% \changes{v3.36}{2018/04/26}{user command instead of internal macro}
% \begin{macro}{\@addtoplength}
-% \changes{v2.8q}{2001/10/06}{Neu}%^^A
-% \changes{v3.25}{2017/11/29}{\cs{glueexpr} eingefügt}%^^A
-% Ebenso wird ein Makro benötigt, mit dem zu einer Pseudo-Länge das
-% Vielfache eines Wertes addiert werden kann.
+% \changes{v3.36}{2022/02/14}{deprecated}
+% This provides a plus operation for one pseudo length \texttt{\#3} to another
+% pseudo length \texttt{\#2}. Again an optional factor \texttt{\#1} is possible.
% \begin{macrocode}
-\newcommand*{\@addtoplength}[3][]{%
+\newcommand*{\addtoplength}[3][]{%
\begingroup%
\setlength{\@tempskipa}{\glueexpr #3\relax}%
\setlength{\@tempskipa}{#1\@tempskipa}%
@@ -335,34 +310,33 @@
\noexpand\expandafter\noexpand\renewcommand\noexpand\expandafter*%
\noexpand\csname ltr@len@#2\noexpand\endcsname{\the\@tempskipa}%
}%
- \@tempa%
- }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\addtoplength}
-% \changes{v3.26}{2018/04/26}{Neu}
-% Anweisung auf Anwenderebene verfügbar.
-% \begin{macrocode}
-\newcommand*{\addtoplength}{\@addtoplength}
+ \@tempa%
+}
+\newcommand*{\@addtoplength}{%
+%<class> \ClassWarning{\KOMAClassName}{%
+%<package> \PackageWarning{scrletter}{%
+ Internal macro `\string\@addtoplength' is deprecated.\MessageBreak
+ Please use `\string\addtoplength' instead}%
+ \addtoplength}
+%</body>
% \end{macrocode}
% \end{macro}
+% \end{command}
%
-% \iffalse
-%</body>
-% \fi
%
-% \iffalse
+% \begin{macrocode}
%</letter>
-% \fi
-%
+% \end{macrocode}
+%
% \Finale
-%
+% \PrintChanges
+%
\endinput
-%
-% end of file `scrkernel-pseudolengths.dtx'
-%%% Local Variables:
-%%% mode: doctex
-%%% TeX-master: t
-%%% End:
+% Local Variables:
+% mode: doctex
+% ispell-local-dictionary: "en_US"
+% eval: (flyspell-mode 1)
+% TeX-master: t
+% TeX-engine: luatex-dev
+% eval: (setcar (or (cl-member "Index" (setq-local TeX-command-list (copy-alist TeX-command-list)) :key #'car :test #'string-equal) (setq-local TeX-command-list (cons nil TeX-command-list))) '("Index" "mkindex %s" TeX-run-index nil t :help "makeindex for dtx"))
+% End: