[Tex/LaTex] Centering caption under a table

horizontal alignmenttables

I have the following table in my document:

\begin{table}
\begin{center}
\begin{tabular}{|l|c|c|}\hline
defaults&5976&2258\\ \hline
\end{tabular}
\caption{Results}
\label{t2}
\end{center}
\end{table}

and the table itself is centered, but the caption is aligned to the left.

  1. Is it caused by the style sheet of the journal, or is it standard behaviour?
  2. How can I fix it (in case of both answers to the previous question)?

How does one debug what the stylesheet is changing anyway?

Best Answer

Just to echo some of the comments. It is best to try and provide as much information as possible. The class you using is a Springer-Verlag class and can be downloaded here.

You can add the following in your preamble:

\makeatletter
\long\def\@makecaption#1#2{%
 \captionstyle
 \ifx\@captype\fig@type
   \vskip\figcapgap
 \fi
 \setbox\@tempboxa\hbox{{\floatlegendstyle #1\floatcounterend}%
 \capstrut #2}%
 \ifdim \wd\@tempboxa >\hsize
   {\floatlegendstyle #1\floatcounterend}\capstrut #2\par
 \else
   \hfill\unhbox\@tempboxa\hfill\hfill%
 \fi
 \ifx\@captype\fig@type\else
   \vskip\tabcapgap
 \fi}
\makeatother

Use the template.tex test file that comes with the bundle to test. Testing it with the above I got:

enter image description here

When you inserting your figures or tables, use the \centering command to ensure that the figure or tabular is also centered:

 \begin{figure}
   \centering
   \image....
   \caption...
 \end{figure}

To be honest, it will look awful with small figures or tables and will probably break the \sidecaption command that is provided by the class. It is also possible the Journal Editor will not be very happy for you to change the look and feel.

Related Question