我用了www.tablesgenerator.com创建表:
\documentclass{article}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{graphicx}
\begin{document}
\begin{table}[htbp]
\centering
\resizebox{\textwidth}{!}{%
\begin{tabular}{|l|l|l|l|ll|l|l|}
\hline
\multirow{2}{*}{\textbf{\begin{tabular}[c]{@{}l@{}}Event and Phenomena \\ of Interest\end{tabular}}} & \multirow{2}{*}{\textbf{Path}} & \multirow{2}{*}{\textbf{Frequency}} & \multirow{2}{*}{\textbf{Dataset}} & \multicolumn{2}{l|}{\textbf{Raytracing Simulation}} & \multirow{2}{*}{\textbf{Observations}} & \multirow{2}{*}{\textbf{Results}} \\ \cline{5-6}
& & & & \multicolumn{1}{l|}{Model} & Citation & & \\ \hline
\begin{tabular}[c]{@{}l@{}}August 2017 Solar Eclipse:\\ Solar eclipse obscuration\end{tabular} & WWV → WA9VNJ & 10 MHz & \cite{WA9VNJ} & \multicolumn{1}{l|}{SAMI3} & \cite{wa9vnj-sami3} & Section \ref{sec:obs_eclipse} & Section \ref{sec:results_eclipse} \\ \hline
\begin{tabular}[c]{@{}l@{}}October 2019 Festival of\\ Frequency Measurement:\\ Morning transition\end{tabular} & WWV → WA5FRF & 5 MHz & \cite{wa5frf-ffm-spectrumlab} & \multicolumn{1}{l|}{IRI} & \cite{wa5frf-iri-ffm} & Section \ref{sec:obs_ffm} & Section \ref{sec:results_ffm} \\ \hline
\begin{tabular}[c]{@{}l@{}}January 2020 Timing Study:\\ Multipath propagation\end{tabular} & WWV → WA5FRF & 5 MHz & \cite{wa5frf-timing} & \multicolumn{1}{l|}{IRI} & \cite{wa5frf-iri-jan20} & Section \ref{sec:obs_timing} & Section \ref{sec:results_timing} \\ \hline
\end{tabular}%
}
\caption{An overview of the datasets and raytracing simulation results used in this paper, and the sections in which they are referenced.}
\label{tab:overview}
\end{table}
\end{document}
...但顶行有空隙:
我怎样才能摆脱它们?
编辑:哇,这些新版本很漂亮。谢谢大家。
答案1
还有一个建议:使用tabularray
包,将字体大小减小到\small
:
\documentclass{article}
\usepackage{tabularray} % new
\UseTblrLibrary{booktabs} % new
\begin{document}
\begin{table}[ht]
\caption{An overview of the data sets and ray tracing simulation results used in this paper, with the sections in which they are referenced.}
\label{tab:overview}
\small
\begin{tblr}{colsep=3pt,
colspec = {@{} X[1.2,l,m,font=\linespread{0.84}\selectfont]
X[0.5, c,m] *{6}{l} @{}},
row{1,2} = {font=\small\bfseries}
}
\toprule
\SetCell[r=2]{l} Event and Phenomena of Interest
& & & \SetCell[r=2]{c,f} {Data\\ set}
& \SetCell[c=2]{c} Raytracing Sim.
& & & \\
\cmidrule[lr]{5-6}
& Path
& Freq.
& & Model
& Citat.%ion
& Observ.%vation
& Results \\
\midrule
August 2017 Solar Eclipse: Solar eclipse obscuration
& WWV → WA9VNJ
& 10 MHz
& \cite{WA9VNJ}
& SAMI3
& \cite{wa9vnj-sami3}
& Sec.~\ref{sec:obs_eclipse}
& Sec.~\ref{sec:results_eclipse} \\
October 2019 Festival of Frequency Measurement: Morning transition
& WWV → WA5FRF
& 5 MHz
& \cite{wa5frf-ffm-spectrumlab}
& IRI
& \cite{wa5frf-iri-ffm}
& Sec.~\ref{sec:obs_ffm}
& Sec.~\ref{sec:results_ffm} \\
January 2020 Timing Study: Multipath propagation
& WWV → WA5FRF
& 5 MHz
& \cite{wa5frf-timing}
& IRI
& \cite{wa5frf-iri-jan20}
& Sec.~\ref{sec:obs_timing}
& Sec.~\ref{sec:results_timing} \\
\bottomrule
\end{tblr}
\end{table}
\end{document}
附录
表格非常大,因此列宽有点太窄,无法在单元格中很好地显示文本格式。如果可以定义更宽的文本宽度,例如宽度加载
\usepackage{geometry}
在文档序言中,即使使用正常大小的字体,表格也会变得更具吸引力:
答案2
不使用\resizebox
,切换到tabualarx
环境,尽可能应用合理的缩写,去掉所有垂直线,加载和使用booktabs
包的机制,不使用粗体在标题行中,撤消您提到的外部软件插入的代码混乱会导致以下结果:
\documentclass{article}
\usepackage{tabularx,multirow}
%% new:
\usepackage[T1]{fontenc}
\usepackage[a4paper,margin=2.5cm]{geometry} % set paper size and margins as needed
\usepackage{newtxtext,newtxmath} % optional (Times Roman clone)
\usepackage{booktabs,amsmath}
\newcommand\mycell[1]{\smash[b]{%
\begin{tabular}[t]{@{} >{\raggedright\arraybackslash}p{\hsize} @{}} #1 \end{tabular}}}
\begin{document}
\begin{table}[htbp]
%\small
\begin{tabularx}{\textwidth}{@{} >{\raggedright}X *{7}{l} @{}}
\toprule
\mycell{Event and Phenomena of Interest}
& Path & Freq. & Dataset & \multicolumn{2}{c}{Raytracing Sim.} & Obs. & Results \\
\cmidrule(lr){5-6}
& & & & Model & Cit. & & \\
\midrule
August 2017 Solar Eclipse: Solar eclipse obscuration
& WWV → WA9VNJ & 10 MHz & \cite{WA9VNJ} & SAMI3 & \cite{wa9vnj-sami3}
& Sec.\ \ref{sec:obs_eclipse} & Sec.\ \ref{sec:results_eclipse} \\
\addlinespace
October 2019 Festival of Frequency Measurement: Morning transition
& WWV → WA5FRF & 5 MHz & \cite{wa5frf-ffm-spectrumlab} & IRI & \cite{wa5frf-iri-ffm}
& Sec.\ \ref{sec:obs_ffm} & Sec.\ \ref{sec:results_ffm} \\
\addlinespace
January 2020 Timing Study: Multipath propagation
& WWV → WA5FRF & 5 MHz & \cite{wa5frf-timing} & IRI & \cite{wa5frf-iri-jan20}
& Sec.\ \ref{sec:obs_timing} & Sec.\ \ref{sec:results_timing} \\
\bottomrule
\end{tabularx}
\caption{An overview of the datasets and raytracing simulation results used in this paper, with the sections in which they are referenced.}
\label{tab:overview}
\end{table}
\end{document}
答案3
这与 Mico 的答案在精神上类似,用于threeparttable
减少表头中的一些开销,并tabularx
自动设置第一列的大小。此外,我们将“路径”、“数据集”和“引用”列的大小设置为固定宽度,以允许在这些列中换行。
根据文档的可用宽度,您可能需要将字体大小从 更改\footnotesize
为\small
,甚至删除开关以获取正常大小。
\documentclass[]{article}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{tabularx}
\usepackage{array}
\usepackage{ragged2e}
\usepackage{threeparttable}
% column type to get a column of the width of specified text
\newcolumntype{T}[1]{}
\makeatletter
\renewcommand\NC@rewrite@T[1]
{%
\begingroup
\sbox0{#1}%
\expandafter
\endgroup
\expandafter\@temptokena\expandafter
{%
\the\expandafter\@temptokena
\expandafter p\expandafter{\the\wd0}%
}%
\NC@find
}
\makeatother
% shortcut to get left aligned p, X, etc.
\newcolumntype{L}{>{\RaggedRight\arraybackslash}}
\newcommand*\mcell[2][t]{\begin{tabular}[#1]{@{}l@{}}#2\end{tabular}}
\begin{document}
\begin{table}
\centering
\footnotesize
\tabcolsep=.5\tabcolsep
\begin{threeparttable}
\caption
{%
An overview of the datasets and raytracing simulation results used in
this paper, and the sections in which they are referenced%
\label{tab:overview}%
}
\begin{tabularx}{\linewidth}
{ @{} LX LT{WA9VNJ} S LT{Dataset} l LT{Citation\tnote{a}} c c @{} }
\toprule
Event and Phenomena of Interest
& Path & {\mcell{Frequency\\in \unit{\mega\hertz}}} & Dataset
& Model\tnote{a} & Citation\tnote{a} & \mcell{Obser-\\vations\tnote{b}}
& Results\tnote{b} \\
\midrule
August 2017 Solar Eclipse: Solar eclipse obscuration
& WWV $\rightarrow$ WA9VNJ & 10 & \cite{WA9VNJ}
& SAMI3 & \cite{wa9vnj-sami3} & \ref{sec:obs_eclipse}
& \ref{sec:results_eclipse} \\
\addlinespace
October 2019 Festival of Frequency Measurement: Morning transition
& WWV $\rightarrow$ WA5FRF & 5 & \cite{wa5frf-ffm-spectrumlab}
& IRI & \cite{wa5frf-iri-ffm} & \ref{sec:obs_ffm}
& \ref{sec:results_ffm} \\
\addlinespace
January 2020 Timing Study: Multipath propagation
& WWV $\rightarrow$ WA5FRF & 5 & \cite{wa5frf-timing}
& IRI & \cite{wa5frf-iri-jan20} & \ref{sec:obs_timing}
& \ref{sec:results_timing} \\
\bottomrule
\end{tabularx}
\begin{tablenotes}
\item[a] of raytracing simulation
\item[b] section in this paper
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
结果(我手动输入了您的参考资料的数据以获得此图像):