tags:

views:

131

answers:

1

I need to change my document's preamble to change tables look. Currently all my tables have caption added to bottom and aligned to center which looks like: "Table N: Table caption".
I need to split that caption into two parts and move then, so my tables will look like:
Table N (aligned to left)
Table caption (aligned to center)
Table

How can I achieve this?

+4  A: 

Something like the following may work, but your description leaves a few questions in my mind.

\documentclass{article}

\usepackage{booktabs}% pretty rules for the table

\usepackage{lipsum}% provides filler text

%% Let's define our caption style
\usepackage{caption}

\DeclareCaptionLabelSeparator{fill-newline}{\hfill\null\par}

\captionsetup{%
  format=plain,
  labelformat=simple,
  labelsep=fill-newline,
  singlelinecheck=false,
  justification=centering,
  position=top,
}

\begin{document}

\lipsum[1]

\begin{table}[h]
  \caption{I've used the \texttt{caption} package to achieve this caption format.}
  \centering
  \begin{tabular}{ll}
    \toprule
    Option & Setting \\
    \midrule
    format & plain \\
    labelformat & simple \\
    labelsep & fill-newline \\
    singlelinecheck & false \\
    justification & centering \\
    position & top \\
    \bottomrule
  \end{tabular}
\end{table}

\lipsum[2]

\end{document}

The caption package lets you reformat the captions in almost any way you'd like.

  1. Do you want the "Table N" and the caption text to be on the same line or separate lines (like above)?

  2. What should happen if the caption takes up more than one line?

I can fiddle with the format more if this isn't quite what you want. If you'd like to play with iti on your own, check out the caption package documentation.

godbyk