11

When using longtable, my table counter starts from 2 rather than 1. Why?

enter image description here

\documentclass[12pt]{article}

\usepackage{xcolor}
\usepackage{array,booktabs,longtable}
%\extrarowheight5pt

\begin{document}

\begin{table}
\begin{longtable}{@{}p{0.2\linewidth}p{0.4\linewidth}p{0.4\linewidth}@{}}
\toprule
Options
    & Values
        & Descriptions\\
\midrule
%
\verb|PtNameMath|
    & {\color{blue}\verb|true|}, \verb|false|
        &   whether the node label is in math mode.\\
%
\bottomrule 
\end{longtable}
\caption{\texttt{\textbackslash pstGeonode} options.}
\label{tab:GeoNodeOptions}
\end{table}


\end{document}
12

This example:

\documentclass[12pt]{article}

\usepackage{xcolor}
\usepackage{booktabs,longtable}

\begin{document}

\begin{longtable}{@{}p{0.2\linewidth}p{0.4\linewidth}p{0.4\linewidth}@{}}
\toprule
Options
    & Values
        & Descriptions\\
\midrule
%
\verb|PtNameMath|
    & {\color{blue}\verb|true|}, \verb|false|
        &   whether the node label is in math mode.\\
%
\bottomrule 
\caption{\texttt{\textbackslash pstGeonode} options.}
\label{tab:GeoNodeOptions}
\end{longtable}    

\end{document}

is perfectly working and the result is:

enter image description here

The issue of the wrong caption number is due to the fact that you nested a longtable environment into a table one and this increase twice the counter.

Citing the documentation:

It also shares some features with the table environment. In particular it uses the same counter, table, and has a similar \caption command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.