0

In the specond chapter there is a multi page table, thus I am using longtable. And I do not want any caption, caption label.

In the fifth chapter there is a simple table, and it has caption and caption label as well. The problem is that the its caption label number is 2, I want it to be 1, so the multi page table should not count.

I am using \counterwithout{table}{chapter} because I do not want chapter label number in the caption.

Code

The first table has about 50-60 rows, the second table has 6 rows.

\documentclass[12pt]{report}

\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{float}
\usepackage{longtable}
\usepackage{caption}

\counterwithout{table}{chapter}

\begin{document}

\begin{longtable}{lp{0.70\textwidth}}
ab & ab \\ab & ab \\ab & ab \\ab & ab
\end{longtable}

\begin{table}[H]
\centering
\caption{\normalfont{aaa}}
\label{tab:sp}
\begin{tabular}{lcccc}
aa  & 222 & 222 & 22  & 22  \\
bb  & 333 & 333 & 33  & 33  \\
cc  & 444 & 444 & 44  & 44  \\
\end{tabular}
\end{table}

\end{document}

Currently how it looks

enter image description here

What I want

enter image description here

1 Answer 1

2

longtable increment table counter regardless that it has not contain a caption. That you will get what you like, just add to its preamble

\addtocounter{table}{-1}
\endlastfoot

Complete MWE:

\documentclass[12pt]{report}
\usepackage{graphicx}
\usepackage{float}
\usepackage{longtable}
\usepackage{caption}

\counterwithout{table}{chapter}

\begin{document}

\begin{longtable}{lp{0.70\textwidth}}
\addtocounter{table}{-1}   % <---
\endlastfoot
ab & ab \\
ab & ab \\
ab & ab \\
ab & ab
\end{longtable}

\begin{table}[ht]
\centering
\caption{}
\label{tab:sp}
\begin{tabular}{lcccc}
aa  & 222 & 222 & 22  & 22  \\
bb  & 333 & 333 & 33  & 33  \\
cc  & 444 & 444 & 44  & 44  \\
\end{tabular}
\end{table}

\end{document}

enter image description here

Addendum :
If you can (or willing) to use longtblr of tabularray package instead of longtable, than the solution can be:

Edit:
I'm very sorry that I didn't check original answer. I overlooked that longtblr works as you like only if it not span several page. Now this "malfunction" is corrected and showed possible solution works as desired (i.e. as I understood now that it should):

\documentclass[12pt]{report}
\usepackage{tabularray}
\usepackage{caption}
\counterwithout{table}{chapter}
\usepackage{lipsum}

\begin{document}

\begingroup
\DefTblrTemplate{caption}{default}{}    % Removes a caption
\DefTblrTemplate{capcont}{default}{}    % Removes a caption on subsequent pages
\DefTblrTemplate{contfoot}{default}{}   % Removes text denoting continuation on next page
\begin{longtblr}[
entry = \empty
                ]{colspec={l p{0.70\textwidth}}}
ab & \lipsum[1] \\
cd & \lipsum[2] \\
ef & \lipsum[3] \\
gh & \lipsum[4]
\end{longtblr}

\endgroup

\lipsum[66]
\end{document}

enter image description here

2
  • If I am using longtblr , then at the buttom of the page Continued on next page, and at next page top Table 0 (Continued), how could I get rid of them?
    – mala97
    Dec 24, 2022 at 19:36
  • 2
    @mala97, See addendum to answer.
    – Zarko
    Dec 24, 2022 at 23:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .