我的MWE如下:
\documentclass[conference]{IEEEtran}
\usepackage{color}
\newcommand{\red}[1]{\textcolor{red}{#1}}
\newcommand{\mycomment}[2]{\textcolor{red}{#1: #2}}
\newcommand{\tb}[1]{\mycomment{TB}{#1}}
\newcommand{\ma}[1]{\mycomment{MA}{#1}}
\newcommand{\sr}[1]{\mycomment{SR}{#1}}
\newcommand{\ta}[1]{\mycomment{TA}{#1}}
\usepackage{array}
\usepackage{tabularx}
\usepackage{subcaption,siunitx,booktabs}
\usepackage[margin=1in]{geometry}
\usepackage{multirow, makecell}
\usepackage{array}
\setlength\extrarowheight{2pt}
\begin{document}
\begin{table*}
\begin{subtable}{1\textwidth}
\centering
\begin{tabular}{|l|l|l|l|}
\hline
\multirow{2}{*}{Dataset} &
\multicolumn{2}{c|}{A} & \\
& O.B.R & A.R
& {Dataset2}\\
\hline
D1 & 2.1\% & 2.1\% & D11 \\
\hline
D2 & 11.6\% & 11.6\% & D21\\
\hline
D3 & 5.5\% & 5.5\% & D31\\
\hline
\end{tabular}
\caption{First subtable1}\label{tab:sub_first1}
\end{subtable}
\caption{Three simple tables} \label{tab:three_tables}
\end{table*}
\end{document}
为什么文本“Dataset2”与“Dataset”不一样?为什么会有换行符?
我尝试{Dataset2}
用替换\multirow{2}{*}{Dataset}
。但是,它会将文本推到更下方,如下面的屏幕截图所示:
我不知道我哪里做错了?
答案1
Bernard 已在他的评论中回答。但是,既然您已加载booktabs
和siunitx
,请使用它们并摆脱垂直规则!
\documentclass[conference]{IEEEtran}
\usepackage{color}
\newcommand{\red}[1]{\textcolor{red}{#1}}
\newcommand{\mycomment}[2]{\textcolor{red}{#1: #2}}
\newcommand{\tb}[1]{\mycomment{TB}{#1}}
\newcommand{\ma}[1]{\mycomment{MA}{#1}}
\newcommand{\sr}[1]{\mycomment{SR}{#1}}
\newcommand{\ta}[1]{\mycomment{TA}{#1}}
\usepackage{array}
\usepackage{tabularx}
\usepackage{subcaption,siunitx,booktabs}
\usepackage[margin=1in]{geometry}
\usepackage{multirow, makecell}
\usepackage{array}
\setlength\extrarowheight{2pt}
\begin{document}
\begin{table*}
\begin{subtable}{1\textwidth}
\centering
\begin{tabular}{cSSc}
\toprule
\multirow{2}{*}{Dataset} &
\multicolumn{2}{c}{A (\%)} & \multirow{2}{*}{Dataset2} \\
& \multicolumn{1}{c}{O.B.R} & \multicolumn{1}{c}{A.R}
& \\
\midrule
D1 & 2.1 & 2.1 & D11 \\
D2 & 11.6 & 11.6 & D21\\
D3 & 5.5 & 5.5 & D31\\
\bottomrule
\end{tabular}
\caption{First subtable1}\label{tab:sub_first1}
\end{subtable}
\caption{Three simple tables} \label{tab:three_tables}
\end{table*}
\end{document}