Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When I use the following code:

    \documentclass{article}
    \usepackage{graphicx}

    \begin{document}

    \begin{figure}[h!]
    \begin{center}
    \caption{test}
    \includegraphics{intpoptotal.png}
    \end{center}
    \end{figure}

    \end{document}

The caption is centered as I want it, e.g.,

enter image description here

But when I use this apa6 class, with the following code:

    \documentclass{apa6}

    \begin{document}

    \begin{figure}[h!]
    \begin{center}
    \caption{test}
    \includegraphics{intpoptotal.png}
    \end{center}
    \end{figure}

    \end{document}

The caption is left-aligned, e.g.,

enter image description here

How can I use \documentclass{apa6} with centered captions? And what code in apa6 causes this to happen?

share|improve this question
add comment

1 Answer

up vote 9 down vote accepted

apa6.cls loads the caption package with the option singlelinecheck=off:

\RequirePackage[singlelinecheck=off]{caption}

this option overrides the standard LaTeX behaviour (automatically center a caption if it fits in one single line). To change this, you can use \captionsetup:

\documentclass{apa6}
\captionsetup{singlelinecheck=on}
\begin{document}

\begin{figure}
\centering
\caption{test}
A
\end{figure}

\end{document}

Notice that this will center only captions that fit on one line; if you want to have all captions centered (whether they span one or more than one line), you can say

\captionsetup{justification=centering}

As a side note, it's preferable to use \centering inside the floating environments instead of the center environment (\centering doesn't add additional vertical space); also, I would suggest you not to use the too restrictive placement specifier [!h].

share|improve this answer
    
+1 thanks for the added info, I will keep that in mind. –  notfed Jun 19 '12 at 2:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.