mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 17:20:47 +08:00
LaTeX writer/template: small fix for unnumbered tables.
This improves on commit e13aa5c015,
which worked only for recent versions of longtable.
For older versions, we need to define a dummy counter `none`.
Closes #11201. Thanks to @priiduonu for the solution.
This commit is contained in:
@@ -69,6 +69,7 @@ $-- tables
|
||||
$--
|
||||
$if(tables)$
|
||||
\usepackage{longtable,booktabs,array}
|
||||
\newcounter{none} % for unnumbered tables
|
||||
$if(multirow)$
|
||||
\usepackage{multirow}
|
||||
$endif$
|
||||
|
||||
@@ -98,7 +98,7 @@ 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 $$ "}"
|
||||
let makeUnnumbered x = "{\\def\\LTcaptype{none} % do not increment counter" $$ x $$ "}"
|
||||
return
|
||||
$ (if null capt then makeUnnumbered else id)
|
||||
$ "\\begin{longtable}[]" <>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
^D
|
||||
{\def\LTcaptype{} % do not increment counter
|
||||
{\def\LTcaptype{none} % do not increment counter
|
||||
\begin{longtable}[]{@{}
|
||||
>{\raggedright\arraybackslash}p{(\linewidth - 0\tabcolsep) * \real{1.0000}}@{}}
|
||||
\toprule\noalign{}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
| oranges | 4.25 |
|
||||
^D
|
||||
\begin{frame}
|
||||
{\def\LTcaptype{} % do not increment counter
|
||||
{\def\LTcaptype{none} % do not increment counter
|
||||
\begin{longtable}[]{@{}lr@{}}
|
||||
\toprule\noalign{}
|
||||
fruit & price \\
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
% pandoc -f html -t latex
|
||||
<table><tbody><tr></tr></tbody></table>
|
||||
^D
|
||||
{\def\LTcaptype{} % do not increment counter
|
||||
{\def\LTcaptype{none} % do not increment counter
|
||||
\begin{longtable}[]{@{}l@{}}
|
||||
\toprule\noalign{}
|
||||
\endhead
|
||||
|
||||
+4
-4
@@ -19,7 +19,7 @@ Right & Left & Center & Default \\
|
||||
|
||||
Simple table without caption:
|
||||
|
||||
{\def\LTcaptype{} % do not increment counter
|
||||
{\def\LTcaptype{none} % do not increment counter
|
||||
\begin{longtable}[]{@{}rlcl@{}}
|
||||
\toprule\noalign{}
|
||||
Right & Left & Center & Default \\
|
||||
@@ -92,7 +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
|
||||
{\def\LTcaptype{none} % do not increment counter
|
||||
\begin{longtable}[]{@{}
|
||||
>{\centering\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1500}}
|
||||
>{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1375}}
|
||||
@@ -119,7 +119,7 @@ Second & row & 5.0 & Here's another one. Note the blank line between rows. \\
|
||||
|
||||
Table without column headers:
|
||||
|
||||
{\def\LTcaptype{} % do not increment counter
|
||||
{\def\LTcaptype{none} % do not increment counter
|
||||
\begin{longtable}[]{@{}rlcr@{}}
|
||||
\toprule\noalign{}
|
||||
\endhead
|
||||
@@ -133,7 +133,7 @@ Table without column headers:
|
||||
|
||||
Multiline table without column headers:
|
||||
|
||||
{\def\LTcaptype{} % do not increment counter
|
||||
{\def\LTcaptype{none} % do not increment counter
|
||||
\begin{longtable}[]{@{}
|
||||
>{\centering\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1500}}
|
||||
>{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1375}}
|
||||
|
||||
Reference in New Issue
Block a user