3

How to add a longtable into a listoftables, please ?

I've filled my longtable, but, the listoftables still empty. How to deal this please ?

The code tht I've used :

\begingroup
\setlength{\LTleft}{-20cm plus -1fill}
\setlength{\LTright}{\LTleft}
\begin{longtable}{|p{3cm}|p{10cm}|}
\hline
B & A. \tabularnewline
\hline
\multicolumn{2}{l}{} \\[-7pt]  
\caption[]{Description textuelle du cas d'utilisation \og Rechercher application métier \fg.}
\label{tbl:desc_txt_rech_appmetier}
\end{longtable}
\endgroup

Thanks in advance !!

3

Update

Now that the answer has been edited, the problem is clear. If you use an empty optional argument for \caption, then no entry is produced in the list. Don't use the optional argument empty:

\documentclass{article}
\usepackage[french]{babel}
\usepackage{longtable}

\begin{document}
\listoftables
\begingroup
\setlength{\LTleft}{-20cm plus -1fill}
\setlength{\LTright}{\LTleft}
\begin{longtable}{|p{3cm}|p{10cm}|}
\hline
B & A. \tabularnewline
\hline
\multicolumn{2}{l}{} \\[-7pt]  
\caption{Description textuelle du cas d'utilisation \og Rechercher application métier \fg.}
\label{tbl:desc_txt_rech_appmetier}
\end{longtable}
\endgroup
\end{document}

Old answer (before the edit to the question)

Simply use \caption and process the document twice:

\documentclass{article}
\usepackage{longtable}

\begin{document}
\listoftables
\begin{longtable}{c}
\caption{a longtable} \\
\hline
text \\
text \\
\hline
\end{longtable}

\end{document}

enter image description here

Using one \caption before \endfirsthead and another one before \endhead you can even have a caption on the first page and another one for the other pages spanned by the table (notice the empty optional argument in the second \caption to prevent a duplicated entry in the list of tables):

\documentclass{article}
\usepackage[a6paper]{geometry}% just for the example
\usepackage{longtable}

\begin{document}
\listoftables
\begin{longtable}{c}
\caption{a longtable}
\endfirsthead
\caption[]{a longtable (Continued)}
\endhead
\hline
text \\
text \\
text \\
text \\
text \\
text \\
text \\
text \\
text \\
text \\
text \\
text \\
text \\
text \\
text \\
text \\
text \\
text \\
text \\
text \\
text \\
text \\
text \\
\hline
\end{longtable}

\end{document}

enter image description here

2
  • Please look my edit. Actually, I'm using caption but I cannot see any entry into my listoftables. Can you please explain me why ? I'm using report as type of document.
    – user44584
    Feb 15 '14 at 15:14
  • 1
    @user44584 Remove the optional argument. Use \caption{text} and not \caption[]{text} Feb 15 '14 at 15:19

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.