You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
368 lines
12 KiB
368 lines
12 KiB
% \CheckSum{223}
|
|
% \iffalse meta-comment
|
|
% ======================================================================
|
|
% scrkernel-pseudolengths.dtx
|
|
% Copyright (c) Markus Kohm, 2006-2019
|
|
%
|
|
% This file is part of the LaTeX2e KOMA-Script bundle.
|
|
%
|
|
% This work may be distributed and/or modified under the conditions of
|
|
% the LaTeX Project Public License, version 1.3c of the license.
|
|
% The latest version of this license is in
|
|
% http://www.latex-project.org/lppl.txt
|
|
% and version 1.3c or later is part of all distributions of LaTeX
|
|
% version 2005/12/01 or later and of this work.
|
|
%
|
|
% This work has the LPPL maintenance status "author-maintained".
|
|
%
|
|
% 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 $
|
|
%<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) $
|
|
\def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
|
|
\filerevision$Revision: 1872 $
|
|
\edef\reserved@a{%
|
|
\noexpand\endgroup
|
|
\noexpand\ProvidesFile{scrkernel-pseudolengths.dtx}%
|
|
[\filedate\space\filerevision\space
|
|
KOMA-Script source
|
|
(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}
|
|
|
|
\begin{document}
|
|
\maketitle
|
|
\tableofcontents
|
|
\DocInput{\filename}
|
|
\end{document}
|
|
%</dtx>
|
|
% \fi
|
|
%
|
|
% \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
|
|
%<*letter>
|
|
% \fi
|
|
%
|
|
% \iffalse
|
|
%<*option>
|
|
% \fi
|
|
%
|
|
% \subsection{Option}
|
|
% Das Prinzip der Pseudo-Längen wird nicht durch Optionen beeinflusst.
|
|
%
|
|
%
|
|
% \iffalse
|
|
%</option>
|
|
%<*body>
|
|
% \fi
|
|
%
|
|
% \subsection{Anweisungen für Pseudo-Längen}
|
|
%
|
|
% 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{macro}{\if@plength}
|
|
% \changes{v3.27}{2019/03/29}{new (internal)}%^^A
|
|
% 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}.
|
|
% \begin{macrocode}
|
|
\newcommand*{\if@plength}[1]{%
|
|
\@ifundefined{ltr@len@#1}{\@secondoftwo}{\@firstoftwo}%
|
|
}
|
|
\newcommand*{\Ifplength}{\if@plength}
|
|
% \end{macrocode}
|
|
% \end{macro}%^^A\Ifplength
|
|
% \end{macro}%^^A\if@plength
|
|
% \selectlanguage{ngerman}%^^A
|
|
%
|
|
% \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.
|
|
% \begin{macrocode}
|
|
\newcommand*{\@newplength}[1]{%
|
|
\@ifundefined{ltr@len@#1}{%
|
|
\expandafter\let\csname ltr@len@#1\endcsname=\z@%
|
|
}{%
|
|
%<class> \ClassError{scrlttr2%
|
|
%<package> \PackageError{scrletter%
|
|
}{%
|
|
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}%
|
|
}%
|
|
}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \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{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.
|
|
% \begin{macrocode}
|
|
\newcommand*{\setlengthtoplength}[3][]{%
|
|
\setlength{#2}{\useplength{#3}}%
|
|
\setlength{#2}{#1#2}}
|
|
% \end{macrocode}
|
|
% \end{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.
|
|
% \begin{macrocode}
|
|
\newcommand*{\@setplength}[3][]{%
|
|
\begingroup%
|
|
\setlength{\@tempskipa}{\glueexpr #3\relax}%
|
|
\setlength{\@tempskipa}{#1\@tempskipa}%
|
|
\edef\@tempa{\noexpand\endgroup%
|
|
\noexpand\expandafter\noexpand\renewcommand\noexpand\expandafter*%
|
|
\noexpand\csname ltr@len@#2\noexpand\endcsname{\the\@tempskipa}%
|
|
}%
|
|
\@tempa
|
|
}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \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{macrocode}
|
|
\newcommand*{\setplengthtowidth}[3][]{%
|
|
\begingroup
|
|
\settowidth{\@tempdima}{#3}%
|
|
\setlength{\@tempdima}{#1\@tempdima}%
|
|
\edef\@tempa{\noexpand\endgroup
|
|
\noexpand\expandafter\noexpand\renewcommand\noexpand\expandafter*%
|
|
\noexpand\csname ltr@len@#2\noexpand\endcsname{\the\@tempdima}%
|
|
}%
|
|
\@tempa
|
|
}
|
|
\newcommand*{\setplengthtoheight}[3][]{%
|
|
\begingroup
|
|
\settoheight{\@tempdima}{#3}%
|
|
\setlength{\@tempdima}{#1\@tempdima}%
|
|
\edef\@tempa{\noexpand\endgroup
|
|
\noexpand\expandafter\noexpand\renewcommand\noexpand\expandafter*%
|
|
\noexpand\csname ltr@len@#2\noexpand\endcsname{\the\@tempdima}%
|
|
}%
|
|
\@tempa
|
|
}
|
|
\newcommand*{\setplengthtodepth}[3][]{%
|
|
\begingroup
|
|
\settodepth{\@tempdima}{#3}%
|
|
\setlength{\@tempdima}{#1\@tempdima}%
|
|
\edef\@tempa{\noexpand\endgroup
|
|
\noexpand\expandafter\noexpand\renewcommand\noexpand\expandafter*%
|
|
\noexpand\csname ltr@len@#2\noexpand\endcsname{\the\@tempdima}%
|
|
}%
|
|
\@tempa
|
|
}
|
|
\newcommand*{\setplengthtototalheight}[3][]{%
|
|
\begingroup
|
|
\settoheight{\@tempdima}{#3}%
|
|
\settodepth{\@tempdimb}{#3}%
|
|
\addtolength{\@tempdima}{\@tempdimb}%
|
|
\setlength{\@tempdima}{#1\@tempdima}%
|
|
\edef\@tempa{\noexpand\endgroup
|
|
\noexpand\expandafter\noexpand\renewcommand\noexpand\expandafter*%
|
|
\noexpand\csname ltr@len@#2\noexpand\endcsname{\the\@tempdima}%
|
|
}%
|
|
\@tempa
|
|
}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
% \end{macro}
|
|
% \end{macro}
|
|
% \end{macro}
|
|
%
|
|
% \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{macrocode}
|
|
\newcommand*{\addtolengthplength}[3][]{%
|
|
\begingroup%
|
|
\setlengthtoplength[{#1}]{\@tempskipa}{#3}%
|
|
\edef\@tempa{\endgroup%
|
|
\noexpand\addtolength{#2}{\the\@tempskipa}}%
|
|
\@tempa%
|
|
}
|
|
% \end{macrocode}
|
|
%
|
|
% \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.
|
|
% \begin{macrocode}
|
|
\newcommand*{\@addtoplength}[3][]{%
|
|
\begingroup%
|
|
\setlength{\@tempskipa}{\glueexpr #3\relax}%
|
|
\setlength{\@tempskipa}{#1\@tempskipa}%
|
|
\addtolengthplength{\@tempskipa}{#2}%
|
|
\edef\@tempa{\noexpand\endgroup%
|
|
\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}
|
|
% \end{macrocode}
|
|
% \end{macro}
|
|
%
|
|
% \iffalse
|
|
%</body>
|
|
% \fi
|
|
%
|
|
% \iffalse
|
|
%</letter>
|
|
% \fi
|
|
%
|
|
% \Finale
|
|
%
|
|
\endinput
|
|
%
|
|
% end of file `scrkernel-pseudolengths.dtx'
|
|
%%% Local Variables:
|
|
%%% mode: doctex
|
|
%%% TeX-master: t
|
|
%%% End:
|
|
|