12

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?

1 Answer 1

19

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].

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .