diff options
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 4 | ||||
-rw-r--r-- | test/command/2378.md | 6 | ||||
-rw-r--r-- | test/command/5367.md | 12 | ||||
-rw-r--r-- | test/tables.latex | 124 |
4 files changed, 73 insertions, 73 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index f7775318a..345ebe387 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -862,7 +862,7 @@ tableRowToLaTeX header aligns widths cols = do else widths let numcols = length widths' cells <- mapM (tableCellToLaTeX header numcols) $ zip3 widths' aligns cols - return $ hsep (intersperse "&" cells) <> "\\tabularnewline" + return $ hsep (intersperse "&" cells) <> " \\\\ \\addlinespace" -- For simple latex tables (without minipages or parboxes), -- we need to go to some lengths to get line breaks working: @@ -914,7 +914,7 @@ tableCellToLaTeX header numcols (width, align, blocks) = do braces (text (printf "(\\columnwidth - %d\\tabcolsep) * \\real{%.2f}" (numcols - 1) width)) <> - halign <> cr <> cellContents <> "\\strut" <> cr <> + halign <> cr <> cellContents <> cr <> "\\end{minipage}" -- (\columnwidth - 8\tabcolsep) * \real{0.15} diff --git a/test/command/2378.md b/test/command/2378.md index 801c168ad..e81855367 100644 --- a/test/command/2378.md +++ b/test/command/2378.md @@ -14,14 +14,14 @@ is used. \begin{longtable}[]{@{}ll@{}} \caption{a table}\tabularnewline \toprule -x & y\footnote{a footnote}\tabularnewline +x & y\footnote{a footnote} \\ \addlinespace \midrule \endfirsthead \toprule -x & y{}\tabularnewline +x & y{} \\ \addlinespace \midrule \endhead -1 & 2\tabularnewline +1 & 2 \\ \addlinespace \bottomrule \end{longtable} ``` diff --git a/test/command/5367.md b/test/command/5367.md index 18ac764ab..f56211517 100644 --- a/test/command/5367.md +++ b/test/command/5367.md @@ -24,19 +24,19 @@ hello\footnote{doc footnote} \caption[Sample table.]{Sample table.\footnote{caption footnote}}\tabularnewline \toprule \begin{minipage}[b]{(\columnwidth - 0\tabcolsep) * \real{0.17}}\centering -Fruit\footnote{header footnote}\strut -\end{minipage}\tabularnewline +Fruit\footnote{header footnote} +\end{minipage} \\ \addlinespace \midrule \endfirsthead \toprule \begin{minipage}[b]{(\columnwidth - 0\tabcolsep) * \real{0.17}}\centering -Fruit{}\strut -\end{minipage}\tabularnewline +Fruit{} +\end{minipage} \\ \addlinespace \midrule \endhead \begin{minipage}[t]{(\columnwidth - 0\tabcolsep) * \real{0.17}}\centering -Bans\footnote{table cell footnote}\strut -\end{minipage}\tabularnewline +Bans\footnote{table cell footnote} +\end{minipage} \\ \addlinespace \bottomrule \end{longtable} diff --git a/test/tables.latex b/test/tables.latex index e0be7efdc..d6cc3b56e 100644 --- a/test/tables.latex +++ b/test/tables.latex @@ -3,16 +3,16 @@ Simple table with caption: \begin{longtable}[]{@{}rlcl@{}} \caption{Demonstration of simple table syntax.}\tabularnewline \toprule -Right & Left & Center & Default\tabularnewline +Right & Left & Center & Default \\ \addlinespace \midrule \endfirsthead \toprule -Right & Left & Center & Default\tabularnewline +Right & Left & Center & Default \\ \addlinespace \midrule \endhead -12 & 12 & 12 & 12\tabularnewline -123 & 123 & 123 & 123\tabularnewline -1 & 1 & 1 & 1\tabularnewline +12 & 12 & 12 & 12 \\ \addlinespace +123 & 123 & 123 & 123 \\ \addlinespace +1 & 1 & 1 & 1 \\ \addlinespace \bottomrule \end{longtable} @@ -20,12 +20,12 @@ Simple table without caption: \begin{longtable}[]{@{}rlcl@{}} \toprule -Right & Left & Center & Default\tabularnewline +Right & Left & Center & Default \\ \addlinespace \midrule \endhead -12 & 12 & 12 & 12\tabularnewline -123 & 123 & 123 & 123\tabularnewline -1 & 1 & 1 & 1\tabularnewline +12 & 12 & 12 & 12 \\ \addlinespace +123 & 123 & 123 & 123 \\ \addlinespace +1 & 1 & 1 & 1 \\ \addlinespace \bottomrule \end{longtable} @@ -34,16 +34,16 @@ Simple table indented two spaces: \begin{longtable}[]{@{}rlcl@{}} \caption{Demonstration of simple table syntax.}\tabularnewline \toprule -Right & Left & Center & Default\tabularnewline +Right & Left & Center & Default \\ \addlinespace \midrule \endfirsthead \toprule -Right & Left & Center & Default\tabularnewline +Right & Left & Center & Default \\ \addlinespace \midrule \endhead -12 & 12 & 12 & 12\tabularnewline -123 & 123 & 123 & 123\tabularnewline -1 & 1 & 1 & 1\tabularnewline +12 & 12 & 12 & 12 \\ \addlinespace +123 & 123 & 123 & 123 \\ \addlinespace +1 & 1 & 1 & 1 \\ \addlinespace \bottomrule \end{longtable} @@ -53,58 +53,58 @@ Multiline table with caption: \caption{Here's the caption. It may span multiple lines.}\tabularnewline \toprule \begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering -Centered Header\strut +Centered Header \end{minipage} & \begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright -Left Aligned\strut +Left Aligned \end{minipage} & \begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft -Right Aligned\strut +Right Aligned \end{minipage} & \begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright -Default aligned\strut -\end{minipage}\tabularnewline +Default aligned +\end{minipage} \\ \addlinespace \midrule \endfirsthead \toprule \begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering -Centered Header\strut +Centered Header \end{minipage} & \begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright -Left Aligned\strut +Left Aligned \end{minipage} & \begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft -Right Aligned\strut +Right Aligned \end{minipage} & \begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright -Default aligned\strut -\end{minipage}\tabularnewline +Default aligned +\end{minipage} \\ \addlinespace \midrule \endhead \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering -First\strut +First \end{minipage} & \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright -row\strut +row \end{minipage} & \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft -12.0\strut +12.0 \end{minipage} & \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright -Example of a row that spans multiple lines.\strut -\end{minipage}\tabularnewline +Example of a row that spans multiple lines. +\end{minipage} \\ \addlinespace \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering -Second\strut +Second \end{minipage} & \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright -row\strut +row \end{minipage} & \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft -5.0\strut +5.0 \end{minipage} & \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright -Here's another one. Note the blank line between rows.\strut -\end{minipage}\tabularnewline +Here's another one. Note the blank line between rows. +\end{minipage} \\ \addlinespace \bottomrule \end{longtable} @@ -113,43 +113,43 @@ Multiline table without caption: \begin{longtable}[]{@{}clrl@{}} \toprule \begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering -Centered Header\strut +Centered Header \end{minipage} & \begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright -Left Aligned\strut +Left Aligned \end{minipage} & \begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft -Right Aligned\strut +Right Aligned \end{minipage} & \begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright -Default aligned\strut -\end{minipage}\tabularnewline +Default aligned +\end{minipage} \\ \addlinespace \midrule \endhead \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering -First\strut +First \end{minipage} & \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright -row\strut +row \end{minipage} & \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft -12.0\strut +12.0 \end{minipage} & \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright -Example of a row that spans multiple lines.\strut -\end{minipage}\tabularnewline +Example of a row that spans multiple lines. +\end{minipage} \\ \addlinespace \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering -Second\strut +Second \end{minipage} & \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright -row\strut +row \end{minipage} & \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft -5.0\strut +5.0 \end{minipage} & \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright -Here's another one. Note the blank line between rows.\strut -\end{minipage}\tabularnewline +Here's another one. Note the blank line between rows. +\end{minipage} \\ \addlinespace \bottomrule \end{longtable} @@ -158,9 +158,9 @@ Table without column headers: \begin{longtable}[]{@{}rlcr@{}} \toprule \endhead -12 & 12 & 12 & 12\tabularnewline -123 & 123 & 123 & 123\tabularnewline -1 & 1 & 1 & 1\tabularnewline +12 & 12 & 12 & 12 \\ \addlinespace +123 & 123 & 123 & 123 \\ \addlinespace +1 & 1 & 1 & 1 \\ \addlinespace \bottomrule \end{longtable} @@ -170,28 +170,28 @@ Multiline table without column headers: \toprule \endhead \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering -First\strut +First \end{minipage} & \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright -row\strut +row \end{minipage} & \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft -12.0\strut +12.0 \end{minipage} & \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright -Example of a row that spans multiple lines.\strut -\end{minipage}\tabularnewline +Example of a row that spans multiple lines. +\end{minipage} \\ \addlinespace \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering -Second\strut +Second \end{minipage} & \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright -row\strut +row \end{minipage} & \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft -5.0\strut +5.0 \end{minipage} & \begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright -Here's another one. Note the blank line between rows.\strut -\end{minipage}\tabularnewline +Here's another one. Note the blank line between rows. +\end{minipage} \\ \addlinespace \bottomrule \end{longtable} |