如何根據 Resizebox 內的字體大小精確縮小 Resizebox 外的字體大小?

如何根據 Resizebox 內的字體大小精確縮小 Resizebox 外的字體大小?

以下最小工作範例resizebox是一個 long tabularto textwidth,但上面的標題和句子tabular並未相應縮小。我想知道是否有一種方法可以精確縮小這些標題和引用 中字體大小的句子resizebox,而不是small下面的天真。感謝您的幫忙!

\documentclass{article}

\usepackage{graphicx}
\usepackage[font=normalsize]{subcaption}

\begin{document}

\begin{table}

% How could one exactly downsize this caption?
\caption{\small This is a caption.}

% How could one exactly downsize these sentences?
{\small This is sentence 1. This is sentence 2. This is sentence 3.
This is sentence 4. This is sentence 5. This is sentence 6.\par}

% based on the font size inside this resizebox
\resizebox{\textwidth}{!}{
\subcaptionbox{This is a subcaption.}{
\begin{tabular}{*{12}c}\hline
1.1111&2.2222&3.3333&4.4444&5.5555&6.6666&
7.7777&8.8888&9.9999&0.0000&1.1111&2.2222\\
1.1111&2.2222&3.3333&4.4444&5.5555&6.6666&
7.7777&8.8888&9.9999&0.0000&1.1111&2.2222\\\hline
\end{tabular}
}
}

\end{table}

\end{document}

答案1

抱歉,您的範例中有一些不好的想法:

  1. 縮放表是不好的,因為您無法控制最終結果。

  2. 即使您縮小表格中的字體大小以適應,標題也應該與所有其他標題一樣。

  3. \caption切勿使用內部的字體更改命令。

不過,我並不反對縮放副標題中的字體。

\documentclass{article}
\usepackage[font=normalsize]{subcaption}
\usepackage{booktabs}

\begin{document}

\begin{table}[htp]

\caption{This is a caption.}

\captionsetup[subtable]{font=footnotesize}
\subcaptionbox{This is a subcaption.}{%
  \footnotesize
  \setlength{\tabcolsep}{0pt}%
  \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}*{12}c}
  \toprule
  1.1111 & 2.2222 & 3.3333 & 4.4444 & 5.5555 & 6.6666 &
    7.7777 & 8.8888 & 9.9999 & 0.0000 & 1.1111 & 2.2222 \\
  1.1111 & 2.2222 & 3.3333 & 4.4444 & 5.5555 & 6.6666 &
    7.7777 & 8.8888 & 9.9999 & 0.0000 & 1.1111 & 2.2222 \\
  \bottomrule
\end{tabular*}%
}
\end{table}

\end{document}

在此輸入影像描述

相關內容