\documentclass[a4paper]{article}
% generated by Docutils
\usepackage{fixltx2e} % LaTeX patches, \textsubscript
\usepackage{cmap} % fix search and cut-and-paste in Acrobat
\usepackage{ifthen}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{longtable,ltcaption,array}
\setlength{\extrarowheight}{2pt}
\newlength{\DUtablewidth} % internal use in tables
%%% Custom LaTeX preamble
% PDF Standard Fonts
\usepackage{mathptmx} % Times
\usepackage[scaled=.90]{helvet}
\usepackage{courier}
%%% User specified packages and stylesheets
%%% Fallback definitions for Docutils-specific commands
% hyperlinks:
\ifthenelse{\isundefined{\hypersetup}}{
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
\urlstyle{same} % normal text font (alternatives: tt, rm, sf)
}{}
\hypersetup{
pdftitle={Tables},
}
%%% Title Data
\title{\phantomsection%
Tables%
\label{tables}}
\author{}
\date{}
%%% Body
\begin{document}
\maketitle
Here's a grid table followed by a simple table:
\setlength{\DUtablewidth}{\linewidth}
\begin{longtable*}[c]{|p{0.296\DUtablewidth}|p{0.156\DUtablewidth}|p{0.133\DUtablewidth}|p{0.133\DUtablewidth}|}
\hline
\textbf{%
Header row, column 1
(header rows optional)
} & \textbf{%
Header 2
} & \textbf{%
Header 3
} & \textbf{%
Header 4
} \\
\hline
\endfirsthead
\hline
\textbf{%
Header row, column 1
(header rows optional)
} & \textbf{%
Header 2
} & \textbf{%
Header 3
} & \textbf{%
Header 4
} \\
\hline
\endhead
\multicolumn{4}{c}{\hfill ... continued on next page} \\
\endfoot
\endlastfoot
body row 1, column 1
&
column 2
&
column 3
&
column 4
\\
\hline
body row 2
& \multicolumn{3}{p{0.42\DUtablewidth}|}{
Cells may span columns.
} \\
\hline
body row 5
& \multicolumn{2}{p{0.29\DUtablewidth}|}{
Cells may also be
empty: \texttt{-{}->}
} & \\
\hline
\end{longtable*}
\setlength{\DUtablewidth}{\linewidth}
\begin{longtable*}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.086\DUtablewidth}|}
\hline
\multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{%
Inputs
}} & \textbf{%
Output
} \\
\hline
\textbf{%
A
} & \textbf{%
B
} & \textbf{%
A or B
} \\
\hline
\endfirsthead
\hline
\multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{%
Inputs
}} & \textbf{%
Output
} \\
\hline
\textbf{%
A
} & \textbf{%
B
} & \textbf{%
A or B
} \\
\hline
\endhead
\multicolumn{3}{c}{\hfill ... continued on next page} \\
\endfoot
\endlastfoot
False
&
False
&
False
\\
\hline
True
&
False
&
True
\\
\hline
False
&
True
&
True
\\
\hline
True
&
True
&
True
\\
\hline
\end{longtable*}
a table without head
\setlength{\DUtablewidth}{\linewidth}
\begin{longtable}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
\caption{Foo}\\
\hline
& \\
\hline
& \\
\hline
\end{longtable}
a narrow table
\setlength{\DUtablewidth}{\linewidth}
\begin{longtable*}[c]{|p{0.051\DUtablewidth}|p{0.051\DUtablewidth}|}
\hline
\textbf{%
CL1
} & \textbf{%
CL2
} \\
\hline
\endfirsthead
\hline
\textbf{%
CL1
} & \textbf{%
CL2
} \\
\hline
\endhead
\multicolumn{2}{c}{\hfill ... continued on next page} \\
\endfoot
\endlastfoot
ys
&
asd
\\
\hline
sda
&
ase
\\
\hline
\end{longtable*}
poses problems
\setlength{\DUtablewidth}{\linewidth}
\begin{longtable*}[c]{|p{0.051\DUtablewidth}|p{0.051\DUtablewidth}|}
\hline
\textbf{%
A
} & \textbf{%
B
} \\
\hline
\endfirsthead
\hline
\textbf{%
A
} & \textbf{%
B
} \\
\hline
\endhead
\multicolumn{2}{c}{\hfill ... continued on next page} \\
\endfoot
\endlastfoot
0
&
0
\\
\hline
1
&
0
\\
\hline
\end{longtable*}
\setlength{\DUtablewidth}{\linewidth}
\begin{longtable*}[c]{|p{0.051\DUtablewidth}|p{0.051\DUtablewidth}|p{0.051\DUtablewidth}|}
\hline
\textbf{%
A
} & \textbf{%
B
} & \textbf{%} \\
\hline
\endfirsthead
\hline
\textbf{%
A
} & \textbf{%
B
} & \textbf{%} \\
\hline
\endhead
\multicolumn{3}{c}{\hfill ... continued on next page} \\
\endfoot
\endlastfoot
0
&
0
&
0
\\
\hline
1
&
0
&
1
\\
\hline
\end{longtable*}
\setlength{\DUtablewidth}{\linewidth}
\begin{longtable*}[c]{|p{0.250\DUtablewidth}|p{0.318\DUtablewidth}|p{0.377\DUtablewidth}|}
\hline
\textbf{%
a wide table
} & \textbf{%
poses other problems
} & \textbf{%
.
} \\
\hline
\endfirsthead
\hline
\textbf{%
a wide table
} & \textbf{%
poses other problems
} & \textbf{%
.
} \\
\hline
\endhead
\multicolumn{3}{c}{\hfill ... continued on next page} \\
\endfoot
\endlastfoot
as reST assumes the
&
the LaTeX writer assumes
&
if the actual table is wider
\\
\hline
the documents being
&
line length being 80 chars
& \\
\hline
readable before
& &
it must be scaled down
\\
\hline
processing
& & \\
\hline
narrow ones need
&
a little amplification as TeX's
&
proportional fonts seem to need more
horizontal space.
\\
\hline
\end{longtable*}
\setlength{\DUtablewidth}{\linewidth}
\begin{longtable*}[c]{|p{0.319\DUtablewidth}|p{0.342\DUtablewidth}|}
\hline
{\ttfamily \raggedright \noindent
mpl::plus<\_,\_>
}
&
{\ttfamily \raggedright \noindent
mpl::plus<\_1,\_2>
}
\\
\hline
{\ttfamily \raggedright \noindent
boost::is\_same<\\
~~~~\_\\
~~,~add\_pointer<\_>\\
>
}
&
{\ttfamily \raggedright \noindent
boost::is\_same<\\
~~~~\_1\\
~~,~add\_pointer<\_1>\\
>
}
\\
\hline
\end{longtable*}
a longer and complicated table thanks to dave abrahams
\setlength{\DUtablewidth}{\linewidth}
\begin{longtable*}[c]{|p{0.311\DUtablewidth}|p{0.334\DUtablewidth}|p{0.300\DUtablewidth}|}
\hline
\textbf{%
Metafunction
} & \textbf{%
Result `` ::type``
} & \textbf{%
Complexity
} \\
\hline
\endfirsthead
\hline
\textbf{%
Metafunction
} & \textbf{%
Result `` ::type``
} & \textbf{%
Complexity
} \\
\hline
\endhead
\multicolumn{3}{c}{\hfill ... continued on next page} \\
\endfoot
\endlastfoot
\texttt{find}
&
An iterator to the first
occurrence of \texttt{T} in
\texttt{seq}, or
\texttt{end::type} if not
found.
&
Linear
\\
\hline
\texttt{find\_if}
&
An iterator to the first
element of \texttt{seq} that
satisfies predicate
\texttt{pred}, or
\texttt{end::type} if not
found.
&
Linear
\\
\hline
\texttt{contains}
&
True iff \texttt{seq} contains
\texttt{T}.
&
Linear
\\
\hline
\texttt{count}
&
The number of occurences of
\texttt{T} in \texttt{seq}.
&
Linear
\\
\hline
\texttt{count\_if}
&
The number of elements in
\texttt{seq} that satisfy
predicate \texttt{pred}.
&
Linear
\\
\hline
\texttt{equal}
&
True iff \texttt{seq1} and
\texttt{seq2} contain the same
elements in the same order.
&
Linear
\\
\hline
{\ttfamily \raggedright \noindent
lower\_bound<\\
~~~~seq,~T\\
~~,~compare~=~less<\_,\_>\\
>
}
&
The earliest
order-preserving position at
which \texttt{T} could be
inserted in a sequence
\texttt{seq} sorted according to
comparison \texttt{compare}.
&
Logarithmic in
invocations to
\texttt{compare}. Logarithmic
traversal of
random-access
sequences. Linear
traversal otherwise.
\\
\hline
{\ttfamily \raggedright \noindent
upper\_bound<\\
~~~~seq,~T\\
~~,~compare~=~less<\_,\_>\\
>
}
&
The latest order-preserving
position at which \texttt{T}
could be inserted in a
sequence \texttt{seq} sorted
according to comparison
\texttt{compare}.
&
Logarithmic in
invocations to
\texttt{compare}. Logarithmic
traversal of
random-access
sequences. Linear
traversal otherwise.
\\
\hline
{\ttfamily \raggedright \noindent
max\_element<\\
~~~~seq\\
~~,~compare~=~less<\_,\_>\\
>
}
&
The first position \texttt{i} in
\texttt{seq} such that for all
positions \texttt{j}:
{\ttfamily \raggedright \noindent
apply<\\
~~~~compare\\
~~,~deref::type\\
~~,~deref::type\\
>::type::value~==~false
}
&
Linear
\\
\hline
{\ttfamily \raggedright \noindent
min\_element<\\
~~~~seq\\
~~,~compare~=~less<\_,\_>\\
>
}
&
The first position \texttt{i} in
\texttt{seq} such that for all
positions \texttt{j}:
{\ttfamily \raggedright \noindent
apply<\\
~~~~compare\\
~~,~deref::type\\
~~,~deref::type\\
>::type::value~==~false
}
&
Linear
\\
\hline
\end{longtable*}
hyphens as content in a grid table cell
\setlength{\DUtablewidth}{\linewidth}
\begin{longtable*}[c]{|p{0.203\DUtablewidth}|p{0.226\DUtablewidth}|}
\hline
John Smith
&
Mary Scott-Smith
\\
\hline
\end{longtable*}
\end{document}