mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 17:20:47 +08:00
LaTeX writer: ensure that unlabelled tables don't increment counter.
Closes #11141.
This commit is contained in:
@@ -98,8 +98,10 @@ tableToLaTeX inlnsToLaTeX blksToLaTeX tbl = do
|
||||
modify $ \s -> s{ stTable = True }
|
||||
notes <- notesToLaTeX <$> gets stNotes
|
||||
beamer <- gets stBeamer
|
||||
let makeUnnumbered x = "{\\def\\LTcaptype{} % do not increment counter" $$ x $$ "}"
|
||||
return
|
||||
$ "\\begin{longtable}[]" <>
|
||||
$ (if null capt then makeUnnumbered else id)
|
||||
$ "\\begin{longtable}[]" <>
|
||||
braces ("@{}" <> colDescriptors isSimpleTable tbl <> "@{}")
|
||||
-- the @{} removes extra space at beginning and end
|
||||
$$ head'
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
^D
|
||||
{\def\LTcaptype{} % do not increment counter
|
||||
\begin{longtable}[]{@{}
|
||||
>{\raggedright\arraybackslash}p{(\linewidth - 0\tabcolsep) * \real{1.0000}}@{}}
|
||||
\toprule\noalign{}
|
||||
@@ -25,4 +26,5 @@
|
||||
text2 }\strut
|
||||
\end{minipage} \\
|
||||
\end{longtable}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
| oranges | 4.25 |
|
||||
^D
|
||||
\begin{frame}
|
||||
{\def\LTcaptype{} % do not increment counter
|
||||
\begin{longtable}[]{@{}lr@{}}
|
||||
\toprule\noalign{}
|
||||
fruit & price \\
|
||||
@@ -16,5 +17,6 @@ apple & 2.05 \\
|
||||
oranges & 4.25 \\
|
||||
\bottomrule\noalign{}
|
||||
\end{longtable}
|
||||
}
|
||||
\end{frame}
|
||||
```
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
% pandoc -f html -t latex
|
||||
<table><tbody><tr></tr></tbody></table>
|
||||
^D
|
||||
{\def\LTcaptype{} % do not increment counter
|
||||
\begin{longtable}[]{@{}l@{}}
|
||||
\toprule\noalign{}
|
||||
\endhead
|
||||
@@ -9,4 +10,5 @@
|
||||
\endlastfoot
|
||||
\\
|
||||
\end{longtable}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -19,6 +19,7 @@ Right & Left & Center & Default \\
|
||||
|
||||
Simple table without caption:
|
||||
|
||||
{\def\LTcaptype{} % do not increment counter
|
||||
\begin{longtable}[]{@{}rlcl@{}}
|
||||
\toprule\noalign{}
|
||||
Right & Left & Center & Default \\
|
||||
@@ -30,6 +31,7 @@ Right & Left & Center & Default \\
|
||||
123 & 123 & 123 & 123 \\
|
||||
1 & 1 & 1 & 1 \\
|
||||
\end{longtable}
|
||||
}
|
||||
|
||||
Simple table indented two spaces:
|
||||
|
||||
@@ -90,6 +92,7 @@ Second & row & 5.0 & Here's another one. Note the blank line between rows. \\
|
||||
|
||||
Multiline table without caption:
|
||||
|
||||
{\def\LTcaptype{} % do not increment counter
|
||||
\begin{longtable}[]{@{}
|
||||
>{\centering\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1500}}
|
||||
>{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1375}}
|
||||
@@ -112,9 +115,11 @@ Default aligned
|
||||
First & row & 12.0 & Example of a row that spans multiple lines. \\
|
||||
Second & row & 5.0 & Here's another one. Note the blank line between rows. \\
|
||||
\end{longtable}
|
||||
}
|
||||
|
||||
Table without column headers:
|
||||
|
||||
{\def\LTcaptype{} % do not increment counter
|
||||
\begin{longtable}[]{@{}rlcr@{}}
|
||||
\toprule\noalign{}
|
||||
\endhead
|
||||
@@ -124,9 +129,11 @@ Table without column headers:
|
||||
123 & 123 & 123 & 123 \\
|
||||
1 & 1 & 1 & 1 \\
|
||||
\end{longtable}
|
||||
}
|
||||
|
||||
Multiline table without column headers:
|
||||
|
||||
{\def\LTcaptype{} % do not increment counter
|
||||
\begin{longtable}[]{@{}
|
||||
>{\centering\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1500}}
|
||||
>{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1375}}
|
||||
@@ -139,3 +146,4 @@ Multiline table without column headers:
|
||||
First & row & 12.0 & Example of a row that spans multiple lines. \\
|
||||
Second & row & 5.0 & Here's another one. Note the blank line between rows. \\
|
||||
\end{longtable}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user