2

I have a narrow table but a long-ish caption. Rather than run the caption to several lines, I have set the ctable width to 0.5\textwidth. However, the two narrow table columns are now set to the left of the available space.

Is there a way to center them under the caption, without padding with dummy columns?


OK, here's an example (truncated)

\ctable[%
  caption= {Model fit to observational data, parameters: $log(q)$=8.5, $\tau$=$\infty$, $\kappa$=$\infty$},%
  doinside=\small, pos=h, captionskip=3pt, width=0.45\textwidth,%
  label=t2, center ]{cc}{}{%
   \toprule[1.5pt] Z & T \\
   \midrule    7.320 & 16543.3 \\
               7.388 & 16370.8 \\
               7.457 & 16185.5 \\
               7.525 & 15974.7 \\
               7.594 & 15725.7 \\
 \addlinespace[5pt]\bottomrule[1.5pt]\addlinespace[5pt]%
}
5
  • 1
    Please post a Minimum Working Example showing the problem that people can compile and play around with. This makes it much easier for people to understand, reproduce and potentially solve your problem. That is, you are much more likely to get a useful solution!
    – cfr
    Feb 1, 2014 at 4:19
  • BTW: Welcome to TeX.SX! Feb 1, 2014 at 5:45
  • OK, here's an example (truncated) \ctable[ caption= {Model fit to observational data, parameters: $log(q)$=8.5, $\tau$=$\infty$, $\kappa$=$\infty$}, doinside=\small, pos=h, captionskip=3pt, width=0.45\textwidth, label=t2, center ]{cc} {} {\toprule[1.5pt] Z & T \\ \midrule 7.320 & 16543.3 \\ 7.388 & 16370.8 \\ 7.457 & 16185.5 \\ 7.525 & 15974.7 \\ 7.594 & 15725.7 \\ \addlinespace[5pt]\bottomrule[1.5pt]\addlinespace[5pt]}
    – dcnicholls
    Feb 1, 2014 at 6:16
  • Still can't get it to format properly. I rather doubt that example will be of any use to anyone.
    – dcnicholls
    Feb 1, 2014 at 6:19
  • Please read the intention of a minimal working example: minimal working example (MWE) Feb 1, 2014 at 9:54

1 Answer 1

2

To give some extra room to the caption (and eventual notes), you need to set mincapwidth, and not width:

\documentclass{article}
\usepackage{booktabs}
\usepackage{ctable}

\begin{document}

\ctable[%
  caption= {Model fit to observational data, parameters: $\log q$=8.5, $\tau$=$\infty$, $\kappa$=$\infty$},%
  doinside=\small, pos=h, captionskip=3pt, mincapwidth=0.5\textwidth,%
  label=t2, center ]{cc}{}{%
   \toprule[1.5pt] Z & T \\
   \midrule    7.320 & 16543.3 \\
               7.388 & 16370.8 \\
               7.457 & 16185.5 \\
               7.525 & 15974.7 \\
               7.594 & 15725.7 \\
 \addlinespace[5pt]\bottomrule[1.5pt]\addlinespace[5pt]%
}

\end{document}

enter image description here

Not related to the question, but notice that to get the appropriate font and spacing for logarithms you can use \log (Thanks to Andrew Swann for the suggestion).

2
  • 1
    I think you want log to be \log Feb 2, 2014 at 16:12
  • @AndrewSwann Sure! I took the code from the OP's question and focused on the question but forgot about this. Unforgivable! Thanks. I'll fix it soon. Feb 2, 2014 at 16:14

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.