1

I have a table of the form

\documentclass[12pt,a4paper]{article} % 
\begin{document}    
\begin{table}
\begin{center}
\caption{\centering How many people \\
 \scriptsize     Average over a thousand simulations}
\label{table1}
\begin{tabular}{llll}
 $r \backslash 2n$  & 100 & 200& 1000\\
 \hline\\
 2 & 25.42 & 25.76 &25.47\\
 \hline
 \end{tabular}
 \end{center}
 \end{table}
\end{document}

My question is that here I have a nice subtitle, that looks great but that gives me errors when running it. Is there a way to take away the errors but make it look exactly the same? I really don't like \tablenotes.

EDIT: the error I am getting is

 Argument of \caption @ydblarg has an extra }
  • 1
    Which errors do you mean? Could you provide a complete MWE that we can compile? – Karlo May 18 '17 at 9:31
  • Argument of \caption @ydblarg has an extra }. – fox May 18 '17 at 9:43
  • 1
    Does this question help? – Karlo May 18 '17 at 9:48
  • 1
    @Karlo: I also just looked at this, and gave me the idea to use the caption package. So: does \usepackage{caption} in the preamble and then \caption{How many people\\ \scriptsize Average over a thousand simulations} produce what you want? I don't think the \centering is needed then, because the default of the caption package is to center anyway for short captions – Wiebke May 18 '17 at 9:58
  • I am using the caption package. The answer suggestion works fine, but the title is still aligned to the left. When I write \centering, the error produces – fox May 18 '17 at 10:00
1

So, by loading the caption package, I obtain a solution:

\documentclass[12pt,a4paper]{article} % 
\usepackage{caption}
\begin{document}    
\begin{table}
\centering
\caption{ How many people \\ 
\scriptsize  Average over a thousand simulations}
\label{table1}
\begin{tabular}{llll}
 $r \backslash 2n$  & 100 & 200& 1000\\
 \hline\\
 2 & 25.42 & 25.76 &25.47\\
 \hline
 \end{tabular}
 \end{table}
\end{document}

enter image description here

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.