# Centering caption under a table

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?

-
Did you try \centering instead? And usually, graphics have caption below, tables have caption above. –  matth Mar 2 '12 at 14:39
in order to know whether the journal's style changed it, it's necessary to know what document class you're using. –  barbara beeton Mar 2 '12 at 14:46
@barbarabeeton, I use \documentclass[smallextended,natbib]{svjour3}. –  Grzenio Mar 2 '12 at 18:28
sorry, svjour3.cls isn't on ctan or tex live, so i can't easily look at it. however, in that file, if it follows the pattern of article.cls, there may be a definition for a command \@makecaption. in article and similar classes, the caption text is stored in a box, and the box measured. if the width is less than the allowable caption width, it will be centered; otherwise it is set as a paragraph. svjour3.cls may do things differently, but that is where you need to look. –  barbara beeton Mar 2 '12 at 20:19
It's not clear to me why a specific journal document class is used without respecting the typographical guidelines this document class follows and obviously the journal wants to have for its articles. –  Axel Sommerfeldt Mar 3 '12 at 8:45

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.

\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:

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.

-

I used something similar to what Yiannis posted for an IFAC class. I don't know why Yiannis say his solution is not perfect, but the only major difference between the IFAC solution and Yiannis is that instead of the line \hfill\unhbox\@tempboxa\hfill\hfil, one would have \hbox to\hsize{\hfil\box\@tempboxa\hfil}. I don't know if this rectifies the issues Yiannis talked about. This worked with \usepackage{subfigure} and \usepackage{float}.

-