summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tabls/tabls.tex
blob: cf5f82e5caf2651255c8ce155863e1a832b48967 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
\documentclass[a4paper]{article}
\usepackage[a4paper]{geometry}
\usepackage{miscdoc}
\usepackage[scaled=0.85]{luximono}
\begin{document}
\title{The \textsf{tabls} package}
\author{Donald Arseneau\thanks{Documentation derived from the package
    file by Robin Fairbairns}}
\maketitle
\begin{quote}
  The package modifies \LaTeX{}'s \texttt{array} and \texttt{tabular}
  environments to keep text from touching other text or hlines above
  or below.
\end{quote}
\section{New parameters, etc.}

The behaviour of the package is controlled by a small set of
parameters, which are all \TeX{} \cs{dimen} registers (and so may be
adjusted using \LaTeX{} \cs{setlength} commands.

\paragraph{\cs{tablinesep} (or \cs{tablelineskip}):} the minimum space
between text on successive lines in a tabular environment.  Negative
distances are treated as zero.  The default value is \texttt{1pt}.  A
value of \texttt{0pt} turns off checking for touching text.  Text
given in an \verb|@{ }| specification (cf. the \textsf{array} package)
is never checked for overlap.

\paragraph{\cs{arraylinesep} (or \cs{arraylineskip})}: like
\cs{tablinesep}, but for arrays.

\paragraph{\cs{extrarulesep}:} extra space to add above and below each
\cs{hline} and \cs{cline}. There will be at least
\texttt{\cs{extrarulesep} + 0.5\cs{tablinesep}} between an \cs{hline}
and a line of text.  Negative values can be used, but only until some
text touches the line.  The default value is \texttt{3pt}.

\noindent To ensure interline separations in tables but not arrays,
declare
\begin{quote}
  \cs{setlength}\cmdinvoke{arraylinesep}{0pt}
\end{quote}
\noindent The appearance of normal \LaTeX{} tables can be had with
\begin{quote}
  \cs{setlength}\cmdinvoke{tablinesep}{0pt}\\
  \cs{setlength}\cmdinvoke{arraylinesep}{0pt}\\
  \cs{setlength}\cmdinvoke{extrarulesep}{0pt}
\end{quote}
\noindent but it would be better to not use \textsf{tabls} in this
situation.

The command \cmdinvoke{hline}[extra] has gained an optional length
argument (just like \bsbs), which gives the space to insert below the
line.  This space is in addition to the \cs{extrarulesep} and
linesep.  A negative value will reduce the space until the line
touches some text below, and will then have no further effect.  For
example, \cmdinvoke{hline}[-9cm] draws a horizontal line while
suppressing all the extra spacing.

(This \cs{hline} also fixes the notches that used to appear at the
junction between horizontal and vertical lines.)

\section{How it works}

There are no struts in the preamble entries\footnote{The comments in
  the package say this is a lie\dots}, rather, there are tests to
measure the maximum height and depth of all entries on a line.  The
maximum values start at the size of LaTeX's \cs{@arstrut} minus the
appropriate linesep.  At the \bsbs, a strut is inserted (in its own
column) which is that maximum size plus the linesep plus any
additional space for separation from \cs{hline}s.

\section{The Downside}

Building a table will be slower than before because the entries have
to be boxed twice (by the package's \cs{@seesize} and by \cs{halign}
itself) instead of just once.
\cs{setlength}\cmdinvoke{tablinesep}{0pt} will recover most of this
speed, with \cs{extrarulesep} still partially in effect\,---\,extra
space will still be added around \cs{hline}s, but it may be taken up
by very tall or very deep table entries; thus text may still touch the
lines.  Because of the speed penalty, if your computer is slow, it is
probably best to omit \textsf{tabls} until producing a final copy.
\end{document}