我无法正确可视化下表中的公式。
1) 行高太短。我想让第一行小于接下来的 4 行。我尝试了 arraystretch,但无法正确设置
2) 我无法将公式垂直居中。我尝试了 {|m{1in}|m{1in}|...} 命令,但结果很乱
3)我想将最后一行第一个单元格的文本向左对齐,但由于它位于多行上,我无法使 \multicolumn 正常工作
\begin{table*}[h]
\caption{Electromagnetic field regions.}
\label{tab:field_regions}
\centering
\resizebox{0.7\textwidth}{!}
{%
\begin{tabular} {|c|c|c|c|}
%\toprule
\hline
\rowcolor[gray]{0.85}
\textbf{Ratio $D_a/\lambda$} & \textbf{Near field} & \textbf{Mid field} & \textbf{Far field} \\
\hline
$\displaystyle \frac{D_a}{\lambda}<1$ & $\displaystyle \frac{d}{\lambda}<1$ & - & $\displaystyle\frac{d}{\lambda}>1$ \\
\hline
$\rule{0pt}{20pt} \displaystyle 1<\frac{D_a}{\lambda}<10 $ & $\displaystyle \frac{d}{\lambda}<1.2\frac{D_a}{\lambda}$ & $\displaystyle 1.2 \frac{D_a}{\lambda}<\frac{d}{\lambda}<2\left(\frac{D_a}{\lambda}\right)^2$ & $\displaystyle \frac{d}{\lambda}>2\left(\frac{D_a}{\lambda}\right)^2 $ \\
\hline
$\displaystyle \frac{D_a}{\lambda}>10$ & $\displaystyle \frac{d}{\lambda}<\frac{1}{2} \sqrt[\leftroot{-1}\uproot{2}\scriptstyle 3]{\left(\frac{D_a}{\lambda}\right)^4} & \displaystyle \frac{1}{2}\sqrt[\leftroot{-1}\uproot{2}\scriptstyle 3]{\left(\frac{D_a}{\lambda}\right)^4}<\frac{d}{\lambda}< 2\left(\frac{D_a}{\lambda}\right)^2 $ & $\displaystyle\frac{d}{\lambda}>2\left(\frac{D_a}{\lambda}\right)$\\
\hline
\cellcolor[gray]{0.85} \makecell{\textbf{Dominant term} \\ \textbf{in the region}} & $\displaystyle \frac{1}{d^3} $ & $\displaystyle \frac{1}{d^2}$ & $\displaystyle \frac{1}{d}$ \\
\hline
\end{tabular}}\end{table*}
答案1
\documentclass{article}
\usepackage{amsmath,graphicx,colortbl,makecell}
\begin{document}
\newcommand{\addstrut}[1]{\vcenter{\hbox{\rule{0pt}{#1}}}}
\begin{table*}[!htb]
\caption{Electromagnetic field regions.}
\label{tab:field_regions}
\centering
\resizebox{0.7\textwidth}{!}
{%
\begin{tabular}{|*4{>{$\displaystyle}c<{$}|}}
%\toprule
\hline
\rowcolor[gray]{0.85}
\textbf{Ratio $D_a/\lambda$} & \textbf{Near field} & \textbf{Mid field} & \textbf{Far field} \\
\hline
\frac{D_a}{\lambda}<1 & \frac{d}{\lambda}<1 & - & \frac{d}{\lambda}>1 \addstrut{3em}\\
\hline
\rule{0pt}{20pt} \displaystyle 1<\frac{D_a}{\lambda}<10 & \frac{d}{\lambda}<1.2\frac{D_a}{\lambda} & 1.2 \frac{D_a}{\lambda}<\frac{d}{\lambda}<2\left(\frac{D_a}{\lambda}\right)^2 & \frac{d}{\lambda}>2\left(\frac{D_a}{\lambda}\right)^2 \addstrut{3em}\\
\hline
\frac{D_a}{\lambda}>10 & \frac{d}{\lambda}<\frac{1}{2} \sqrt[\leftroot{-1}\uproot{2}\scriptstyle 3]{\left(\frac{D_a}{\lambda}\right)^4} & \frac{1}{2}\sqrt[\leftroot{-1}\uproot{2}\scriptstyle 3]{\left(\frac{D_a}{\lambda}\right)^4}<\frac{d}{\lambda}< 2\left(\frac{D_a}{\lambda}\right)^2 & \frac{d}{\lambda}>2\left(\frac{D_a}{\lambda}\right) \addstrut{3.5em}\\
\hline
\cellcolor[gray]{0.85}\makecell[l]{\textbf{Dominant term}\\\textbf{in the region}} & \frac{1}{d^3} & \frac{1}{d^2} & \frac{1}{d} \addstrut{3em}\\
\hline
\end{tabular}
}
\end{table*}
\end{document}
答案2
我建议使用该包简化一些代码cellspace
,并改进布局(特别是在caption
上面的标题和表格之间提供更合理的垂直间距):
\documentclass[twocolumn]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{siunitx, caption, adjustbox, makecell, array, cellspace}
\setlength{\cellspacetoplimit}{6pt}
\setlength{\cellspacebottomlimit}{6pt}
\usepackage[table]{xcolor}
\begin{document}
\begin{table*}[h]
\caption{Electromagnetic field regions.}
\label{tab:field_regions}
\centering
\resizebox{0.7\textwidth}{!}
{\everymath{\displaystyle}%
\begin{tabular} {|*{4}{Cc|}}
\hline
\rowcolor[gray]{0.85}
\textbf{Ratio \boldmath$D_a/\lambda$} & \textbf{Near field} & \textbf{Mid field} & \textbf{Far field} \\
\hline
$\frac{D_a}{λ} < 1$ & $ \frac{d}{λ} < 1$ & $-$ & $\frac{d}{λ} > 1$ \\
\hline
$\rule{0pt}{20pt} 1 < \frac{D_a}{λ} < 10 $ & $ \frac{d}{λ} < 1.2\,\frac{D_a}{λ}$ & $ 1.2\, \frac{D_a}{λ} < \frac{d}{λ} < 2\left(\frac{D_a}{λ}\right)^{\mkern-5mu 2}$ & $ \frac{d}{λ} > 2\left(\frac{D_a}{λ}\right)^{\mkern-5mu 2} $ \\
\hline
$ \frac{D_a}{λ} > 10$ & $ \frac{d}{λ} < \frac{1}{2} √[\leftroot{-1}\uproot{2}\scriptstyle 3]{\left(\frac{D_a}{λ}\right)^{\mkern-5mu 4}}$ & $ \frac{1}{2}√[\leftroot{-1}\uproot{2}\scriptstyle 3]{\left(\frac{D_a}{λ}\right)^{\mkern-5mu 4}} < \frac{d}{λ} < 2\left(\frac{D_a}{λ}\right)^{\mkern-5mu 2} $ & $\frac{d}{λ} > 2\left(\frac{D_a}{λ}\right)$\\
\hline
\cellcolor[gray]{0.85} \makecell{\textbf{Dominant term} \\ \textbf{in the region}} & $ \frac{1}{d³} $ & $ \frac{1}{d²}$ & $ \frac{1}{d}$ \\
\hline
\end{tabular}}\end{table*}
\end{document}