我希望表格中的标题和文本的字体大小均为 9。但是,如下所示,表格文本更大。以前的答案建议使用,\resizebox{\textwidth}
但这样只会使文本适合空间宽度,而不会将其更改为特定的字体大小?有没有办法可以选择表格中的所有文本并将其设置为fontsize=small
?(使用\selectfont
?)。请下载此文件以运行代码点击我. 感谢您的时间。
\documentclass{article}
\usepackage{ijcai17}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{verbatim}
\usepackage{booktabs}
\usepackage{adjustbox}
\usepackage{caption}
\begin{document}
\section{Test}
Test document
\begin{table}[h!]
\captionsetup{font=small}
\centering
\caption{AUC values for LR, LR-Regularized, RF-Default, RF-FS for 1s, 3s, 5s, 10s segment lengths and 2-class problems.}
\label{table:2}
\resizebox{0.47\textwidth}{!}{%
%\begin{adjustbox}{max width=\textwidth}
\begin{tabular}{c||c|c|c|c}
\toprule
& 1s & 3s & 5s & 10s\\
\hline
LR & $0.9223$ & $0.9895$ & $0.9840$ & $0.9913$ \\ \hline
LR-Regularized & $0.9207$ & $0.9887$ & $0.9928$ & $0.9863$ \\ \hline
RF-Default & $0.9072$ & $0.9767$ & $0.9634$ & $0.9735$ \\ \hline
RF-FS & $0.9075$ & $0.9760$ & $0.9681$ & $0.9740$ \\
\bottomrule
\end{tabular}%
}
\end{table}
\end{document}
答案1
如果您尝试此 MWE,您会发现标题和表格内容具有相同的字体大小。更改Large
为small
可获得 9pt 字体。
\documentclass{article}
%\usepackage{ijcai17}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{verbatim}
\usepackage{booktabs}
\usepackage{adjustbox}
\usepackage{caption}
\begin{document}
\section{Test}
Test document
\begin{table}[h!]
\Large
\captionsetup{font=Large}
\centering
\caption{ AUC values for LR, LR-Regularized, RF-Default, RF-FS for 1s, 3s, 5s, 10s segment lengths and 2-class problems.}
\label{table:2}
%\resizebox{0.47\textwidth}{!}{%
\begin{tabular}{c||c|c|c|c}
\toprule
& 1s & 3s & 5s & 10s\\
\hline
LR & $0.9223$ & $0.9895$ & $0.9840$ & $0.9913$ \\ \hline
LR-Regularized & $0.9207$ & $0.9887$ & $0.9928$ & $0.9863$ \\ \hline
RF-Default & $0.9072$ & $0.9767$ & $0.9634$ & $0.9735$ \\ \hline
RF-FS & $0.9075$ & $0.9760$ & $0.9681$ & $0.9740$ \\
\bottomrule
\end{tabular}%
%}
\end{table}
\end{document}