Debian Codegraph @

texmf-dist/source/latex/tabularht/tabularht.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: tabularht.dtx
4 % Version: 2026-05-13 v2.8
5 % Info: Tabular with height specified
6 %
7 % Copyright (C)
8 % 2005-2007 Heiko Oberdiek
9 % 2016-2026 Oberdiek Package Support Group
10 % https://github.com/ho-tex/tabularht/issues
11 %
12 % This work may be distributed and/or modified under the
13 % conditions of the LaTeX Project Public License, either
14 % version 1.3c of this license or (at your option) any later
15 % version. This version of this license is in
16 % https://www.latex-project.org/lppl/lppl-1-3c.txt
17 % and the latest version of this license is in
18 % https://www.latex-project.org/lppl.txt
19 % and version 1.3 or later is part of all distributions of
20 % LaTeX version 2005/12/01 or later.
21 %
22 % This work has the LPPL maintenance status "maintained".
23 %
24 % The Current Maintainers of this work are
25 % Heiko Oberdiek and the Oberdiek Package Support Group
26 % https://github.com/ho-tex/tabularht/issues
27 %
28 % This work consists of the main source file tabularht.dtx
29 % and the derived files
30 % tabularht.sty, tabularht.pdf, tabularht.ins, tabularht.drv,
31 % tabularht-example1.tex, tabularht-example2.tex.
32 %
33 % Distribution:
34 % CTAN:macros/latex/contrib/tabularht/tabularht.dtx
35 % CTAN:macros/latex/contrib/tabularht/tabularht.pdf
36 %
37 % Unpacking:
38 % (a) If tabularht.ins is present:
39 % tex tabularht.ins
40 % (b) Without tabularht.ins:
41 % tex tabularht.dtx
42 % (c) If you insist on using LaTeX
43 % latex \let\install=y\input{tabularht.dtx}
44 % (quote the arguments according to the demands of your shell)
45 %
46 % Documentation:
47 % (a) If tabularht.drv is present:
48 % latex tabularht.drv
49 % (b) Without tabularht.drv:
50 % latex tabularht.dtx; ...
51 % The class ltxdoc loads the configuration file ltxdoc.cfg
52 % if available. Here you can specify further options, e.g.
53 % use A4 as paper format:
54 % \PassOptionsToClass{a4paper}{article}
55 %
56 % Program calls to get the documentation (example):
57 % pdflatex tabularht.dtx
58 % makeindex -s gind.ist tabularht.idx
59 % pdflatex tabularht.dtx
60 % makeindex -s gind.ist tabularht.idx
61 % pdflatex tabularht.dtx
62 %
63 % Installation:
64 % TDS:tex/latex/tabularht/tabularht.sty
65 % TDS:doc/latex/tabularht/tabularht.pdf
66 % TDS:doc/latex/tabularht/tabularht-example1.tex
67 % TDS:doc/latex/tabularht/tabularht-example2.tex
68 % TDS:source/latex/tabularht/tabularht.dtx
69 %
70 %<*ignore>
71 \begingroup
72 \catcode123=1 %
73 \catcode125=2 %
74 \def\x{LaTeX2e}%
75 \expandafter\endgroup
76 \ifcase 0\ifx\install y1\fi\expandafter
77 \ifx\csname processbatchFile\endcsname\relax\else1\fi
78 \ifx\fmtname\x\else 1\fi\relax
79 \else\csname fi\endcsname
80 %</ignore>
81 %<*install>
82 \input docstrip.tex
83 \Msg{************************************************************************}
84 \Msg{* Installation}
85 \Msg{* Package: tabularht 2026-05-13 v2.8 Tabular with height specified (HO)}
86 \Msg{************************************************************************}
87
88 \keepsilent
89 \askforoverwritefalse
90
91 \let\MetaPrefix\relax
92 \preamble
93
94 This is a generated file.
95
96 Project: tabularht
97 Version: 2026-05-13 v2.8
98
99 Copyright (C)
100 2005-2007 Heiko Oberdiek
101 2016-2026 Oberdiek Package Support Group
102
103 This work may be distributed and/or modified under the
104 conditions of the LaTeX Project Public License, either
105 version 1.3c of this license or (at your option) any later
106 version. This version of this license is in
107 https://www.latex-project.org/lppl/lppl-1-3c.txt
108 and the latest version of this license is in
109 https://www.latex-project.org/lppl.txt
110 and version 1.3 or later is part of all distributions of
111 LaTeX version 2005/12/01 or later.
112
113 This work has the LPPL maintenance status "maintained".
114
115 The Current Maintainers of this work are
116 Heiko Oberdiek and the Oberdiek Package Support Group
117 https://github.com/ho-tex/tabularht/issues
118
119
120 This work consists of the main source file tabularht.dtx
121 and the derived files
122 tabularht.sty, tabularht.pdf, tabularht.ins, tabularht.drv,
123 tabularht-example1.tex, tabularht-example2.tex.
124
125 \endpreamble
126 \let\MetaPrefix\DoubleperCent
127
128 \generate{%
129 \file{tabularht.ins}{\from{tabularht.dtx}{install}}%
130 \file{tabularht.drv}{\from{tabularht.dtx}{driver}}%
131 \usedir{tex/latex/tabularht}%
132 \file{tabularht.sty}{\from{tabularht.dtx}{package}}%
133 \usedir{doc/latex/tabularht}%
134 \file{tabularht-example1.tex}{\from{tabularht.dtx}{example1}}%
135 \file{tabularht-example2.tex}{\from{tabularht.dtx}{example2}}%
136 }
137
138 \catcode32=13\relax% active space
139 \let =\space%
140 \Msg{************************************************************************}
141 \Msg{*}
142 \Msg{* To finish the installation you have to move the following}
143 \Msg{* file into a directory searched by TeX:}
144 \Msg{*}
145 \Msg{* tabularht.sty}
146 \Msg{*}
147 \Msg{* To produce the documentation run the file `tabularht.drv'}
148 \Msg{* through LaTeX.}
149 \Msg{*}
150 \Msg{* Happy TeXing!}
151 \Msg{*}
152 \Msg{************************************************************************}
153
154 \endbatchfile
155 %</install>
156 %<*ignore>
157 \fi
158 %</ignore>
159 %<*driver>
160 \NeedsTeXFormat{LaTeX2e}
161 \ProvidesFile{tabularht.drv}%
162 [2026-05-13 v2.8 Tabular with height specified (HO)]%
163 \documentclass{ltxdoc}
164 \usepackage{holtxdoc}[2011/11/22]
165 \begin{document}
166 \DocInput{tabularht.dtx}%
167 \end{document}
168 %</driver>
169 % \fi
170 %
171 %
172 %
173 % \GetFileInfo{tabularht.drv}
174 %
175 % \title{The \xpackage{tabularht} package}
176 % \date{2026-05-13 v2.8}
177 % \author{Heiko Oberdiek\thanks
178 % {Please report any issues at \url{https://github.com/ho-tex/tabularht/issues}}}
179 %
180 % \maketitle
181 %
182 % \begin{abstract}
183 % This package defines some environments that adds
184 % a height specification to tabular and array.
185 % \end{abstract}
186 %
187 % \tableofcontents
188 %
189 % \section{Usage}
190 %
191 % \begin{quote}
192 % |\usepackage{tabularht}|
193 % \end{quote}
194 % The package provides the following environments
195 % that extend the tabular/array environment by
196 % a height specification as first argument:
197 % \begin{itemize}
198 % \item |tabularht|, |tabularht*|
199 % \item |arrayht|
200 % \item |tabularhtx|
201 % (if package \xpackage{tabularx} is loaded)
202 % \end{itemize}
203 % The height argument allows a length specification,
204 % package \xpackage{calc} is supported if used. This means,
205 % the tabular will have the specified height.
206 % You can also use the prefixes |to=| and |spread=|.
207 % |to=| is the default, |spread=| means, the natural
208 % height of the tabular box is changed by the length
209 % after |spread=|.
210 %
211 % Examples:
212 % \begin{quote}
213 % \begin{tabular}{@{}l@{ $\rightarrow$ }l@{}}
214 % |\begin{tabularht}{1in}|
215 % & height is 1in\\
216 % |\begin{tabularht}{to=1in}|
217 % & height is 1in\\
218 % |\begin{tabularht}{spread=0pt}|
219 % & natural height, same as |\begin{tabular}|\\
220 % |\begin{tabularht}{spread=1in}|
221 % & natural height increased by 1in
222 % \end{tabular}
223 % \end{quote}
224 %
225 % Hint: See also package \xpackage{tabularkv}, it provides an interface,
226 % where most parameters for the environments can be given
227 % by key-value pairs.
228 %
229 % \begin{declcs}{interrowspace}\,|{|\dots|}|
230 % \end{declcs}
231 % Adds space between table rows. It is essentially
232 % the same as |\noalign{\vspace{...}}|.
233 % \begin{declcs}{interrowfill}
234 % \end{declcs}
235 % Short for |\interrowspace{\fill}|
236 % \begin{declcs}{interrowstart}\,\dots\,\cs{interrowstop}
237 % \end{declcs}
238 % Marker commands, useful for option \xoption{vlines}.
239 %
240 % \subsection{Option \xoption{vlines}}
241 %
242 % Warning: This stuff is experimental.
243 %
244 % \vspace{2ex}
245 % \noindent
246 % Vertical lines are interrupted, if space is inserted
247 % in \cs{noalign}, \cs{interrowspace}, \cs{addlinespace}
248 % (\xpackage{booktabs}),
249 % between double \cs{hline}s. This option tries to detect
250 % and add the vertical lines. The lines in a tabular
251 % with \xpackage{tabularht} support (environments of this package)
252 % are numbered from left to right. The gap that is
253 % controlled by \cs{interrowspace} or in between \cs{interrowstart}
254 % and \cs{interrowstop} is then filled with the detected
255 % vertical lines.
256 %
257 % If only a limited selection of the lines should be
258 % drawn, the commands know an optional argument with a
259 % list of line numbers, e.g.
260 % \begin{quote}
261 %\begin{verbatim}
262 %\begin{tabularht}{50mm}{|l|l|}
263 % Hello & World\\
264 % \interrowfill[1,3]
265 % Foo & Bar
266 %\end{tabularht}
267 %\end{verbatim}
268 % \end{quote}
269 % There are three lines, but the middle line is not drawn
270 % in the gap between the first and second row.
271 % Zero can be used to suppress all lines:
272 % \begin{quote}
273 % |\interrowspace[0]{10mm}|
274 % \end{quote}
275 % The syntax of the commands with the optional argument
276 % with the line number list \meta{list}. \meta{list} is a comma
277 % separated list of numbers, \meta{height} means the
278 % height specification described above with the optional
279 % prefixes |to=| or |spread=|.
280 % \begin{quote}
281 % \cs{interrowspace}\,|[|\meta{list}|]|\,|{|\meta{height}|}|\\
282 % \cs{interrowfill}\,|[|\meta{list}|]|\\
283 % \cs{interrowstart}\,|[|\meta{list}|]|\,\dots\,\cs{interrowstop}
284 % \end{quote}
285 %
286 % Option \xoption{vlines} is driver dependent and uses \eTeX\ features.
287 % \begin{description}
288 % \item[\xoption{pdftex}:] \pdfTeX\ in PDF mode.
289 % Here the positions of the lines are written with the
290 % help of the \cs{pdfsavepos} feature into the \xfile{.aux} file(s).
291 % Therefore you need two LaTeX runs to get the lines.
292 % \item[\xoption{dvips}:]
293 % Here, PostScript's currentpoint it used to get
294 % the line positions. The lines are then drawn at the end
295 % of the page. Thus one \LaTeX/dvips run is sufficient
296 % for this option.
297 % \item[Other drivers:]\mbox{}
298 % \begin{description}
299 % \item[PostScript drivers:] probably possible, an end of page
300 % hook would be nice.
301 % \item[\VTeX:] with GeX (PostScript interpreter) probably possible.
302 % \item[dvipdfm:] no idea. The big problem is, how to get the
303 % current position?
304 % \end{description}
305 % \end{description}
306 %
307 % \subsection{Limitations}
308 %
309 % \begin{itemize}
310 % \item
311 % Vertical lines are interrupted by |\noalign{\vfill}|.
312 % \end{itemize}
313 %
314 % \subsection{Compatibility}
315 %
316 % \begin{itemize}
317 % \item
318 % \xpackage{array}, \xpackage{delarray}, \xpackage{tabularx}
319 % are supported.
320 % \item There can be problems with packages that
321 % redefine \cs{@array} (or \cs{@@array}, \cs{@tabarray}) and
322 % \cs{@arrayrule} (for option \xoption{vlines}).
323 % \item \xpackage{colortbl}: it should at least work, but there isn't
324 % support for filling the gaps with color, neither
325 % the rules nor the backgrounds.
326 % \end{itemize}
327 %
328 % \subsection{Examples}
329 %
330 % \subsubsection{Example 1}
331 %
332 % \begin{macrocode}
333 %<*example1>
334 \documentclass{article}
335 \usepackage{tabularht}
336
337 \begin{document}
338 \fbox{%
339 \begin{tabularht*}{1in}{4in}{@{}l@{\extracolsep{\fill}}r@{}}%
340 upper left corner & upper right corner\\%
341 \noalign{\vfill}%
342 \multicolumn{2}{@{}c@{}}{bounding box}\\%
343 \noalign{\vfill}%
344 lower left corner & lower right corner\\%
345 \end{tabularht*}%
346 }
347 \end{document}
348 %</example1>
349 % \end{macrocode}
350 %
351 % \subsubsection{Example 2}
352 %
353 % \begin{macrocode}
354 %<*example2>
355 \documentclass{article}
356 \usepackage{booktabs}
357 \usepackage[dvips,vlines]{tabularht}
358
359 \begin{document}
360
361 \begin{tabularht}{spread=0pt}{|l|l|}
362 \hline
363 First&Line\\%
364 \hline
365 \interrowstart
366 \addlinespace[10mm]%
367 \interrowstop
368 \hline
369 Second&Line\\%
370 \interrowstart
371 \hline
372 \hline
373 \interrowstop
374 Third&Line\\%
375 \hline
376 \interrowspace{10mm}
377 \hline
378 Fourth&Line\\%
379 \hline
380 \end{tabularht}
381
382 \end{document}
383 %</example2>
384 % \end{macrocode}
385 %
386 % \StopEventually{
387 % }
388 %
389 % \section{Implementation}
390 %
391 % \begin{macrocode}
392 %<*package>
393 % \end{macrocode}
394 % Package identification.
395 % \begin{macrocode}
396 \NeedsTeXFormat{LaTeX2e}
397 \ProvidesPackage{tabularht}%
398 [2026-05-13 v2.8 Tabular with height specified (HO)]
399 % \end{macrocode}
400 %
401 % \subsection{Environments}
402 %
403 % \begin{macrocode}
404 \let\@toarrayheight\@empty
405 \let\tabH@array@init\@empty
406
407 \toks@={%
408 \begingroup
409 \long\def\x#1\fi\fi\bgroup#2\@sharp#3#4\@nil{%
410 \endgroup
411 \gdef\@array[##1]##2{%
412 \tabH@array@init
413 #1%
414 \fi\fi
415 \@toarrayheight
416 \bgroup
417 \let\@toarrayheight\@empty
418 #2\@sharp###3#4%
419 }%
420 }%
421 \expandafter\x\@array[#1]{#2}\@nil % hash-ok
422 }
423 \edef\tabH@patch@array{\the\toks@}
424 \def\tabH@patch@@array{%
425 \ifx\@array\@@array
426 \def\reserved@a{\let\@@array\@array}%
427 \else
428 \let\reserved@a\relax
429 \fi
430 \tabH@patch@array
431 \reserved@a
432 }
433 \tabH@patch@@array
434
435 \@ifpackageloaded{array}{}{%
436 \AtBeginDocument{%
437 \@ifpackageloaded{array}{%
438 \tabH@patch@@array
439 }{}%
440 }%
441 }
442
443 \def\tabH@setheight#1{%
444 \tabH@@setheight#1==\@nil
445 }
446 \def\tabH@@setheight#1=#2=#3\@nil{%
447 \ifx\\#2#3\\%
448 \setlength{\dimen@}{#1}%
449 \edef\@toarrayheight{to\the\dimen@}%
450 \else
451 \edef\tabH@temp{\zap@space#1 \@empty}%
452 \ifx\tabH@temp\tabH@to
453 \else
454 \ifx\tabH@temp\tabH@spread
455 \else
456 \PackageError{tabularht}{%
457 Unknown height specifier %
458 `\expandafter\strip@prefix\meaning\tabH@temp'%
459 }{%
460 The height dimension for tabular height can be prefixed%
461 \MessageBreak
462 with `to=' or `spread=', default is `to='.%
463 }%
464 \let\tabH@temp\tabH@to
465 \fi
466 \fi
467 \setlength{\dimen@}{#2}%
468 \edef\@toarrayheight{\tabH@temp\the\dimen@}%
469 \fi
470 }
471 \def\tabH@to{to}
472 \def\tabH@spread{spread}
473 % \end{macrocode}
474 % First argument is the height of the table,
475 % then the original arguments for tabular follow.
476 % \begin{macrocode}
477 \newenvironment{tabularht}[1]{%
478 \tabH@setheight{#1}%
479 \tabular
480 }{%
481 \endtabular
482 }
483
484 \newenvironment{tabularht*}[1]{%
485 \tabH@setheight{#1}%
486 \@nameuse{tabular*}%
487 }{%
488 \@nameuse{endtabular*}%
489 }
490
491 \newenvironment{tabularhtx}[1]{%
492 \tabH@setheight{#1}%
493 \tabularx
494 }{%
495 \endtabularx
496 }
497
498 \newenvironment{arrayht}[1]{%
499 \tabH@setheight{#1}%
500 \array
501 }{%
502 \endarray
503 }
504
505 \def\interrowspace{%
506 \noalign\bgroup
507 \tabH@interrowspace
508 }
509 \newcommand*{\tabH@interrowspace}[2][]{%
510 \tabH@vspace{#1}{#2}%
511 \egroup
512 }
513 \def\interrowfill{%
514 \noalign\bgroup
515 \tabH@interrowfill
516 }
517 \newcommand*{\tabH@interrowfill}[1][]{%
518 \tabH@vspace{#1}{\fill}%
519 \egroup
520 }
521 \def\tabH@vspace#1#2{%
522 \tabH@vspace@start{#1}%
523 \vspace{#2}%
524 \tabH@vspace@stop
525 }
526 \let\tabH@vspace@start\@gobble
527 \let\tabH@vspace@stop\@empty
528
529 \newcommand*{\interrowstart}{%
530 \noalign\bgroup
531 \tabH@interrowstart
532 }
533 \newcommand*{\tabH@interrowstart}[1][]{%
534 \tabH@vspace@start{#1}%
535 \egroup
536 }
537 \newcommand*{\interrowstop}{%
538 \noalign{\tabH@vspace@stop}%
539 }
540 % \end{macrocode}
541 %
542 % \subsection{Options}
543 %
544 % \begin{macrocode}
545 \providecommand*{\tabH@driver}{}
546
547 \DeclareOption{vlines}{%
548 \let\tabH@temp\relax
549 }
550 \DeclareOption{pdftex}{}
551 \DeclareOption{dvips}{%
552 \def\tabH@driver{dvips}%
553 }
554 \ProcessOptions*\relax
555
556 \ifx\tabH@temp\relax
557 \else
558 \expandafter\endinput
559 \fi
560
561 \begingroup
562 \@ifundefined{eTeXversion}{%
563 \PackageError{tabularht}{%
564 Option `vlines' requires eTeX%
565 }{%
566 Use of eTeX is recommended for LaTeX, see ltnews16.%
567 }%
568 \endgroup
569 \endinput
570 }{}%
571 \endgroup
572 % \end{macrocode}
573 %
574 % \subsection{Option vlines, driver independent stuff}
575 %
576 % \begin{macrocode}
577 \begingroup
578 \let\@addtoreset\@gobbletwo
579 \newcounter{tabH@unique}%
580 \endgroup
581 \let\tabH@currenttab\@empty
582
583 \def\tabH@array@init{%
584 \ifx\@toarrayheight\@empty
585 % ignore vertical lines of nested tabular environments
586 \let\tabH@currenttab\@empty
587 \else
588 \stepcounter{tabH@unique}%
589 \edef\tabH@currenttab{\the\c@tabH@unique}%
590 \fi
591 }
592
593 \renewcommand*{\@arrayrule}{%
594 \@addtopreamble{%
595 \hskip -.5\arrayrulewidth
596 \ifx\tabH@currenttab\@empty
597 \else
598 \tabH@vrule{\tabH@currenttab}%
599 \fi
600 \begingroup
601 \expandafter\ifx\csname CT@arc@\endcsname\relax
602 \else
603 \expandafter\CT@arc@
604 \fi
605 \vline
606 \endgroup
607 \hskip -.5\arrayrulewidth
608 }%
609 }
610 \let\tabH@arrayrule\@arrayrule
611 \AtBeginDocument{%
612 \@ifpackageloaded{colortbl}{%
613 \let\@arrayrule\tabH@arrayrule
614 }{}%
615 }
616
617 \let\tabH@vrule\@gobble
618 % \end{macrocode}
619 %
620 % \subsection{Driver pdftex}
621 %
622 % \begin{macrocode}
623 \RequirePackage{iftex}[2019/11/07]
624 \ifpdf
625 \begingroup
626 \@ifundefined{pdfsavepos}{%
627 \PackageError{tabularht}{%
628 Your pdfTeX is too old%
629 }{%
630 \string\pdfsavepos\space is missing.%
631 }%
632 \endgroup
633 \csname fi\endcsname
634 \endinput
635 }{}%
636
637 \let\on@line\@empty
638 \PackageInfo{tabularht}{%
639 Using driver `pdftex' because of pdfTeX in PDF mode%
640 }%
641 \endgroup
642
643 \protected\def\tabH@vrule#1{%
644 \if@filesw
645 \pdfsavepos
646 \protected@write\@auxout{%
647 \let\tabH@lastxpos\relax
648 }{%
649 \tabH@aux@vrule{#1}{\tabH@lastxpos}%
650 }%
651 \fi
652 }%
653
654 \def\tabH@lastxpos{\the\pdflastxpos}%
655 \def\tabH@lastypos{\the\pdflastypos}%
656
657 % The .aux file contains three commands:
658 % \tabH@aux@vrule{tabular id}{x position}
659 % \tabH@aux@vstart{tabular id}{row id}{x position}{y position}
660 % \tabH@aux@vstop{y position}
661 %
662 \AtBeginDocument{%
663 % The .aux files are read the first time before
664 % \AtBeginDocument and later at \end{document}.
665 % \tabH@aux@done is a marker to distinguish
666 % between these two readings. Only in the first
667 % case we need the \tabH@aux@... commands.
668 \let\tabH@aux@done\@empty
669 \if@filesw
670 \immediate\write\@mainaux{%
671 \@percentchar\@percentchar BeginProlog: tabularht%
672 }%
673 % items in the aux file are executed,
674 % if tabularht is loaded
675 % and during the aux file read at \begin{document} only
676 \immediate\write\@mainaux{%
677 \detokenize{%
678 % the \tabH@aux@... commands are needed only if
679 % tabularht is loaded with driver pdftex.
680 \@ifundefined{tabH@aux@vrule}\@secondoftwo\@firstofone
681 {%
682 % disable commands except for the first .aux files reading
683 \@ifundefined{tabH@aux@done}\@gobble\@firstofone
684 }%
685 {%
686 \let\tabH@aux@vrule\@gobbletwo
687 \let\tabH@aux@vstart\@gobblefour
688 \let\tabH@aux@vstop\@gobble
689 }%
690 }%
691 }%
692 \immediate\write\@mainaux{%
693 \@percentchar\@percentchar EndProlog: tabularht%
694 }%
695 \fi
696 }%
697
698 % the x positions of vrules are stored in
699 % \tabH@<tabcount>list with distinct values
700 \protected\def\tabH@aux@vrule#1#2{%
701 \@ifundefined{tabH@#1list}{%
702 \expandafter\xdef\csname tabH@#1list\endcsname{%
703 \noexpand\do{#2}%
704 }%
705 }{%
706 \begingroup
707 \def\x{#2}%
708 \let\y\@undefined
709 \let\do\tabH@do@add
710 \expandafter\xdef\csname tabH@#1list\endcsname{%
711 \csname tabH@#1list\endcsname\@empty
712 \ifx\y\@undefined
713 \noexpand\do{\x}%
714 \fi
715 }%
716 \endgroup
717 }%
718 }%
719 \def\tabH@do@add#1{%
720 \ifx\y\@undefined
721 \ifnum#1<\x\space
722 \else
723 \expandafter\ifx\csname y\endcsname\relax\fi
724 \ifnum#1>\x\space
725 \noexpand\do{\x}%
726 \fi
727 \fi
728 \fi
729 \noexpand\do{#1}%
730 }%
731
732 \def\tabH@vspace@start#1{%
733 \if@filesw
734 \stepcounter{tabH@unique}%
735 \edef\tabH@currentrow{\the\c@tabH@unique}%
736 \pdfsavepos
737 \protected@write\@auxout{%
738 \let\tabH@lastxpos\relax
739 \let\tabH@lastypos\relax
740 }{%
741 \tabH@aux@vstart{\tabH@currenttab}{\tabH@currentrow}%
742 {\tabH@lastxpos}{\tabH@lastypos}%
743 }%
744 \fi
745 \begingroup
746 \edef\a{tabH@\tabH@currenttab row\tabH@currentrow}%
747 \expandafter\let\expandafter\x\csname\a x\endcsname
748 \ifx\x\relax
749 \else
750 \expandafter\let\expandafter\y\csname\a y\endcsname
751 \expandafter\let\expandafter\l
752 \csname tabH@\tabH@currenttab list\endcsname
753 \ifx\l\relax
754 \else
755 \def\f{#1}%
756 \ifx\f\@empty
757 \let\do\tabH@do@set
758 \else
759 \count@=\z@
760 \let\do\tabH@do@filter
761 \fi
762 \setbox\z@=\hbox{\l}%
763 \wd\z@=\z@
764 \dp\z@=\z@
765 \copy\z@
766 \fi
767 \fi
768 \endgroup
769 }%
770 \def\tabH@vspace@stop{%
771 \if@filesw
772 \pdfsavepos
773 \protected@write\@auxout{%
774 \let\tabH@lastypos\relax
775 }{%
776 \tabH@aux@vstop{\tabH@lastypos}%
777 }%
778 \fi
779 }%
780 \def\tabH@do@set#1{%
781 \hbox to \z@{%
782 \hskip \dimexpr #1sp - \x sp\relax
783 \vrule \@width\arrayrulewidth
784 \@depth\dimexpr \y sp\relax
785 \hss
786 }%
787 }%
788 \def\tabH@do@filter{%
789 \@tempswafalse
790 \advance\count@\@ne
791 \@for\e:=\f\do{%
792 \ifnum\e=\count@
793 \@tempswatrue
794 \fi
795 }%
796 \if@tempswa
797 \expandafter\tabH@do@set
798 \else
799 \expandafter\@gobble
800 \fi
801 }%
802
803 \protected\def\tabH@aux@vstart#1#2#3#4{%
804 \def\tabH@current@vstart{{#1}{#2}{#3}{#4}}%
805 }%
806 \protected\def\tabH@aux@vstop{%
807 \expandafter\tabH@aux@v\tabH@current@vstart
808 }%
809 \def\tabH@aux@v#1#2#3#4#5{%
810 \expandafter\gdef\csname tabH@#1row#2x\endcsname{#3}%
811 \expandafter\xdef\csname tabH@#1row#2y\endcsname{%
812 \the\numexpr #4 - #5\relax
813 }%
814 }%
815
816 \csname fi\endcsname
817 \endinput
818
819 \fi
820 % \end{macrocode}
821 %
822 % \subsection{DVI drivers}
823 %
824 % \begin{macrocode}
825 \ifx\tabH@driver\@empty
826 \PackageError{tabularht}{%
827 Missing DVI driver, option `vlines' disabled%
828 }{%
829 Supported DVI drivers: dvips.%
830 }%
831 \expandafter\endinput
832 \fi
833
834 \def\tabH@driver@dvips{%
835 \def\tabH@literalps##1{\special{ps:SDict begin ##1 end}}%
836 \def\tabH@headerps##1{\special{! ##1}}%
837 }
838
839 \@onelevel@sanitize\tabH@driver
840 \@ifundefined{tabH@driver@\tabH@driver}{%
841 \PackageError{tabularht}{%
842 Unsupported driver `\tabH@driver'%
843 }{%
844 Supported DVI drivers: dvips.%
845 }%
846 \endinput
847 }{}
848
849 \begingroup
850 \let\on@line\@empty
851 \PackageInfo{tabularht}{%
852 Using driver `\tabH@driver'%
853 }%
854 \endgroup
855 \csname tabH@driver@\tabH@driver\endcsname
856
857 \protected\def\tabH@vrule#1#2\vrule#3\arrayrulewidth{%
858 #2% \fi or empty
859 % hack to get rid of maxdrift rounding of dvips,
860 % thus simulate a large motion
861 \kern1in\relax
862 \tabH@literalps{%
863 #1 tabH.vrule %
864 Resolution neg 0 translate%
865 }%
866 \vrule#3\arrayrulewidth
867 \tabH@literalps{Resolution 0 translate}%
868 \kern-1in\relax
869 }
870
871 \def\tabH@vspace@start#1{%
872 \begingroup
873 \let\y\@empty
874 \@for\x:=#1\do{%
875 \ifx\y\@empty
876 \edef\y{\x}%
877 \else
878 \edef\y{\y\space\x}%
879 \fi
880 }%
881 \tabH@literalps{\tabH@currenttab[\y]currentpoint exch pop}%
882 \endgroup
883 }
884 \def\tabH@vspace@stop{%
885 \tabH@literalps{%
886 currentpoint exch pop %
887 \number\dimexpr\arrayrulewidth\relax\space
888 tabH.vspace%
889 }%
890 }
891
892 \tabH@headerps{%
893 userdict begin%
894 /tabH.list 10 dict def%
895 /tabH.job [] def %
896 end%
897 /tabH.vrule{%
898 10 string cvs cvn dup tabH.list exch known{%
899 tabH.list exch dup [ exch tabH.list exch get %
900 currentpoint pop round exch true exch{%
901 % tabH.list key [ ... x true i
902 % tabH.list key [ ... false i
903 exch{%
904 % ... [ ... x i
905 2 copy lt{false}{%
906 2 copy eq{pop false}{exch true}ifelse%
907 }ifelse%
908 }{false}ifelse%
909 }forall %
910 pop%
911 ]put%
912 }{%
913 tabH.list exch[currentpoint pop round]put%
914 }ifelse%
915 }bind def%
916 % <tab num> <cols array> <ytop> <ybottom> <rulewidth[sp]>
917 /tabH.vspace{%
918 userdict begin %
919 10 dict dup begin %
920 exch 65536 div Resolution mul 72.27 div %
921 % dvips uses a poor man's ceil function
922 % see dopage.c before "drawrule": (int)(... + 0.9999999)
923 0.9999999 add truncate%
924 /rulewidth exch def %
925 exch/ybottom exch def %
926 exch/ytop exch def %
927 exch/cols exch def %
928 exch/tabkey exch 10 string cvs cvn def %
929 end%
930 /tabH.job exch[exch userdict/tabH.job get aload pop]def %
931 end%
932 }bind def %
933 % Now we do the work at the end of the page.
934 % Unhappily "eop-hook" cannot be used, because "eop"
935 % executes "restore" before, so that all data are lost.
936 TeXDict begin%
937 /eop%
938 [%
939 {%
940 tabH.job{%
941 begin%
942 /colarray %
943 tabH.list tabkey known{tabH.list tabkey get}{[]}ifelse %
944 def %
945 cols length 0 eq not{%
946 /colarray[%
947 cols{1 sub %
948 dup 0 lt{pop}{%
949 dup colarray length ge{pop}{%
950 colarray exch get%
951 }ifelse%
952 }ifelse%
953 }forall%
954 ]def%
955 }if %
956 colarray{%
957 % (rulewidth) == rulewidth == % debug
958 Resolution sub %
959 ytop rulewidth ytop ybottom sub v%
960 }forall %
961 end%
962 }forall%
963 % tabH.list{== ==}forall % debug
964 }bind aload pop %
965 TeXDict /eop get aload pop%
966 ]cvx def %
967 end%
968 }
969 % \end{macrocode}
970 %
971 % \begin{macrocode}
972 %</package>
973 % \end{macrocode}
974 %
975 % \section{Installation}
976 %
977 % \subsection{Download}
978 %
979 % \paragraph{Package.} This package is available on
980 % CTAN\footnote{\CTANpkg{tabularht}}:
981 % \begin{description}
982 % \item[\CTAN{macros/latex/contrib/tabularht/tabularht.dtx}] The source file.
983 % \item[\CTAN{macros/latex/contrib/tabularht/tabularht.pdf}] Documentation.
984 % \end{description}
985 %
986 %
987 % \subsection{Package installation}
988 %
989 % \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
990 % \docstrip\ archive. The files are extracted by running the
991 % \xfile{.dtx} through \plainTeX:
992 % \begin{quote}
993 % \verb|tex tabularht.dtx|
994 % \end{quote}
995 %
996 % \paragraph{TDS.} Now the different files must be moved into
997 % the different directories in your installation TDS tree
998 % (also known as \xfile{texmf} tree):
999 % \begin{quote}
1000 % \def\t{^^A
1001 % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
1002 % tabularht.sty & tex/latex/tabularht/tabularht.sty\\
1003 % tabularht.pdf & doc/latex/tabularht/tabularht.pdf\\
1004 % tabularht-example1.tex & doc/latex/tabularht/tabularht-example1.tex\\
1005 % tabularht-example2.tex & doc/latex/tabularht/tabularht-example2.tex\\
1006 % tabularht.dtx & source/latex/tabularht/tabularht.dtx\\
1007 % \end{tabular}^^A
1008 % }^^A
1009 % \sbox0{\t}^^A
1010 % \ifdim\wd0>\linewidth
1011 % \begingroup
1012 % \advance\linewidth by\leftmargin
1013 % \advance\linewidth by\rightmargin
1014 % \edef\x{\endgroup
1015 % \def\noexpand\lw{\the\linewidth}^^A
1016 % }\x
1017 % \def\lwbox{^^A
1018 % \leavevmode
1019 % \hbox to \linewidth{^^A
1020 % \kern-\leftmargin\relax
1021 % \hss
1022 % \usebox0
1023 % \hss
1024 % \kern-\rightmargin\relax
1025 % }^^A
1026 % }^^A
1027 % \ifdim\wd0>\lw
1028 % \sbox0{\small\t}^^A
1029 % \ifdim\wd0>\linewidth
1030 % \ifdim\wd0>\lw
1031 % \sbox0{\footnotesize\t}^^A
1032 % \ifdim\wd0>\linewidth
1033 % \ifdim\wd0>\lw
1034 % \sbox0{\scriptsize\t}^^A
1035 % \ifdim\wd0>\linewidth
1036 % \ifdim\wd0>\lw
1037 % \sbox0{\tiny\t}^^A
1038 % \ifdim\wd0>\linewidth
1039 % \lwbox
1040 % \else
1041 % \usebox0
1042 % \fi
1043 % \else
1044 % \lwbox
1045 % \fi
1046 % \else
1047 % \usebox0
1048 % \fi
1049 % \else
1050 % \lwbox
1051 % \fi
1052 % \else
1053 % \usebox0
1054 % \fi
1055 % \else
1056 % \lwbox
1057 % \fi
1058 % \else
1059 % \usebox0
1060 % \fi
1061 % \else
1062 % \lwbox
1063 % \fi
1064 % \else
1065 % \usebox0
1066 % \fi
1067 % \end{quote}
1068 % If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's
1069 % TDS installing feature, then some files can already be in the right
1070 % place, see the documentation of \docstrip.
1071 %
1072 % \subsection{Refresh file name databases}
1073 %
1074 % If your \TeX~distribution
1075 % (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh
1076 % these. For example, \TeX\,Live\ users run \verb|texhash| or
1077 % \verb|mktexlsr|.
1078 %
1079 % \subsection{Some details for the interested}
1080 %
1081 % \paragraph{Unpacking with \LaTeX.}
1082 % The \xfile{.dtx} chooses its action depending on the format:
1083 % \begin{description}
1084 % \item[\plainTeX:] Run \docstrip\ and extract the files.
1085 % \item[\LaTeX:] Generate the documentation.
1086 % \end{description}
1087 % If you insist on using \LaTeX\ for \docstrip\ (really,
1088 % \docstrip\ does not need \LaTeX), then inform the autodetect routine
1089 % about your intention:
1090 % \begin{quote}
1091 % \verb|latex \let\install=y\input{tabularht.dtx}|
1092 % \end{quote}
1093 % Do not forget to quote the argument according to the demands
1094 % of your shell.
1095 %
1096 % \paragraph{Generating the documentation.}
1097 % You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
1098 % the documentation. The process can be configured by the
1099 % configuration file \xfile{ltxdoc.cfg}. For instance, put this
1100 % line into this file, if you want to have A4 as paper format:
1101 % \begin{quote}
1102 % \verb|\PassOptionsToClass{a4paper}{article}|
1103 % \end{quote}
1104 % An example follows how to generate the
1105 % documentation with pdf\LaTeX:
1106 % \begin{quote}
1107 %\begin{verbatim}
1108 %pdflatex tabularht.dtx
1109 %makeindex -s gind.ist tabularht.idx
1110 %pdflatex tabularht.dtx
1111 %makeindex -s gind.ist tabularht.idx
1112 %pdflatex tabularht.dtx
1113 %\end{verbatim}
1114 % \end{quote}
1115 %
1116 % \begin{History}
1117 % \begin{Version}{2005/09/22 v1.0}
1118 % \item
1119 % First public version.
1120 % \end{Version}
1121 % \begin{Version}{2005/10/16 v2.0}
1122 % \item
1123 % Height specification allows
1124 % |to=...| or |spread=...|, default is |to=|.
1125 % \item
1126 % Option \xoption{vlines} added,
1127 % drivers \xoption{pdftex} and \xoption{dvips}.
1128 % \item
1129 % \cs{interrowspace}, \cs{interrowfil}, and
1130 % \cs{interrowstart}\dots\cs{interrowstop} added.
1131 % \end{Version}
1132 % \begin{Version}{2005/10/18 v2.1}
1133 % \item
1134 % Fix for package \xpackage{colortbl}, but the colors
1135 % of \xpackage{colortbl} remain unsupported.
1136 % \end{Version}
1137 % \begin{Version}{2006/02/20 v2.2}
1138 % \item
1139 % Code is not changed.
1140 % \item
1141 % DTX framework.
1142 % \end{Version}
1143 % \begin{Version}{2006/12/22 v2.3}
1144 % \item
1145 % Documentation fix.
1146 % \item
1147 % Fix in code of option vlines.
1148 % \end{Version}
1149 % \begin{Version}{2007/03/21 v2.4}
1150 % \item
1151 % Fix: Counter |tabh@unique| must not be changed by \cs{include}.
1152 % \end{Version}
1153 % \begin{Version}{2007/04/11 v2.5}
1154 % \item
1155 % Line ends sanitized.
1156 % \end{Version}
1157 % \begin{Version}{2016/05/16 v2.6}
1158 % \item
1159 % Documentation updates.
1160 % \end{Version}
1161 % \begin{Version}{2019/12/29 v2.7}
1162 % \item
1163 % Use \cs{iftex} package.
1164 % \end{Version}
1165 % \begin{Version}{2026-05-13 v2.8}
1166 % \item Updated for \cs{text@vcenter} use in underlying array code.
1167 % \end{Version}
1168 % \end{History}
1169 %
1170 % \PrintIndex
1171 %
1172 % \Finale
1173 \endinput