# How to define caption width in longtable?

I have a longtable within a landscape environment. Not sure the landscape is relevant but ...

\begin{landscape}
\begin{longtable}{lll}
\caption{bla bla bla long ...}
table & table & table
\end{longtable}
\begin{landscape}


I would like to change the width of the caption that is too narrow for my taste.

I tried with the caption package that is supposed to work within the table environment

\captionsetup{width=5cm}


I also tried to put my caption in a parbox

\parbox{5cm}{\caption{Lorem ipsum dolor sit amet...}}


But it does not change anything or throws out an error.

Would you have an idea?

• I don't know what you're doing but a) your example above does not work at all and b) if I use a small document it works ;-)
– user31729
Jan 12 '16 at 16:24

The error is most likely due to a wrongly place \captionsetup.

I doubt the usefulness of landscape and longtable but here's an example:

\documentclass{article}

\usepackage{longtable}
\usepackage{lscape}
\usepackage{caption}

\usepackage{blindtext}

\begin{document}

\captionsetup{width=5cm}
\begin{landscape}
\begin{longtable}{lll}
\caption{\blindtext}
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
table & table & table \tabularnewline
\end{longtable}
\end{landscape}
\end{document}


• Hum I feel rather stupid right now. Actually, I used \captionsetup within the table and not outside of it! And yes, sorry for the example given a little too quickly. No need for \tabularnewline though. So thanks, it's working now :-) Jan 12 '16 at 16:50
• @tuculuxu The \captionsetup should work inside the longtable. If not, this is a bug and should be reported... I just tried it out using the test document above; placing \captionsetup{...} right before \caption inside the longtable works fine here. If you have a document where it does not, please report.
– user2574
Nov 2 '19 at 9:18

As indicated in the documents of longtable package. You can

Set the width of the caption with a command such as \setlength{\LTcapwidth}{2in} in the preamble of your document.

For example, to fit the caption length to table width (equals to textwidth), you can do

\setlength{\LTcapwidth}{\textwidth}


Then it should be work.