开发者

Caption in longtable

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:

Caption in longtable

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 c开发者_开发问答an be moved to the left, it will fit into a single line.


You can do this:

\LTcapwidth=\textwidth

\begin{longtable}


Two options:

  1. 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

  2. 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}}
    


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}}


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.


Just a guess, but try:

\usepackage[margin=1cm]{caption}


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. : )


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}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜