为什么上表中的字比下表中的字大?
如何才能使它与下表中的字一样大(使其变小)?
\documentclass[journal]{IEEEtran}
\usepackage{blindtext}
\usepackage{booktabs,capt-of}
\usepackage{graphicx}
\begin{document}
\blindtext
\begin{figure}
\begin{minipage}[b]{0.5\linewidth}
\centering
\rule{30pt}{40pt}
\caption{A figure}
\vspace{0pt}
\end{minipage}%
\begin{minipage}[b]{0.5\columnwidth}
\centering
\captionof{table}{A table}
\begin{tabular}{c*{4}{p{0.125\linewidth}}}
\toprule
&\multicolumn{3}{c}{NUMBER} \\
\cmidrule(lrr){2-4}
NO & \textbf{1} & \textbf{2} & \textbf{3} \\\midrule
H & K\textsubscript{NI} & K\textsubscript{NOT} & NDG \\\midrule
K & K\textsubscript{NOT} & K\textsubscript{NI} & NDG \\\midrule
C & NDG & K\textsubscript{NI} & K\textsubscript{NOT} \\\midrule
D & NDG & K\textsubscript{NOT} & K\textsubscript{NI} \\\midrule
L & K\textsubscript{NOT} & NDG & K\textsubscript{NI} \\\midrule
M & K\textsubscript{NI} & NDG & K\textsubscript{NOT} \\\bottomrule
\end{tabular}
\vspace{0pt}
\end{minipage}
\end{figure}
\begin{table}[!t]
\centering
\caption{ANOTHER TABLE}
\label{tab:table7}
\begin{tabular}{ c c c }
\toprule
A & B& C\\ \midrule
1000 & K\textsubscript{NOT} & NDG \\ \bottomrule
\end{tabular}
\end{table}
\end{document}
答案1
由于文档类设计者最清楚的原因IEEEtran
,环境的内容table
会自动呈现为\footnotesize
——字体大小线性减少 20%——而环境的内容figure
不会经过这种处理。
也就是说,下面截图中的第一个表嵌入在环境中figure
,而第二个表嵌入在table
环境中。请注意,两个环境的内容tabular
是完全相同的。
\documentclass[journal]{IEEEtran}
\usepackage{booktabs,capt-of}
\begin{document}
\hrule % just to illustrate width of column
\begin{figure}[ht]
\centering
\captionof{table}{A table in a figure environment}
\begin{tabular}{cccc}
\toprule
&\multicolumn{3}{c}{NUMBER} \\
\cmidrule(l){2-4}
NO & \textbf{1} & \textbf{2} & \textbf{3} \\ \midrule
H & K\textsubscript{NI} & K\textsubscript{NOT} & NDG \\ \midrule
K & K\textsubscript{NOT} & K\textsubscript{NI} & NDG \\ \midrule
M & K\textsubscript{NI} & NDG & K\textsubscript{NOT} \\ \bottomrule
\end{tabular}
\end{figure}
% same 'tabular' environment, but not embedded in a 'table' env.
\begin{table}[ht]
\centering
\caption{A table in a table environment}
\begin{tabular}{cccc}
\toprule
&\multicolumn{3}{c}{NUMBER} \\
\cmidrule(l){2-4}
NO & \textbf{1} & \textbf{2} & \textbf{3} \\ \midrule
H & K\textsubscript{NI} & K\textsubscript{NOT} & NDG \\ \midrule
K & K\textsubscript{NOT} & K\textsubscript{NI} & NDG \\ \midrule
M & K\textsubscript{NI} & NDG & K\textsubscript{NOT} \\ \bottomrule
\end{tabular}
\end{table}
\hrule % just to illustrate width of column
\end{document}
答案2
这是我对 IEEE 可能接受的内容的想法。首先,我将图像做得尽可能大(减去间隙\tabcolsep
)。我将表格标题单独放在表格上方。我将图形和表格并排放置。然后我将图形标题单独放在图像下方。
我展示了如何处理图像宽度受限或高度受限的情况。
\documentclass[journal]{IEEEtran}
\usepackage{blindtext}
\usepackage{booktabs,capt-of}
\usepackage{graphicx}
\begin{document}
\blindtext
\begin{table}[ht]
% first measure the width of the tabular
\sbox0{\begin{tabular}[b]{cccc}
\toprule
&\multicolumn{3}{c}{NUMBER} \\
\cmidrule(lrr){2-4}
NO & \textbf{1} & \textbf{2} & \textbf{3} \\\midrule
H & K\textsubscript{NI} & K\textsubscript{NOT} & NDG \\\midrule
K & K\textsubscript{NOT} & K\textsubscript{NI} & NDG \\\midrule
C & NDG & K\textsubscript{NI} & K\textsubscript{NOT} \\\midrule
D & NDG & K\textsubscript{NOT} & K\textsubscript{NI} \\\midrule
L & K\textsubscript{NOT} & NDG & K\textsubscript{NI} \\\midrule
M & K\textsubscript{NI} & NDG & K\textsubscript{NOT} \\\bottomrule
\end{tabular}}%
% place image and table with caption side-by-side
\includegraphics[width={\dimexpr \columnwidth-\wd0-\tabcolsep}]{example-image}\hfill
\begin{minipage}[b]{\wd0}
\caption{A table}
\usebox0
\end{minipage}\par
% place figure caption alone on the bottom
\begin{minipage}{\dimexpr \columnwidth-\wd0-\tabcolsep}
\captionof{figure}{A figure}
\end{minipage}
\end{table}
\begin{table}[ht]
% first measure the height of the tabular
\sbox0{\begin{tabular}[t]{cccc}
\toprule
&\multicolumn{3}{c}{NUMBER} \\
\cmidrule(lrr){2-4}
NO & \textbf{1} & \textbf{2} & \textbf{3} \\\midrule
H & K\textsubscript{NI} & K\textsubscript{NOT} & NDG \\\midrule
K & K\textsubscript{NOT} & K\textsubscript{NI} & NDG \\\midrule
C & NDG & K\textsubscript{NI} & K\textsubscript{NOT} \\\midrule
D & NDG & K\textsubscript{NOT} & K\textsubscript{NI} \\\midrule
L & K\textsubscript{NOT} & NDG & K\textsubscript{NI} \\\midrule
M & K\textsubscript{NI} & NDG & K\textsubscript{NOT} \\\bottomrule
\end{tabular}}%
% place table caption alone on top
\null\hfill
\begin{minipage}{0.5\columnwidth}
\caption{A table}
\hrule height0pt% to keep \belowcaptionskip from being eaten
\end{minipage}\par
% place image (with caption) and tabular side-by-side
\begin{minipage}[t]{0.5\columnwidth}
\centering
\raisebox{-\height}{\includegraphics[height={\dimexpr \ht0+\dp0}]{example-image-10x16}}
\captionof{figure}{A figure}
\end{minipage}%
\begin{minipage}[t]{0.5\columnwidth}
\centering
\usebox0
\end{minipage}
\end{table}
\end{document}