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:
John MacFarlane
2025-10-06 23:04:40 +02:00
parent be0509a26b
commit d8354618c4
6 changed files with 9 additions and 8 deletions
+1
View File
@@ -69,6 +69,7 @@ $-- tables
$--
$if(tables)$
\usepackage{longtable,booktabs,array}
\newcounter{none} % for unnumbered tables
$if(multirow)$
\usepackage{multirow}
$endif$
+1 -1
View File
@@ -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}[]" <>
+1 -1
View File
@@ -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{}
+1 -1
View File
@@ -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 \\
+1 -1
View File
@@ -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
View File
@@ -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}}