2

My table numbering is not working correctly. I have defined continuous numbers like this:

\usepackage{chngcntr}
\counterwithout{table}{chapter}

which works fine, but for some reason the numbering starts at 2. Only if I place the table at the very start of my document, it begins at 1. Look at this:

\begin{document}

% Deckblatt \begin{spacing}{1} \input{ads/deckblatt} \end{spacing} \newpage

\begin{table} \begin{center} \begin{tabular}{ c c c } cell1 & cell2 & cell3 \ cell4 & cell5 & cell6 \
cell7 & cell8 & cell9
\end{tabular} \end{center} \caption{Test\label{tab:table-test}} \end{table}

... \end{document}

It results in Table 2 on page 2 after the cover sheet: enter image description here

However, if I move the table before the cover sheet, it becomes table 1 (in the center of the page):

enter image description here

So I thought the code in \input{ads/deckblatt} is causing this, however its content doesn't seem to make any changes to numberings:

\begin{titlepage}
    \begin{longtable}{p{.4\textwidth} p{.4\textwidth}}
      {\includegraphics[width=6cm]{images/logo.png}} & 
      {\includegraphics[height=2.6cm]{images/dhbw.png}}
    \end{longtable}
    \enlargethispage{20mm}
    \begin{center}
      \vspace*{12mm}    {\LARGE\bf \titel }\\
      \vspace*{12mm}    {\large\bf \arbeit}\\
      \vspace*{12mm}    für die Prüfung zum\\
      \vspace*{3mm}     {\bf \abschluss}\\
      \vspace*{12mm}    des \studiengang\\
      \vspace*{3mm}     an der Dualen Hochschule Baden-Württemberg \dhbw\\
      \vspace*{12mm}    von\\
      \vspace*{3mm}     {\large\bf \autor}\\
      \vspace*{12mm}    \datumAbgabe\\
    \end{center}
    \vfill
    \begin{spacing}{1.2}
    \begin{tabbing}
        mmmmmmmmmmmmmmmmmmmmmmmmmm     \= \kill
        \textbf{Bearbeitungszeitraum}  \>  \zeitraum\\
        \textbf{Matrikelnummer, Kurs}  \>  \martrikelnr, \kurs\\
        \textbf{Ausbildungsfirma}      \>  \firma, \firmenort\\
        \textbf{Betreuer}              \>  \betreuer\\
        \textbf{Gutachter}             \>  \gutachter
    \end{tabbing}
    \end{spacing}
\end{titlepage}

Why does the table numbering start at 2 and how can I prevent this from happening? In case thats relevant, I am using documentclass scrreprt.

1 Answers1

4

longtable implements its own captioning command, which allows the table number and caption be printed on every page. To make this work longtable increments the table counter.

(Try putting a table before and after the title page. You will probably see that the first table before is Table 1, and the table after is Table 3 [skipping 2 which is the longtable].)


Why are you using longtable anyways? The pair of logos shouldn't break across page boundaries. You can easily typeset the pair of logos without using any table environment.

Edit: In view of the fact that this is a provided template, the easiest workaround is to just \setcounter{table}{0} after you input your title page.

Willie Wong
  • 24,733
  • 8
  • 74
  • 106
  • You're right. Putting one before and one after the title page results in table 2 missing. I just use the template of my university, as I have never done anythinh in LaTeX before - that's why the longtable is there – vhd17627 Jun 27 '22 at 15:06
  • Okay, in that case you can just force the counter to reset to zero after loading the title page. See edit. – Willie Wong Jun 27 '22 at 15:11
  • Works like a charm, thank you very much! – vhd17627 Jun 27 '22 at 15:14
  • 3
    longtable incrementing the table counter is such a bad idea, who can we blame for this design? – David Carlisle Jun 27 '22 at 15:47
  • @DavidCarlisle : would it make sense to introduce a * variant (like align versus align*) that doesn't touch the table counter and forces the caption to not show any numbering? – Willie Wong Jun 27 '22 at 18:03