Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

1 Answer 1

up vote 11 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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