2

I often see tables with centered titles and fully-justified descriptions. Here is an example.

Table caption I would like (i.e., centered title and fully-justified description.

I know how to use the caption package to alter the label and title, but I can't figure out how to get the description fully justified. Instead, my description adopts the \centering that I use to get the table centered.

What is the best way to do this? Here is my best attempt.

\documentclass{article}

\usepackage[font=sc]{caption}
\usepackage{booktabs}
\usepackage{lipsum}

\begin{document}

\begin{table}
    \centering
    \caption{This could win me the Nobel Prize in Economics.}
    {\noindent Fine, this could win me the Nobel \emph{Memorial} Prize in Economic Sciences.~\lipsum[1]}
    \begin{tabular*}{\textwidth}{c @{\extracolsep{\fill}} ccc}
    \toprule
    xx&1&2&3\\
    xx&1&2&3\\
    \bottomrule
    \end{tabular*}
\end{table}

\end{document}

But this gives me a centered description.

My failed attempt with centered description.

I see there is a threeparttable package, but I don't want footnotes. I would like the description to immediately follow the title.

1

Since you may be using such descriptions for figures regularly, define a macro to take care of the formatting; this includes keeping the text justified using \justifying (from ragged2e):

enter image description here

\documentclass{article}

\usepackage[font=sc]{caption}

\usepackage{lipsum,ragged2e}

\newcommand{\figuredesc}[1]{% Figure description
  \begingroup
  \par
  \justifying\small
  \noindent #1
  \par
  \endgroup}

\begin{document}

\begin{table}[htb]
  \centering
  \caption{This could win me the Nobel Prize in Economics.}

  \figuredesc{Fine, this could win me the Nobel \emph{Memorial} Prize in Economic Sciences.~\lipsum[1]}

  \begin{tabular}{ *{4}{c} }
    \hline
    A & 1 & 2 & 3 \\
    B & 1 & 2 & 3 \\
    \hline
  \end{tabular}
\end{table}

\end{document}
| improve this answer | |
2

Like this?

enter image description here

To my opinion the simplest way is to move this long explanation in the first row of table:

\documentclass{article}
\usepackage[font=sc]{caption}
\usepackage{booktabs}

\usepackage{lipsum}
\usepackage{showframe}
\renewcommand*\ShowFrameColor{\color{red}}

\begin{document}

\begin{table}[htb]
    \centering
\caption{This could win me the Nobel Prize in Economics.}
    \begin{tabular*}{\textwidth}{c @{\extracolsep{\fill}} ccc}
\multicolumn{4}{@{}p{\textwidth}@{}}{\footnotesize 
    Fine, this could win me the Nobel \emph{Memorial} Prize in Economic Sciences.~\lipsum[1]}\\
    \toprule
xx  &   1 &   2 &   3\\
xx  &   1 &   2 &   3\\
    \bottomrule
    \end{tabular*}
\end{table}

\end{document}
| improve this answer | |
1

You can use threeparttablex, an extension of threeparttable, which allows you to insert table notes anywhere in a longtable, and ltablex, which brings the functionalities of longtable to tabularx.

Note the syntax of threeparttablex is slightly differnt from that of threeparttable. With ltablex, the caption has to be inserted within the table, as with longtable.

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage[font=sc]{caption}
\usepackage{booktabs, threeparttablex,  ltablex}
\usepackage{lipsum}
\keepXColumns

\begin{document}

\begin{ThreePartTable}
  \setTableNoteFont{\footnotesize}
  \begin{TableNotes}[flushleft]
    \item[\hskip-\fontdimen2\font]Fine, this could win me the Nobel \emph{Memorial} Prize in Economic Sciences.~\lipsum[1]
  \end{TableNotes}
  \begin{tabularx}{\textwidth}{*{4}{>{\centering\arraybackslash}X}}%
    \caption{This could win me the Nobel Prize in Economics.}\\
    \insertTableNotes\\
    \addlinespace%
    \toprule
    \endfirsthead
    xx & 1 & 2 & 3 \\
    xx & 1 & 2 & 3 \\
    \bottomrule
  \end{tabularx}
\end{ThreePartTable}

\end{document} 

enter image description here

| improve this answer | |

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.