6

At the moment, I have the following code in the preamble:

\usepackage[justification=justified,singlelinecheck=false]{caption}
\captionsetup{format=hang, labelsep=quad}

This creates a nice space between the table caption and the caption text. However, I would also like to add a colon after the table number, and at the same time have the separation between the colon and the caption text. As far as I know, \captionsetup only allows one attribute for labelsep. Is there an easy way to accomplish this?

7

Yes, there is. The caption package provides the command \DeclareCaptionLabelSeparator to define your own caption label separator.

So, declaring

\DeclareCaptionLabelSeparator{mysep}{:\quad}

and using

\captionsetup{format=hang, labelsep=mysep}

you can obtain what you want.

MWE:

\documentclass{article}
\usepackage{caption}
\usepackage[justification=justified,singlelinecheck=false]{caption}
\DeclareCaptionLabelSeparator{mysep}{:\quad}
\captionsetup{format=hang, labelsep=mysep}
\begin{document}

\begin{table}
  \centering
  \begin{tabular}{c}
    \hline
    hello \\
    \hline
  \end{tabular}
  \caption{A table}
\end{table}

\end{document} 

enter image description here

  • @user81520 You're welcome. – karlkoeller Jul 27 '15 at 12:06
0

As far as I know captions of tables go above the table. If you do this, you can just add a little space to the line separator \\ like this:

\documentclass{article}

\begin{document}

 \begin{table}
   \centering
   \caption{A table} %captions go atop of a table
  \begin{tabular}{c}
   \\[1pt]  %This is the important part
   \hline
    hello \\
   \hline
  \end{tabular}
 \end{table}

\end{document} 

Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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