Reputation: 99418
I find that the caption in my longtable takes two lines but it seems that it can fit in one line. See the figure below:
My code is:
\begin{longtable}{|c|c|c|c||c|c|c|}
\caption{Testing error for training size 100000 and 8000 random counts}\\
\hline
\multicolumn{2}{|c|}{Concept} & \multicolumn{2}{c||}{Negative Class} & \multicolumn{2}{c|}{Positive Class} & Error rate \\
\hline
...
\end{longtable}
How to make the caption fit into a single line?
EDIT:
Thank, Geoff. But I tried "\usepackage{fullpage}" as you suggested, the whole content in the pdf file is messed up.
As you can see, there is still lot of space on the left of the caption. If the caption can be moved to the left, it will fit into a single line.
Upvotes: 14
Views: 40524
Reputation: 939
Just add a multiplier (like 1.2 for example) to the setting, this will solve all your landscape issues:
\LTcapwidth=1.2\textwidth
\begin{longtable}
Upvotes: 2
Reputation: 125
This is basically the same as xl42ii's answer, but works correctly in landscape mode. Use \linewidth
instead of \textwidth
. The reason for this is that the landscape mode swiches the values of \textwidth
and \textheight
, while the value of \linewidth
stays the same.
So
\LTcapwidth=\linewidth
\begin{longtable}
will do the trick. It did for me. : )
Upvotes: 2
Reputation: 4704
one way to force writing on a single line is to include the title of your caption within mbox as in
\mbox{This is a very long title}
You can try
\caption{\mbox{This is a very long title}}
or
\mbox{\caption{This is a very long title}}
Upvotes: 2
Reputation: 11837
Two options:
The longtables documentation says that there is an LTcapwidth
variable that you can set, that defaults to 4in. Try \setlength{LTcapwidth}{5.2in}
. I'm not sure how this works if you just want to change one caption width, so
You could force an hbox in the caption of the right dimensions:
\caption{\hskip -0.7in \hbox to 5.2in{Testing error for training size 100000 and 8000 random counts}}
Upvotes: 5
Reputation: 8135
My guess is that your table is wider than the page. In other words, your caption is as wide as the margins allow, while your table is simply too wide.
Try putting \usepackage{fullpage}
in your preamble.
Upvotes: 1