Debian Codegraph @

texmf-dist/doc/latex/ltabptch/ltabptch.tex

raw
1 \documentclass[DIV=9, parskip=half, pagesize=auto]{scrartcl}
2
3 \usepackage{fixltx2e}
4 \usepackage{etex}
5 \usepackage{xspace}
6 \usepackage{lmodern}
7 \usepackage[T1]{fontenc}
8 \usepackage{textcomp}
9 \usepackage[utf8]{inputenc}
10 \usepackage{array}
11 \usepackage{microtype}
12 \usepackage{hyperref}
13
14 \newcommand*{\pkg}[1]{\textsf{#1}}
15 \newcommand*{\cs}[1]{\texttt{\textbackslash#1}}
16 \makeatletter
17 \newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}}
18 \makeatother
19 \newcommand*{\env}[1]{\texttt{#1}}
20 \newcommand*{\meta}[1]{\textlangle\textsl{#1}\textrangle}
21
22 \addtokomafont{title}{\rmfamily}
23
24 \title{The \pkg{ltabptch} package\thanks{This manual corresponds to \pkg{ltabptch}~v1.74d, dated~2005/01/10.}}
25 \subtitle{patch for \pkg{Longtable}}
26 \author{Uwe Lück}
27 \date{2005/01/10}
28
29
30 \begin{document}
31
32 \maketitle
33
34 For David Carlisle's \pkg{Longtable.sty}, version 4.11 \\
35 Fixes \texttt{tools/3180} (Sebastian Rahtz) and \texttt{tools/3485}:
36 missing/wrong interline glues above/below table.
37
38 \begin{quote}
39 \small
40 Copyright \textcopyright\ 2002--2004 Uwe Lück,
41 \url{http://www.contact-ednotes.sty.de.vu}.
42
43 Usage, no warranty, distribution as in \texttt{lppl.txt} on CTAN
44 (\href{http://www.ctan.org/pub/tex-archive/macros/latex/base/lppl.txt}{\texttt{macros\slash latex\slash base\slash lppl.txt}}).
45 \end{quote}
46
47
48 \minisec{The problem(s):}
49
50 \renewcommand*{\labelenumi}{(\theenumi)}
51
52 Sebastian Rahtz (\texttt{tools/3180}) observed 2000/03/05 that there be
53 a ``spurios blank line'' below the \env{longtable}. This impression
54 may have been due to two spacing problems:
55 %
56 \begin{enumerate}
57 \item There is \cmd{\parskip} and some interline glue below \env{longtable},
58 while there is no \cmd{\parskip} and no interline glue above
59 (without head as specified by \cmd{\endhead} or \cmd{\firstendhead})
60 or just \cmd{\lineskip} 0.0\,pt (with head---\cmd{\endhead}, \cmd{\endfirsthead}).
61 \item After \env{longtable}, \cmd{\prevdepth} is the depth of the last line
62 before the \env{longtable} (if there is no head) or the depth of the
63 head (otherwise). So \cmd{\prevdepth} may be 0\,pt. By contrast, the
64 last table row has depth of at least \verb+\dp\@arstrutbox+---which
65 should rather matter, and this is 3.6\,pt or more.
66 \end{enumerate}
67 %
68 ---\,I have reported something like this as \texttt{tools/3485}, not
69 entirely correctly. Details are presented below.
70
71
72 \minisec{Solution presented:}
73
74 \begin{enumerate}
75 \item I think there should be \cmd{\parskip} and usual interline glue
76 above, since the same would happen with a table in a center
77 environment (e.\,g.)\@.
78 \cmd{\noindent} seems to work fatally; moreover, \cmd{\LT@start}'s decision
79 whether to enter a new page would ignore \cmd{\parskip} and interline
80 glue still needed.
81 So emulate interline glue calculation according to \TeX book~p.~80
82 and add it by \cmd{\vskip}, along with \cmd{\parskip}.
83 (This is rather a hack---a proper correction should perhaps not
84 ``emulate'' but place the interlineglue changes of \cmd{\LT@array} inside
85 the \cmd{\vbox} \cmd{\LT@bchunk} starts and treat glue between chunks in a
86 new way.)
87 \item Set \cmd{\prevdepth} to depth of box~0 before the latter is
88 \cmd{\unvbox}'ed (which leaves \cmd{\prevdepth} untouched, \TeX book~p.~ 282)
89 in \cmd{\endlongtable}.
90 \end{enumerate}
91 %
92 I thought David Carlisle would change \pkg{Longtable} according to my
93 suggestions. By e-mail from 2003/04/07 however, he finds it
94 better not to change \pkg{Longtable}, in order not to change layouts
95 of works that have been made using \pkg{Longtable} so far
96 (e-Mail 2003/04/08).
97
98
99 \minisec{By the way:}
100
101 \renewcommand*{\labelenumi}{\theenumi.)}
102
103 \begin{enumerate}
104 \item There are two successive lines in the \pkg{Longtable} code (v4.11)
105 together saying:
106 %
107 \begin{verbatim}
108 \prevdepth\z@\global
109 \global\let\LT@setprevdepth\relax
110 \end{verbatim}
111 %
112 Isn't the first \cmd{\global} just a typo?
113 --Yes--this is David Carlisle's answer in his e-mail
114 dating from 2004/05/14.
115 \item Couldn't the one-column restriction easily be removed
116 by using \cmd{\columnwidth} instead of \cmd{\hsize}?
117 \end{enumerate}
118
119
120 \minisec{Detailed diagnosis:}
121
122 \renewcommand*{\theenumi}{(\Alph{enumi})}
123 \renewcommand*{\labelenumi}{\theenumi}
124
125 Concerning the question of ``bugs'' vs.\ ``features'', you might
126 reason what features should be aimed at.
127 %
128 \begin{enumerate}
129 \item \label{item:A} If there is \cmd{\parskip} below a \env{longtable}, there should
130 be \cmd{\parskip} above as well--shouldn't it?
131 \item \label{item:B} Interline glue above should (in general) depend on the
132 same values of \cmd{\base\-line\-skip} and \cmd{\lineskip} as below---OK?
133 \item \label{item:C} Interline glue below a \env{longtable} should depend on the
134 depth of the last row, not on the depth of the head or of the
135 last line above the \env{longtable}--OK?
136 \end{enumerate}
137 %
138 The recent versions of \pkg{longtable.sty} have not satisfied any
139 of these three demands.
140 Concerning~\ref{item:A}, \cmd{\parskip} appears below the \env{longtable}, but not
141 above.
142 Concerning~\ref{item:B}, (i)~no interline glue appears above if there
143 is no head, (ii)~otherwise, only zero interline glue appears.
144 Concerning~\ref{item:C}, the interline glue below the \env{longtable} is
145 calculated using the depth of (i)~the last line above the
146 \env{longtable} as \cmd{\prevdepth} when there is no head or of (ii)~the
147 head otherwise. (Thus I was wrong earlier when I claimed that
148 \cmd{\prevdepth} were 0\,pt after \env{longtable}. This only holds in the
149 previous case (i)~when the last line above the \env{longtable} has
150 zero depth.)
151
152 You can observe this by playing with the demonstration file
153 \texttt{ltabptch.tex} in CTAN folder \href{http://www.ctan.org/pub/tex-archive/macros/latex/contrib/ltabptch/}{\texttt{macros/latex/contrib/ltabptch}}.
154
155 Reasons: For contributing a head to the main vertical list,
156 \env{longtable} uses \cmd{\copy} or \cmd{\box}, which yields a \meta{box} according
157 to \TeX book~p.~278. Rows are contributed by \cmd{\unvbox}. Now,
158 violation of~\ref{item:A} is due to the fact that neither \cmd{\copy} or
159 \cmd{\box} of the head nor the \cmd{\unvbox} for table rows leads to
160 execution of an \cmd{\indent} or \cmd{\noindent} (\TeX book~pp.~282\,f.,\ see
161 also \meta{horizontal command}).
162 Violation of~\ref{item:B} is due either to (i)~the fact that \cmd{\unvbox}
163 is no \meta{box} (\TeX book~p.~282/278) or to (ii)~the fact that at
164 \cmd{\copy} or \cmd{\box} \cmd{\baselineskip} and \cmd{\lineskip} are 0\,pt.
165 Violation of~\ref{item:C} is due to the fact that \cmd{\unvbox} does not
166 change \cmd{\prevdepth} (\TeX book~p.~282).
167
168 As to recognizable effects:
169 %
170 \begin{itemize}
171 \item Violation of~\ref{item:A}, of course, has very little effect in
172 general since \cmd{\parskip} is \texttt{0pt plus 1pt} usually. This is hardly
173 recognizable in the presence of the \cmd{\bigskipamount} above and
174 below a \env{longtable}.
175
176 \item Violation of~\ref{item:B} results in missing appropriate interline
177 glue above, which often should be 3.6\,pt or more. This may
178 rather be recognizable and may contribute to the impression
179 that there even is a spurious blank line below the \env{longtable}
180 (this is what Sebastion Rahtz reported in \texttt{tools/3180}).
181
182 \item For the previous as well as for the details and the
183 effects of violation of~\ref{item:C}, consider the algorithm for
184 calculating interline glue on p.~80 of the \TeX book. If there
185 is no head, and the depth of the last line before the
186 \env{longtable} is 0\,pt, the interline glue below the \env{longtable} is
187 \cmd{\baselineskip} minus the height of the first line after the
188 \env{longtable}. The interline glue \emph{should be} \cmd{\baselineskip} minus
189 height of following line \emph{minus} depth of last table row--if
190 this depth is not too large (depending on \cmd{\lineskiplimit}).
191 This depth is at least 3.6\,pt. So the interline glue is often
192 by 3.6\,pt or more greater than is appropriate. Considering the
193 missing interline glue above the \env{longtable} and the \cmd{\parskip}
194 below, the glue after the \env{longtable} is by 6.2\,pt (or more) plus
195 1\,pt larger than the glue before. Due to the shrink component
196 of the surrounding \cmd{\bigskipamount}, the glue following the
197 \env{longtable} may be nearly twice as large as the glue before.
198 ---\,Usually, violation of~\ref{item:C} has no effect at all. Namely,
199 there is a head usually, and its depth is usually the same as
200 the depth of the last row, namely \verb+\dp\@arstrutbox+.
201 \end{itemize}
202
203
204 \minisec{Version history:}
205
206 \begin{tabular}{@{}lr>{\raggedright\arraybackslash}p{93mm}@{}}
207 v1.7 & 2003/01/07 & Sent around 2003/01/13 with first release of \pkg{ednotes.sty}. Sent to David Carlisle. Earlier versions were sent to Frank Mittelbach and the team. \\
208 v1.71 & 2003/01/22 & Added version history. \\
209 v1.72 & 2003/01/27 & Changed copyright notice. \\
210 v1.73 & 2004/05/13 & Adapted to \pkg{Longtable}~v4.11; new copyright; \pkg{longtable} $\to$ \pkg{Longtable} (selectively). Added `I have \ldots \texttt{3485}'. \\
211 v1.74 & 2004/08/05 & Added `---Yes---\ldots'. \\
212 & 2004/08/21 & Typo fix for `problem'; added report on 2003/04/08. \\
213 & 2004/08/23 & Corrected and extended diagnosis, sent to CTAN. \\
214 v1.74b & \ldots/08/23 & `---' $\to$ `--'; added that~\ref{item:C} usually doesn't matter. \\
215 v1.74c & \ldots/08/31 & `author-maintained'. \\
216 v1.74d & 2005/01/10 & Contact via \textsc{http}.
217 \end{tabular}
218
219 \end{document}