diff options
author | John MacFarlane <jgm@berkeley.edu> | 2011-07-10 09:13:10 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2011-07-10 12:33:45 -0700 |
commit | b5411c06aa5c4909cf10647e6ba0fe186cfa41f6 (patch) | |
tree | c80d98bab29dc1d66d38c22d3c46e1ae07ba962c /tests | |
parent | 09479ba7b2ad2b39fe05af70ae88e5bfed913c8d (diff) | |
download | pandoc-b5411c06aa5c4909cf10647e6ba0fe186cfa41f6.tar.gz |
Improved LaTeX tables.
* Use ctable package, which allows footnotes and
provides additional options.
* Made cell alignments work in multiline tables.
* Closes #272.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tables.latex | 255 |
1 files changed, 155 insertions, 100 deletions
diff --git a/tests/tables.latex b/tests/tables.latex index 89bcf9d9f..21ad73b0a 100644 --- a/tests/tables.latex +++ b/tests/tables.latex @@ -1,121 +1,176 @@ Simple table with caption: -\begin{table}[h] -\begin{center} -\begin{tabular}{rlcl} -Right & Left & Center & Default\\ -\hline -12 & 12 & 12 & 12\\ -123 & 123 & 123 & 123\\ -1 & 1 & 1 & 1\\ -\end{tabular} -\end{center} -\caption{Demonstration of simple table syntax.} -\end{table} +\ctable[caption = Demonstration of simple table syntax., +pos = H, center, botcap]{rlcl} +{% notes +} +{% rows +\FL +Right & Left & Center & Default +\ML +12 & 12 & 12 & 12 +\\\noalign{\medskip} +123 & 123 & 123 & 123 +\\\noalign{\medskip} +1 & 1 & 1 & 1 +\LL +} Simple table without caption: -\begin{center} -\begin{tabular}{rlcl} -Right & Left & Center & Default\\ -\hline -12 & 12 & 12 & 12\\ -123 & 123 & 123 & 123\\ -1 & 1 & 1 & 1\\ -\end{tabular} -\end{center} +\ctable[pos = H, center, botcap]{rlcl} +{% notes +} +{% rows +\FL +Right & Left & Center & Default +\ML +12 & 12 & 12 & 12 +\\\noalign{\medskip} +123 & 123 & 123 & 123 +\\\noalign{\medskip} +1 & 1 & 1 & 1 +\LL +} Simple table indented two spaces: -\begin{table}[h] -\begin{center} -\begin{tabular}{rlcl} -Right & Left & Center & Default\\ -\hline -12 & 12 & 12 & 12\\ -123 & 123 & 123 & 123\\ -1 & 1 & 1 & 1\\ -\end{tabular} -\end{center} -\caption{Demonstration of simple table syntax.} -\end{table} +\ctable[caption = Demonstration of simple table syntax., +pos = H, center, botcap]{rlcl} +{% notes +} +{% rows +\FL +Right & Left & Center & Default +\ML +12 & 12 & 12 & 12 +\\\noalign{\medskip} +123 & 123 & 123 & 123 +\\\noalign{\medskip} +1 & 1 & 1 & 1 +\LL +} Multiline table with caption: -\begin{table}[h] -\begin{center} -\begin{tabular}{>{\PBS\centering\hspace{0pt}}p{0.15\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.14\columnwidth}>{\PBS\raggedleft\hspace{0pt}}p{0.16\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.34\columnwidth}} -\parbox{0.15\columnwidth}{Centered Header -} & \parbox{0.14\columnwidth}{Left Aligned -} & \parbox{0.16\columnwidth}{Right Aligned -} & \parbox{0.34\columnwidth}{Default aligned -}\\ -\hline -\parbox{0.15\columnwidth}{First -} & \parbox{0.14\columnwidth}{row -} & \parbox{0.16\columnwidth}{12.0 -} & \parbox{0.34\columnwidth}{Example of a row that spans multiple lines. -}\\ -\parbox{0.15\columnwidth}{Second -} & \parbox{0.14\columnwidth}{row -} & \parbox{0.16\columnwidth}{5.0 -} & \parbox{0.34\columnwidth}{Here's another one. Note the blank line between -rows. -}\\ -\end{tabular} -\end{center} -\caption{Here's the caption. It may span multiple lines.} -\end{table} +\ctable[caption = Here's the caption. It may span multiple lines., +pos = H, center, botcap]{clrl} +{% notes +} +{% rows +\FL +\parbox[b]{0.15\columnwidth}{\centering +Centered Header +} & \parbox[b]{0.14\columnwidth}{\raggedright +Left Aligned +} & \parbox[b]{0.16\columnwidth}{\raggedleft +Right Aligned +} & \parbox[b]{0.34\columnwidth}{\raggedright +Default aligned +} +\ML +\parbox[t]{0.15\columnwidth}{\centering +First +} & \parbox[t]{0.14\columnwidth}{\raggedright +row +} & \parbox[t]{0.16\columnwidth}{\raggedleft +12.0 +} & \parbox[t]{0.34\columnwidth}{\raggedright +Example of a row that spans multiple lines. +} +\\\noalign{\medskip} +\parbox[t]{0.15\columnwidth}{\centering +Second +} & \parbox[t]{0.14\columnwidth}{\raggedright +row +} & \parbox[t]{0.16\columnwidth}{\raggedleft +5.0 +} & \parbox[t]{0.34\columnwidth}{\raggedright +Here's another one. Note the blank line between rows. +} +\LL +} Multiline table without caption: -\begin{center} -\begin{tabular}{>{\PBS\centering\hspace{0pt}}p{0.15\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.14\columnwidth}>{\PBS\raggedleft\hspace{0pt}}p{0.16\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.34\columnwidth}} -\parbox{0.15\columnwidth}{Centered Header -} & \parbox{0.14\columnwidth}{Left Aligned -} & \parbox{0.16\columnwidth}{Right Aligned -} & \parbox{0.34\columnwidth}{Default aligned -}\\ -\hline -\parbox{0.15\columnwidth}{First -} & \parbox{0.14\columnwidth}{row -} & \parbox{0.16\columnwidth}{12.0 -} & \parbox{0.34\columnwidth}{Example of a row that spans multiple lines. -}\\ -\parbox{0.15\columnwidth}{Second -} & \parbox{0.14\columnwidth}{row -} & \parbox{0.16\columnwidth}{5.0 -} & \parbox{0.34\columnwidth}{Here's another one. Note the blank line between -rows. -}\\ -\end{tabular} -\end{center} +\ctable[pos = H, center, botcap]{clrl} +{% notes +} +{% rows +\FL +\parbox[b]{0.15\columnwidth}{\centering +Centered Header +} & \parbox[b]{0.14\columnwidth}{\raggedright +Left Aligned +} & \parbox[b]{0.16\columnwidth}{\raggedleft +Right Aligned +} & \parbox[b]{0.34\columnwidth}{\raggedright +Default aligned +} +\ML +\parbox[t]{0.15\columnwidth}{\centering +First +} & \parbox[t]{0.14\columnwidth}{\raggedright +row +} & \parbox[t]{0.16\columnwidth}{\raggedleft +12.0 +} & \parbox[t]{0.34\columnwidth}{\raggedright +Example of a row that spans multiple lines. +} +\\\noalign{\medskip} +\parbox[t]{0.15\columnwidth}{\centering +Second +} & \parbox[t]{0.14\columnwidth}{\raggedright +row +} & \parbox[t]{0.16\columnwidth}{\raggedleft +5.0 +} & \parbox[t]{0.34\columnwidth}{\raggedright +Here's another one. Note the blank line between rows. +} +\LL +} Table without column headers: -\begin{center} -\begin{tabular}{rlcr} -12 & 12 & 12 & 12\\ -123 & 123 & 123 & 123\\ -1 & 1 & 1 & 1\\ -\end{tabular} -\end{center} +\ctable[pos = H, center, botcap]{rlcr} +{% notes +} +{% rows +\FL +12 & 12 & 12 & 12 +\\\noalign{\medskip} +123 & 123 & 123 & 123 +\\\noalign{\medskip} +1 & 1 & 1 & 1 +\LL +} Multiline table without column headers: -\begin{center} -\begin{tabular}{>{\PBS\centering\hspace{0pt}}p{0.15\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.14\columnwidth}>{\PBS\raggedleft\hspace{0pt}}p{0.16\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.34\columnwidth}} -\parbox{0.15\columnwidth}{First -} & \parbox{0.14\columnwidth}{row -} & \parbox{0.16\columnwidth}{12.0 -} & \parbox{0.34\columnwidth}{Example of a row that spans multiple lines. -}\\ -\parbox{0.15\columnwidth}{Second -} & \parbox{0.14\columnwidth}{row -} & \parbox{0.16\columnwidth}{5.0 -} & \parbox{0.34\columnwidth}{Here's another one. Note the blank line between -rows. -}\\ -\end{tabular} -\end{center} +\ctable[pos = H, center, botcap]{clrl} +{% notes +} +{% rows +\FL +\parbox[t]{0.15\columnwidth}{\centering +First +} & \parbox[t]{0.14\columnwidth}{\raggedright +row +} & \parbox[t]{0.16\columnwidth}{\raggedleft +12.0 +} & \parbox[t]{0.34\columnwidth}{\raggedright +Example of a row that spans multiple lines. +} +\\\noalign{\medskip} +\parbox[t]{0.15\columnwidth}{\centering +Second +} & \parbox[t]{0.14\columnwidth}{\raggedright +row +} & \parbox[t]{0.16\columnwidth}{\raggedleft +5.0 +} & \parbox[t]{0.34\columnwidth}{\raggedright +Here's another one. Note the blank line between rows. +} +\LL +} |