pandoc/test/tables.latex
John MacFarlane b5b5ef92cb LaTeX writer: Improve table spacing.
+ Remove the `\strut` that was added at the end of minipage
  environments in cells.

+ Replace `\tabularnewline` with `\\ \addlinespace`.

Closes #6842, closes #6860.
2020-11-22 10:54:42 -08:00

197 lines
5.7 KiB
Text

Simple table with caption:
\begin{longtable}[]{@{}rlcl@{}}
\caption{Demonstration of simple table syntax.}\tabularnewline
\toprule
Right & Left & Center & Default \\ \addlinespace
\midrule
\endfirsthead
\toprule
Right & Left & Center & Default \\ \addlinespace
\midrule
\endhead
12 & 12 & 12 & 12 \\ \addlinespace
123 & 123 & 123 & 123 \\ \addlinespace
1 & 1 & 1 & 1 \\ \addlinespace
\bottomrule
\end{longtable}
Simple table without caption:
\begin{longtable}[]{@{}rlcl@{}}
\toprule
Right & Left & Center & Default \\ \addlinespace
\midrule
\endhead
12 & 12 & 12 & 12 \\ \addlinespace
123 & 123 & 123 & 123 \\ \addlinespace
1 & 1 & 1 & 1 \\ \addlinespace
\bottomrule
\end{longtable}
Simple table indented two spaces:
\begin{longtable}[]{@{}rlcl@{}}
\caption{Demonstration of simple table syntax.}\tabularnewline
\toprule
Right & Left & Center & Default \\ \addlinespace
\midrule
\endfirsthead
\toprule
Right & Left & Center & Default \\ \addlinespace
\midrule
\endhead
12 & 12 & 12 & 12 \\ \addlinespace
123 & 123 & 123 & 123 \\ \addlinespace
1 & 1 & 1 & 1 \\ \addlinespace
\bottomrule
\end{longtable}
Multiline table with caption:
\begin{longtable}[]{@{}clrl@{}}
\caption{Here's the caption. It may span multiple lines.}\tabularnewline
\toprule
\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
Centered Header
\end{minipage} &
\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
Left Aligned
\end{minipage} &
\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
Right Aligned
\end{minipage} &
\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
Default aligned
\end{minipage} \\ \addlinespace
\midrule
\endfirsthead
\toprule
\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
Centered Header
\end{minipage} &
\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
Left Aligned
\end{minipage} &
\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
Right Aligned
\end{minipage} &
\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
Default aligned
\end{minipage} \\ \addlinespace
\midrule
\endhead
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
First
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
row
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
12.0
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
Example of a row that spans multiple lines.
\end{minipage} \\ \addlinespace
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
Second
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
row
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
5.0
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
Here's another one. Note the blank line between rows.
\end{minipage} \\ \addlinespace
\bottomrule
\end{longtable}
Multiline table without caption:
\begin{longtable}[]{@{}clrl@{}}
\toprule
\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
Centered Header
\end{minipage} &
\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
Left Aligned
\end{minipage} &
\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
Right Aligned
\end{minipage} &
\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
Default aligned
\end{minipage} \\ \addlinespace
\midrule
\endhead
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
First
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
row
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
12.0
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
Example of a row that spans multiple lines.
\end{minipage} \\ \addlinespace
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
Second
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
row
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
5.0
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
Here's another one. Note the blank line between rows.
\end{minipage} \\ \addlinespace
\bottomrule
\end{longtable}
Table without column headers:
\begin{longtable}[]{@{}rlcr@{}}
\toprule
\endhead
12 & 12 & 12 & 12 \\ \addlinespace
123 & 123 & 123 & 123 \\ \addlinespace
1 & 1 & 1 & 1 \\ \addlinespace
\bottomrule
\end{longtable}
Multiline table without column headers:
\begin{longtable}[]{@{}clrl@{}}
\toprule
\endhead
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
First
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
row
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
12.0
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
Example of a row that spans multiple lines.
\end{minipage} \\ \addlinespace
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
Second
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
row
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
5.0
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
Here's another one. Note the blank line between rows.
\end{minipage} \\ \addlinespace
\bottomrule
\end{longtable}