0

I am using 2 tabular inside the same table*, with the same caption. everything works fine if the caption length is small, say a single line. But when I add a really long caption which also contains some equations as well, the layout is lost.

The tabulars loses its centering property and only the latter half of caption is shown. I am not sure how to resolve this.

    \begin{table*}[t]
    \centering

    \caption{long sentense with $some equation$ }\label{params} \\ \\
    \resizebox{0.8\textwidth}{!}{
    \begin{tabular}{|l|r|r|r|r|r|r|r|r|r|}
    .
    .
    .
    \end{tabular}
    }

    \resizebox{0.8\textwidth}{!}{%
    \begin{tabular}{|l|r|r|r|r|r|r|r|r|r|}
    .  
    .
    .
    \end{tabular}
    }
    \end{table*}
  • 2
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Jan 23 '15 at 6:38
  • 1
    What happens when you drop the use of \\ \\ to issue line breaks? – Werner Jan 23 '15 at 6:40
  • 1
    The caption problem is not reproducible. Please show the real issue to us! The `\\ \` is just wrong. Keep it away. "There's no line here to end." The issue is quite strange indeed. Both resizboxes are well centered, but the second table is set flush left in its box. – LaRiFaRi Jan 23 '15 at 6:50
  • Is the \resizebox really necessary? – user31729 Jan 23 '15 at 6:52
2

You were missing three %-signs in your code. Please have a look on my MWE. The resizeboxes were perfectly centred, but their content wasn't. As you can see in my image, they are now. The actual problem was that the linebreaks after those commands are resulting in a normal whitespace. Having that scaled up that much with your resizebox, this little space can get really ugly.

Please note that you should not use those back-slashes after your label. In order to increase the space after your caption, just use the package caption (my recommendation anyway). Your broken caption can not be reproduced from your MWE so let me know, if there is still some problem.

% arara: lualatex % you may use pdflatex if you kick out `lua-visual-debug`
% arara: lualatex % second run for the `\listoftables`

\documentclass{article}
\usepackage{graphicx}
\usepackage{mathtools} % for \text{}
\usepackage{caption}
\usepackage{lua-visual-debug} % just for the nice demo
\usepackage{blindtext} % for a longer caption

\begin{document}
    \listoftables
    \begin{table*}[t]       
        \caption[short form]{\blindtext $\text{some equation}$ }\label{params}
        \centering
        \resizebox{0.8\textwidth}{!}{% <- this was missing
            \begin{tabular}{|l|r|r|r|r|r|r|r|r|r|}
                .
                .
                .
            \end{tabular}% <- this was missing
        }

        \resizebox{0.8\textwidth}{!}{%
            \begin{tabular}{|l|r|r|r|r|r|r|r|r|r|}
                .  
                .
                .
            \end{tabular}% <- this was missing
        }
    \end{table*}
\end{document}

enter image description here

2

The \resizebox is of no use here, it seems to exaggerates the vertical lines widths/dots size and change the adjustment. A fontsize command such as \Large etc. is better, in my point of view.

I tried to 'improve' the tabular usage and suggest to wrap the layout in an outer tabular.

The caption should be used with a [] arg. for the LoF, since it could be too long for the LoF otherwise.

I used the outer tabular with {|c|} in order to show the equal horizontal spacings.

\documentclass{article}

\usepackage{graphicx}
\usepackage{caption}
\begin{document}

\listoftables

\begin{table*}[t]
    \centering
    \caption[short caption]{long sentence with $some equation$ }\label{params} 
    \begin{tabular}{|c|}
      \huge
      \begin{tabular}{|l*{8}{|r}|}
        & a & b & c & d & e & f& g & h 
      \end{tabular}
     \tabularnewline[2ex]

     \LARGE
      \begin{tabular}{|l*{8}{|r}|}
        & a & b & c & d & e & f& g & h 
      \end{tabular}
    \end{tabular}
  \end{table*}

\end{document}

enter image description here

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.