
我需要增加表格中條目的字體大小。根據之前的一些問題TEX.SE
,在開始環境之前添加字體大小命令(例如 \large)之類的潛在解決方案tabular
必須有效。但就我而言,這樣的命令沒有任何改變。我應該如何修復它?
\documentclass[letterpaper, 10pt]{IEEEconf}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{booktabs}
\title{My Title*}
\author{Guy$^{1}$
\thanks{*This work was not supported by any organization}% <-this % stops a space
\thanks{$^{1}$Guy is with Hell, {\tt\small [email protected]}}%
}
\begin{document}
\maketitle
\thispagestyle{empty}
\pagestyle{empty}
\begin{abstract}
ABSTRACT
\end{abstract}
\section{INTRODUCTION}
\begin{table}[h!]
\centering
\caption{Caption for the table.}
\label{tab:table3}
\resizebox{\columnwidth}{!}{%
\LARGE ------> It affects nothing
\begin{tabular}{ccccccccc}
\toprule
$$ & $S^{h}(\theta^{h})$ & $S^{h}(\theta^{h})$ & $S^{h}(\theta^{h})$ & $S^{h}(\theta^{h})$ & $S^{v}(\theta^{v})$ & $^{v}(\theta^{v})$ & $S^{v}(\theta^{v})$ & $S^{v}(\theta^{v})$\\
\midrule
$S^{h}(\theta^{h})$ & occupied & & & & & &\\[0.5em]
$S^{h}(\theta^{h})$ & & & & & & &\\[0.5em]
$S^{h}(\theta^{h})$ & & & occupied & & & &\\[0.5em]
$S^{h}(\theta^{h})$ & & & & & & &\\[0.5em]
$S^{v}(\theta^{v})$ & & & & & & &\\[0.5em]
$S^{v}(\theta^{v})$ & & & & & occupied & &\\[0.5em]
$S^{v}(\theta^{v})$ & & & & & & &\\[0.5em]
$S^{v}(\theta^{v})$ & & & & & & & occupied\\
\bottomrule
\end{tabular}
}
\end{table}
\end{document}
答案1
你不想\LARGE
,但是\footnotesize
。對真的!
問題是您建立一個大表,然後將其大小調整為列寬:即使您這樣做\HUMONGOUSLYHUGE
,結果也將完全相同。
請記住:切勿\resizebox
在餐桌上這樣做。根據需要製作它。
在這種情況下,\footnotesize
似乎是合理的,同時減少了列間空間並用可以在文本中解釋的符號更改了大的「佔用」。
為了輸入表格,我使用了一些本地簡寫:我並不建議在整個文件中使用 ,但僅對於這個大表,簡寫有助於提高程式碼的可讀性\STh
。S^{h}(\theta^{h})
我如何確定 的值\addtolength
?我在沒有它的情況下排版了表格,結果超出了 73.22162pt。由於有 16 個列間填充,因此我將數量除以 16 並四捨五入到第一位小數。
順便一提:\tt
二十多年來,這個命令一直被棄用。使用\ttfamily
或“命令形式” \texttt
。
\documentclass[letterpaper, 10pt]{IEEEconf}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{lipsum}
\title{My Title*}
\author{Guy$^{1}$
\thanks{*This work was not supported by any organization}% <-this % stops a space
\thanks{$^{1}$Guy is with Hell, {\ttfamily\small [email protected]}}%
}
\begin{document}
\maketitle
\thispagestyle{empty}
\pagestyle{empty}
\begin{abstract}
ABSTRACT
\end{abstract}
\section{INTRODUCTION}
\lipsum[2]
\begin{table}[htp]
\caption{Caption for the table.}
\label{tab:table3}
%%% Local shorthands
\newcommand{\STh}{$S^{h}(\theta^{h})$}
\newcommand{\STv}{$S^{v}(\theta^{v})$}
%%% The definition of \occ could be in the preamble,
%%% if you use it also in other tables
\newcommand{\occ}{$\times$} % <--- change to your liking
\centering\footnotesize
%%% do the computation only at the very last moment
\addtolength{\tabcolsep}{-4.7pt}
\begin{tabular}{@{}*{9}{c}@{}}
\toprule
& \STh & \STh & \STh & \STh & \STv & \STv & \STv & \STv\\
\midrule
\STh & \occ & & & & & &\\
\STh & & & & & & &\\
\STh & & & \occ & & & &\\
\STh & & & & & & &\\
\STv & & & & & & &\\
\STv & & & & & \occ & &\\
\STv & & & & & & &\\
\STv & & & & & & & \occ\\
\bottomrule
\end{tabular}
\end{table}
\lipsum
\end{document}
答案2
由於指令的存在,嘗試使用諸如 之類的指令來放大字體大小\large
在您的設定中是完全弄巧成拙的\resizebox
。
你需要走另一條路。我建議您採取以下步驟:
不要寫“佔用”,而是寫“occ.”,這樣單元格內容佔用的空間就更少。
寫起來
S^{h}(\theta^{h})
又S^{v}(\theta^{v})
佔用不少空間。在下面的程式碼中,我建議您更緊湊地排版這些術語。減少列間空白的數量。預設數量(2*6pt)相當慷慨。
\tabcolsep
我建議您不要以試錯的方式調整參數,而是0pt
立即設定它並使用tabular*
環境而不是環境tabular
。這樣,LaTeX 將計算出最佳(即最大可用)空白量。
完成這些調整後,您需要做的就是將表格的字體大小設為\small
.以下螢幕截圖提供了前後比較;我相信“之後”表或多或少是您希望實現的目標。
\documentclass[letterpaper,10pt]{IEEEconf}
\usepackage{booktabs,graphicx}
\usepackage[skip=0.333\baselineskip,font={bf,sf}]{caption}
\newcommand\Sth[1]{S^{#1}\mkern-3mu(\mkern-2.5mu\theta^{\mkern-1mu#1}\mkern-2mu)}
\begin{document}
\section{Introduction}
\hrule % just to illustrate width of textblock
%%%% First the "before" look
\begin{table}[h!]
\centering
\caption{Before}
\label{tab:table3}
\resizebox{\columnwidth}{!}{%
\LARGE % ------> It affects nothing
\begin{tabular}{ccccccccc}
\toprule
$$ & $S^{h}(\theta^{h})$ & $S^{h}(\theta^{h})$ & $S^{h}(\theta^{h})$ & $S^{h}(\theta^{h})$ & $S^{v}(\theta^{v})$ & $^{v}(\theta^{v})$ & $S^{v}(\theta^{v})$ & $S^{v}(\theta^{v})$\\
\midrule
$S^{h}(\theta^{h})$ & occupied & & & & & &\\[0.5em]
$S^{h}(\theta^{h})$ & & & & & & &\\[0.5em]
$S^{h}(\theta^{h})$ & & & occupied & & & &\\[0.5em]
$S^{h}(\theta^{h})$ & & & & & & &\\[0.5em]
$S^{v}(\theta^{v})$ & & & & & & &\\[0.5em]
$S^{v}(\theta^{v})$ & & & & & occupied & &\\[0.5em]
$S^{v}(\theta^{v})$ & & & & & & &\\[0.5em]
$S^{v}(\theta^{v})$ & & & & & & & occupied\\
\bottomrule
\end{tabular}
}
\end{table}
%%%% Now the "after" look
\begin{table}[h!]
\captionsetup{font={small,bf,sf}} % optional
\small
\caption{After} \label{tab:table3}
\setlength\tabcolsep{0pt} % make LaTeX calculate intercolumn whitespace
\begin{tabular*}{\columnwidth}{@{\extracolsep{\fill}} ccccccccc}
\toprule
& $\Sth{h}$ & $\Sth{h}$ & $\Sth{h}$ & $\Sth{h}$ & $\Sth{\nu}$ & $\Sth{\nu}$ & $\Sth{\nu}$ & $\Sth{\nu}$\\
\midrule
$\Sth{h}$ & occ. & & & & & &\\
$\Sth{h}$ & & & & & & &\\
$\Sth{h}$ & & & occ. & & & &\\
$\Sth{h}$ & & & & & & &\\
$\Sth{\nu}$ & & & & & & &\\
$\Sth{\nu}$ & & & & & occ. & &\\
$\Sth{\nu}$ & & & & & & &\\
$\Sth{\nu}$ & & & & & & & occ.\\
\bottomrule
\end{tabular*}
\end{table}
\end{document}