LyXlongtable | Tables with Counter and Caption

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
jenzhen99
Posts: 1
Joined: Wed Jan 25, 2012 11:56 am

longtable | Tables with Counter and Caption

Post by jenzhen99 »

Hi,

I normally put all my tables in floats. Now I've seen in this forum that for a longtable this is not possible: When the table is inside a float, then the longtable option in the table settings cannot be activated. So I just said Insert/Table and then I could indeed make it a long table.

However, now the table isn't counted anymore and I don't get a caption. How can I get a longtable with counting and caption?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

longtable | Tables with Counter and Caption

Post by cgnieder »

Did you take a look into the longtable documentation?

Anyway, here's how:

Code: Select all

\documentclass{article}
\usepackage{longtable}
\begin{document}

\begin{table}
 \caption{something}\label{table}
\end{table}

\begin{longtable}{ll}
 \caption{here's the caption and the label\label{longtable}} 
 \endfirsthead % caption is placed inside the longtable usually as part of the first head
 a & b
\end{longtable}

see tables \ref{table} and \ref{longtable}

\end{document}
site moderator & package author
Post Reply