[Tex/LaTex] Change of caption size

captionstables

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}

Best Answer

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}