1

I am trying to justify the caption of a table instead of centering it.

I found many questions (including this one) explaining that the caption package proposes the option justification=justified. This does not work in the code sample below.

  • Note that the labelfont=bf, passed at the same time when calling the package, is applied properly.
  • Attempts to apply format=plain do not work either.
  • I tried to move the center environment after the \caption command and it does not solve the problem.

How to justify this caption?

MWE

\documentclass{article}

\usepackage[labelfont=bf,justification=justified]{caption}

\begin{document}

Some data meaningless is presented in the table below to show that the \textit{justification} of the caption is not working while the \textit{labelfont} is applied properly.

\begin{center}
    \begin{table}[ht]
        \caption{A caption which should be justified}
        \begin{tabular}{c|c|c}
            A & B & C \\
            \hline
            a & b & c\\
        \end{tabular}
    \end{table}
\end{center}

\end{document}

AlMa
  • 560

1 Answers1

3

The caption package normally justifies captions which are longer than one line and centres the ones with only a single line. If you don't like this, you can switch this check off like this:

\documentclass{article}

\usepackage[labelfont=bf,justification=justified,singlelinecheck=false]{caption}

\begin{document}

Some data meaningless is presented in the table below to show that the \textit{justification} of the caption is not working while the \textit{labelfont} is applied properly.

\begin{center}
    \begin{table}[ht]
        \caption{A caption which should be justified}
        \begin{tabular}{c|c|c}
            A & B & C \\
            \hline
            a & b & c\\
        \end{tabular}
    \end{table}
\end{center}

\end{document}