1

Hi I am trying to change the font size of the caption (i.e., Descriptive Statistics and Correlations for Variables), but it keeps failing to do so:

\begin{table}[htb]
\captionsetup{font=scriptsize}
  \caption{Descriptive Statistics and Correlations for Variables}
  \begin{tabularx}{\linewidth}{l*{5}{Y}}
    \toprule
    \multicolumn{5}{l}{\textbf{Panel A: Descriptive Statistics}} \\
    \midrule
 Variable  & \textbf{(1)} & \textbf{(2)} & \textbf{(3)}& \textbf{(4)} & \textbf{(5)}  \\\hline \\

\textbf{Treat $\cdot$ Post} &\ 0.005& 0.005 &0.004&0.004&0.004  \\
&\ [3.20]&[3.11]&[3.76]&[3.00]&[3.12]\\
\textbf{Post} &-0.003& -0.003 & -0.002&-0.003 &-0.003   \\
&[-5.62]&[-3.04] &[-3.79] &[-2.88]&[-3.88]\\

\textbf{Treat} &  &&-0.002&-0.002 \\
&&& [-2.35]& [-1.70]\\ \\ 

\textbf{R-squared} &0.50&0.56&0.42&0.44 &0.54 \\\hline


  \end{tabularx}
  \begin{tabularx}{\linewidth}{l*{5}{Y}}
    \toprule
    \multicolumn{5}{l}{\textbf{Panel B: Correlations}} \\
    \midrule
 Variable  & \textbf{(1)} & \textbf{(2)} & \textbf{(3)}& \textbf{(4)} & \textbf{(5)}  \\\hline \\

\textbf{Treat $\cdot$ Post} &\ 0.005& 0.005 &0.004&0.004&0.004  \\
&\ [3.20]&[3.11]&[3.76]&[3.00]&[3.12]\\
\textbf{Post} &-0.003& -0.003 & -0.002&-0.003 &-0.003   \\
&[-5.62]&[-3.04] &[-3.79] &[-2.88]&[-3.88]\\

\textbf{Treat} &  &&-0.002&-0.002 \\
&&& [-2.35]& [-1.70]\\ \\ 

\textbf{R-squared} &0.50&0.56&0.42&0.44 &0.54 \\\hline

    \bottomrule
  \end{tabularx}

  [1]\ Footnote 1: Variable~1 is calculated as\ldots \endgraf
  [2]\ Correlations are Pearson.

\end{table}
2
  • PS: My code is based on the following post: tex.stackexchange.com/questions/27971/… – Job Jul 25 '17 at 1:22
  • If I add the instructions \usepackage{tabularx,caption,booktabs} and \newcolumntype{Y}{>{\centering\arraybackslash}X} to a preamble, I (a) experience no problem compiling your code and (b) obtain a script-size caption header. Please tell us more about your document setup. – Mico Jul 25 '17 at 6:36
2

You should check into whether you've loaded the caption package correctly.

In addition, you really ought to give some thought to reorganizing the tabular material to make it more easily comprehensible for your readers. To this effect, you should simplify the overall layout, get rid of the bold-facing (unless you want to convey to your readers that you're possessed by an irrepressible need to SHOUT at them), and you should align the numbers on their respective decimal markers. And, since there's no question of allowing automatic line breaks in the numeric columns, you should probably be using one tabular* environment instead of two [2!] tabularx environments.

Last but not least, you should thoroughly re-examine the reason for wishing to render the table's caption in \scriptsize. With all the shouting you seem to be intent on doing in the body of the table, why would you want to hide the caption?

enter image description here

\documentclass[12pt]{article}
\usepackage{dcolumn,caption,booktabs}
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\begin{document}

\begin{table}[htb]
\captionsetup{font=scriptsize} % why??$
\caption{Descriptive Statistics and Correlations for Variables}
\setlength\tabcolsep{0pt} % let LaTeX figure out intercolumn whitespace
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}
   l *{5}{d{2.3}}} 
\toprule
Variable & \mc{(1)} & \mc{(2)} & \mc{(3)} & \mc{(4)} & \mc{(5)} \\
\midrule
\multicolumn{5}{l}{A: Descriptive Statistics} \\ 
\addlinespace
Treat${}\times{}$Post & 0.005& 0.005 &0.004&0.004&0.004  \\
       & [3.20]&[3.11]&[3.76]&[3.00]&[3.12]              \\[0.75ex]
Post   &-0.003& -0.003 & -0.002&-0.003 &-0.003    \\
       &[-5.62]&[-3.04] &[-3.79] &[-2.88]&[-3.88] \\[0.75ex]
Treat  &&&  -0.002&  -0.002 \\
       &&& [-2.35]& [-1.70] \\[0.75ex]
R-squared &0.50&0.56&0.42&0.44 &0.54 \\[0.75cm]

\multicolumn{5}{l}{B: Correlations} \\
\addlinespace
Treat${}\times{}$Post & 0.005& 0.005 &0.004&0.004&0.004  \\
       & [3.20]&[3.11]&[3.76]&[3.00]&[3.12]              \\[0.75ex]
Post   &-0.003& -0.003 & -0.002&-0.003 &-0.003    \\
       &[-5.62]&[-3.04] &[-3.79] &[-2.88]&[-3.88] \\[0.75ex]
Treat  &&&  -0.002&  -0.002 \\
       &&& [-2.35]& [-1.70] \\[0.75ex]
R-squared &0.50&0.56&0.42&0.44 &0.54 \\
\bottomrule
\addlinespace
\end{tabular*}

\footnotesize
[1] Footnote 1: Variable~1 is calculated as \ldots \par
[2] Correlations are Pearson.

\end{table}
\end{document}
1
  • Thanks so much for this helpful reply! I really appreciate it. Now it works well. Cheers – Job Aug 16 '17 at 14:54
3

Here is the solution by looking at the manual of package caption change the \captionsetup{font=X} here X represent the font name and here is the list of font name which you can change the fonts are

  1. scriptsize --> Very small size
  2. footnotesize --> The size usually used for footnotes
  3. small --> Small size
  4. normalsize --> Normal size
  5. large --> Large size
  6. Large --> Even larger size

above fonts are presented in the manual of package caption in section no. 2.3 or page number 9.

I have used \captionsetup{font=normalsize} you can change to another font according to your desire.

     \documentclass{article}
     \usepackage[margin=2cm,paperheight=18cm]{geometry}%% only demo
     \usepackage{ltablex,booktabs,ragged2e,caption}
     \renewcommand\tabularxcolumn[1]{>{\RaggedLeft}p{#1}}
     \begin{document}

    \begin{table}[htb]
    \captionsetup{font=normalsize}
    \caption{Descriptive Statistics and Correlations for Variables}
      \begin{tabularx}{\linewidth}{l*{5}{c}}
        \toprule
        \multicolumn{5}{l}{\textbf{Panel A: Descriptive Statistics}} \\
        \midrule
     Variable  & \textbf{(1)} & \textbf{(2)} & \textbf{(3)}& \textbf{(4)} & \textbf{(5)}  \\\hline \\

    \textbf{Treat $\cdot$ Post} &\ 0.005& 0.005 &0.004&0.004&0.004  \\
    &\ [3.20]&[3.11]&[3.76]&[3.00]&[3.12]\\
    \textbf{Post} &-0.003& -0.003 & -0.002&-0.003 &-0.003   \\
    &[-5.62]&[-3.04] &[-3.79] &[-2.88]&[-3.88]\\

    \textbf{Treat} &  &&-0.002&-0.002 \\
    &&& [-2.35]& [-1.70]\\ \\ 

    \textbf{R-squared} &0.50&0.56&0.42&0.44 &0.54 \\\hline


      \end{tabularx}
     \begin{tabularx}{\linewidth}{l*{5}{c}}
        \toprule
        \multicolumn{5}{l}{\textbf{Panel B: Correlations}} \\
        \midrule
     Variable  & \textbf{(1)} & \textbf{(2)} & \textbf{(3)}& \textbf{(4)} & \textbf{(5)}  \\\hline \\

    \textbf{Treat $\cdot$ Post} &\ 0.005& 0.005 &0.004&0.004&0.004  \\
    &\ [3.20]&[3.11]&[3.76]&[3.00]&[3.12]\\
    \textbf{Post} &-0.003& -0.003 & -0.002&-0.003 &-0.003   \\
    &[-5.62]&[-3.04] &[-3.79] &[-2.88]&[-3.88]\\

    \textbf{Treat} &  &&-0.002&-0.002 \\
    &&& [-2.35]& [-1.70]\\ \\ 

    \textbf{R-squared} &0.50&0.56&0.42&0.44 &0.54 \\\hline

        \bottomrule
      \end{tabularx}

      [1]\ Footnote 1: Variable~1 is calculated as\ldots \endgraf
      [2]\ Correlations are Pearson.

    \end{table}
    \end{document}

enter image description here

2
  • Just to mention: You can of course declare a new caption font in yet another size. – TeXnician Jul 25 '17 at 3:36
  • Thanks very much for this helpful feedback. It works very well now! – Job Aug 16 '17 at 14:53

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.