Debian Codegraph @

texmf-dist/source/latex/tudscr/tudscr-twocolfix.dtx

raw
1 % \iffalse meta-comment
2 %/GitFileInfo=tudscr-twocolfix.dtx
3 %
4 % TUD-Script -- Corporate Design of Technische Universität Dresden
5 % ----------------------------------------------------------------------------
6 %
7 % Copyright (C) Falk Hanisch <[email protected]>, 2012-2022
8 %
9 % ----------------------------------------------------------------------------
10 %
11 % This work may be distributed and/or modified under the conditions of the
12 % LaTeX Project Public License, either version 1.3c of this license or
13 % any later version. The latest version of this license is in
14 % http://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of
16 % LaTeX version 2008-05-04 or later.
17 %
18 % This work has the LPPL maintenance status "maintained".
19 %
20 % The current maintainer and author of this work is Falk Hanisch.
21 %
22 % ----------------------------------------------------------------------------
23 %
24 % \fi
25 %
26 % \iffalse ins:batch + dtx:driver
27 %<*ins>
28 \ifx\documentclass\undefined
29 \input docstrip.tex
30 \ifToplevel{\batchinput{tudscr.ins}}
31 \else
32 \let\endbatchfile\relax
33 \fi
34 \endbatchfile
35 %</ins>
36 %<*dtx>
37 \ProvidesFile{tudscr-twocolfix.dtx}[2022/08/09]
38 \RequirePackage{tudscr-gitinfo}
39 \documentclass[english,ngerman,xindy]{tudscrdoc}
40 \iftutex
41 \usepackage{fontspec}
42 \else
43 \usepackage[T1]{fontenc}
44 \usepackage[ngerman=ngerman-x-latest]{hyphsubst}
45 \fi
46 \usepackage{babel}
47 \usepackage{tudscrfonts}
48 \usepackage[babel]{microtype}
49
50 \GitHubBase{\TUDScriptRepository}
51 \begin{document}
52 \author{Falk Hanisch\TUDScriptContactTitle}
53 \maketitle
54 \tableofcontents
55 \DocInput{\filename}
56 \end{document}
57 %</dtx>
58 % \fi
59 %
60 % \selectlanguage{ngerman}
61 %
62 % \changes{v2.05}{2016/04/25}{Überprüfen der Definition von \cs{@topnewpage}
63 % des \LaTeXe"~Kernels}^^A
64 %
65 % \ToDo{Als eingenständiges Paket herauslösen}[v2.08]
66 % \ToDo{CheckCommand verwenden?}[v2.08]
67 %
68 %
69 %
70 % \section{Das Paket \pkg{twocolfix} -- Bugfix für den zweispaltigen Satz}
71 %
72 % Der \LaTeXe"~Kernel enthält einen
73 % \href{http://latex-project.org/cgi-bin/ltxbugs2html?pr=latex/3126}{Fehler},
74 % wodurch im zweispaltigen Satz Kapitelüberschriften höher als im
75 % einspaltigen Layout gesetzt werden. Zwar ist dieser schon länger bekannt,
76 % jedoch bisher noch nicht behoben (\GitHubRepo(latex3/latex2e)<509>).
77 %
78 % Das Paket \pkg{twocolfix} soll dies beheben. Eine Integration des Bugfixes
79 % in \KOMAScript{} wurde bereits bei Markus Kohm angefragt, jedoch
80 % \href{http://www.komascript.de/node/1681}{von ihm nicht weiter verfolgt}.
81 %
82 % \begin{macrocode}
83 %<*package>
84 \NeedsTeXFormat{LaTeX2e}
85 \ProvidesPackage{twocolfix}[%
86 %!TUD@Version
87 package (twocolumn layout bugfix)%
88 ]
89 %</package>
90 % \end{macrocode}
91 %
92 % \iffalse
93 %<*package>
94 % \fi
95 %
96 % Es wird der fehlerhafte Befehl aus dem \LaTeXe"~Kernel neu definiert.
97 % Allerdings definieren die \KOMAScript-Klassen das Makro \cs{@topnewpage}
98 % um und sichern vorher das Original in \cs{scr@topnewpage}. Daher wird der
99 % neue Befehl erst temporär definiert.
100 % \begin{macrocode}
101 \long\def \@tempa [#1]{%
102 \@nodocument%
103 \@next\@currbox\@freelist{}{}%
104 \global \setbox\@currbox%
105 \vbox {%
106 \break%
107 \prevdepth\z@%
108 \begingroup%
109 \normalcolor%
110 \hsize\textwidth%
111 % \end{macrocode}
112 % Damit der Inhalt des optionale Argumentes mit den gleichen Absatzeinstellungen
113 % gesetzt wird, werden diese nach \cs{@parboxrestore} für \KOMAScript-Klassen
114 % wiederhergestellt.
115 % \begin{macrocode}
116 \@parboxrestore%
117 \ifcsname KOMAClassName\endcsname%
118 \KOMAoptionOf[\KOMAoption{parskip}]{\KOMAClassFileName}{parskip}%
119 \fi%
120 \col@number \@ne%
121 \ignorespaces #1\par%
122 \ifdim\parskip>\z@\null\fi%
123 \vskip -\dbltextfloatsep%
124 \endgroup%
125 \ifdim\parskip>\z@\vskip\parskip\else\null\fi%
126 \vskip -\topskip%
127 }%
128 \begingroup%
129 \splitmaxdepth\maxdepth \splittopskip\topskip%
130 \setbox\@tempboxa \vsplit\@currbox to\z@%
131 \endgroup%
132 \ifdim \ht\@currbox>\textheight%
133 \ht\@currbox \textheight%
134 \fi%
135 \global \count\@currbox \tw@%
136 \@tempdima -\ht\@currbox%
137 \advance \@tempdima -\dbltextfloatsep%
138 \global \advance \@colht \@tempdima%
139 \ifx \@dbltoplist \@empty%
140 \else%
141 \@latexerr{Float(s) lost}\@ehb%
142 \let \@dbltoplist \@empty%
143 \fi%
144 \@cons \@dbltoplist \@currbox%
145 \global \@dbltopnum \m@ne%
146 \ifdim \@colht<2.5\baselineskip%
147 \@latex@warning@no@line {Optional argument of \noexpand\twocolumn
148 too tall on page \thepage}%
149 \@emptycol%
150 \if@firstcolumn%
151 \else%
152 \@emptycol%
153 \fi%
154 \else%
155 \global \vsize \@colht%
156 \global \@colroom \@colht%
157 \@floatplacement%
158 \fi%
159 }
160 % \end{macrocode}
161 % Um eine Änderung am \LaTeXe-Kernel feststellen zu können, wird auf die zum
162 % Zeitpunkt des Paketes aktuelle Definition von \cs{@topnewpage} geprüft.
163 % \begin{macrocode}
164 \long\def\@tempb[#1]{%
165 \@nodocument
166 \@next\@currbox\@freelist{}{}%
167 \global \setbox\@currbox
168 \color@vbox
169 \normalcolor
170 \vbox {%
171 \hsize\textwidth
172 \@parboxrestore
173 \col@number \@ne
174 #1%
175 \vskip -\dbltextfloatsep
176 }%
177 \color@endbox
178 \ifdim \ht\@currbox>\textheight
179 \ht\@currbox \textheight
180 \fi
181 \global \count\@currbox \tw@
182 \@tempdima -\ht\@currbox
183 \advance \@tempdima -\dbltextfloatsep
184 \global \advance \@colht \@tempdima
185 \ifx \@dbltoplist \@empty
186 \else
187 \@latexerr{Float(s) lost}\@ehb
188 \let \@dbltoplist \@empty
189 \fi
190 \@cons \@dbltoplist \@currbox
191 \global \@dbltopnum \m@ne
192 \ifdim \@colht<2.5\baselineskip
193 \@latex@warning@no@line {Optional argument of \noexpand\twocolumn
194 too tall on page \thepage}%
195 \@emptycol
196 \if@firstcolumn
197 \else
198 \@emptycol
199 \fi
200 \else
201 \global \vsize \@colht
202 \global \@colroom \@colht
203 \@floatplacement
204 \fi
205 }
206 % \end{macrocode}
207 % \begin{macro}{\@topnewpage}
208 % \begin{macro}{\scr@topnewpage}
209 % Nachdem der neue Befehl sowie die Definition aus dem \LaTeXe-Kernel zuerst
210 % temporär definiert wurden, wird nun abhängig von der aktiven Klasse der
211 % notwendige Befehl mit der neuen Definition überschrieben.
212 % \begin{macrocode}
213 \ifx\scr@topnewpage\@undefined
214 \@check@eq\@topnewpage\@tempb%
215 \let\@topnewpage\@tempa%
216 \else
217 \@check@eq\scr@topnewpage\@tempb%
218 \let\scr@topnewpage\@tempa%
219 \fi
220 % \end{macrocode}
221 % \end{macro}^^A \scr@topnewpage
222 % \end{macro}^^A \@topnewpage
223 %
224 % \iffalse
225 %</package>
226 % \fi
227 %
228 % \PrintBackMatter
229 %
230 \endinput