[Tex/LaTex] Change font size within table

tablestabularxtabulary

I have this code:

\documentclass[11pt]{article}
\usepackage[margin=2.5cm, showframe]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{setspace}
\usepackage{lipsum}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{siunitx}
\usepackage[skip=0.33\baselineskip]{caption}
\captionsetup[table]{
    font=bf,
    size=normalsize,
    justification=centerlast,
    labelsep=newline
    }
\renewcommand\thetable{\Roman{table}}

\begin{document}
\def\arraystretch{1.25}
\begin{sidewaystable}[ht]
\centering
\setlength\tabcolsep{0pt}
\sisetup{table-format=2.2, group-separator={,}, group-minimum-digits=4}
\caption{\large{A Stylish Table Header with Important Knowledge}}
\parbox{\linewidth}{\small\lipsum[1]\vspace{2ex}}
\medskip
%\resizebox{\columnwidth}{!}{
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
                c
                S[table-format=-2.2]
                *{9}{S}
                }
\toprule
&\multicolumn{3}{c}{Model 1}&\multicolumn{3}{c}{Model 2}&
\multicolumn{3}{c}{Model 3}\\
\cline{2-4}\cline{5-7}\cline{8-10}
{Pct}&{Sim}&{Act}&{Com}&{Sim}&{Act}&{Com}&{Sim}&{Act}&{Com}\\\midrule
\multicolumn{10}{l}{Panel A: Some text}\\\midrule
A   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
B   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
C   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
D   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
E   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
F   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
G   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
H   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
I   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
J   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
K   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
L   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
M   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
N   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
O   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
P   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
Q   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
R   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
S   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
\bottomrule
\multicolumn{10}{r}{\textit{(continued)}}\\
\end{tabular*}
%} % end of resizebox
\end{sidewaystable}
\end{document}

which produces this table:

table

As shown in the picture, the header Table I and the bottom note (continued) are placed outside of the frame due to the table's size. Is it possible to resize (either manually or automatically) the font size only within the table?

I have already looked at this and this, and I know that my question is, at the very least, close to a duplicate.

However, I can't seem to make the answers from those questions work in my case. I tried to manually set the font size to small with {\small ...}, and I also tried the automatic approach with \resizebox. \resizebox was unable to include the Table I header within the frame, and I have noticed that many users on this site advise against this method.

Best Answer

In order to use a smaller font size for the table only, you could insert the \footnotesize command just before \begin{tabular} as shown in the following MWE. That way, everything until \end{sidewaystable} will be in the smaller fontsize. If you want 'continued' to be in normalsize instead, you can also use \multicolumn{10}{r}{\normalsize\textit{(continued)}}.

\documentclass[11pt]{article}
\usepackage[margin=2.5cm, showframe]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{setspace}
\usepackage{lipsum}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{siunitx}
\usepackage[skip=0.33\baselineskip]{caption}
\captionsetup[table]{
    font=bf,
    size=normalsize,
    justification=centerlast,
    labelsep=newline
    }
\renewcommand\thetable{\Roman{table}}

\begin{document}
\def\arraystretch{1.25}
\begin{sidewaystable}[ht]
\centering
\setlength\tabcolsep{0pt}
\sisetup{table-format=2.2, group-separator={,}, group-minimum-digits=4}
\caption{\large{A Stylish Table Header with Important Knowledge}}
\parbox{\linewidth}{\small\lipsum[1]\vspace{2ex}}
\medskip
\footnotesize
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
                c
                S[table-format=-2.2]
                *{9}{S}
                }
\toprule
&\multicolumn{3}{c}{Model 1}&\multicolumn{3}{c}{Model 2}&
\multicolumn{3}{c}{Model 3}\\
\cline{2-4}\cline{5-7}\cline{8-10}
{Pct}&{Sim}&{Act}&{Com}&{Sim}&{Act}&{Com}&{Sim}&{Act}&{Com}\\\midrule
\multicolumn{10}{l}{Panel A: Some text}\\\midrule
A   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
B   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
C   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
D   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
E   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
F   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
G   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
H   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
I   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
J   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
K   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
L   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
M   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
N   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
O   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
P   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
Q   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
R   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
S   &11.11  &22.22  &33.33  &44.44  &55.55  &66.66  &77.77  &88.88  &99.99\\
\bottomrule
\multicolumn{10}{r}{\textit{(continued)}}\\
\end{tabular*}
\end{sidewaystable}
\end{document}
Related Question