\documentclass[final,3p,times,authoryear]{elsarticle}
\usepackage{amssymb}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage[linesnumbered,ruled]{algorithm2e}
\usepackage[noend]{algpseudocode}
\usepackage{tikz, graphicx}
\usepackage[export]{adjustbox}
\usepackage{tabularx}
\usepackage{subcaption}
\usepackage{natbib}
\usepackage{siunitx}
\usepackage{cite}
\setcitestyle{square,numbers,comma,sort&compress}
\makeatletter
\renewcommand{\fnum@figure}{Fig. \thefigure}
\makeatother
%\usepackage[top=2.5cm, bottom=1.8cm,left=2.5cm]{geometry}
\usepackage{booktabs}
\journal{AA}
\begin{document}
\begin{table}[!htbp]
\caption{AAAA}
\label{XXXXX}
\setlength\tabcolsep{0pt}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
ll
S[table-format=1.4]
*{5}{S[table-format=-1.4]}
}
\toprule
\multirow{2}{*}[-1ex]{A} % "[-1ex]" correction of the vertical
position of cell content.
% it is required because of the use of lines from
"booktabs"
& \multirow{2}{*}[-1ex]{B}
& {\multirow{2}{*}[-1ex]{C}
& \multicolumn{5}{c}{D} \\
\cmidrule{4-8}
& & & {dd} & {ddd} &
{ddd} & {dddd} & {Proposed} \\
\midrule
\multirow{3}{*}{XZA}
& Vertical & 0.9085 & -0.0090 & -0.0035 & -0.0181 & 0.0061 &
-0.0029 \\
& Horizontal & 0.9376 & -0.0002 & 0.0011 & -0.0164 & 0.0180 &
0.0021 \\
& Diagonal & 0.8635 & -0.0066 & -0.0029 & 0.0004 & -0.0079 &
0.0006 \\
\end{tabular*}
\end{table}
\end{document}
我想要这个表格中的边框线,应该怎么做,有人可以帮忙吗,我得到了 overbull hbox,我该如何解决这个问题?
答案1
- 我不会画垂直线。特别是不与包中的规则结合
booktabs
。它会变得丑陋(不符合我的口味)。 - 您的表格不一致。第一行不完整(在下面的 mwe 中,我更改了跨度的列数
\multicolumn{5}{c}{D}
- 对于带有数字的列我将使用
S
包中的列类型siunitx
\documentclass[final,3p,times,authoryear]{elsarticle}
\journal{AA}
%\usepackage[top=2.5cm, bottom=1.8cm,left=2.5cm]{geometry}
\usepackage{booktabs, multirow}
\usepackage{siunitx}
\begin{document}
\begin{table}[!htbp]
\setlength\tabcolsep{0pt}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
ll
S[table-format=1.4]
*{5}{S[table-format=-1.4]}
}
\toprule
\multirow{2}{*}[-1ex]{A} % "[-1ex]" correction of the vertical position of cell content.
% it is required because of the use of lines from "booktabs"
& \multirow{2}{*}[-1ex]{B}
& {\multirow{2}{*}[-1ex]{C}}
& \multicolumn{5}{c}{D} \\
\cmidrule{4-8}
& & & {Q} & {R} & {s} & {T} & {P} \\
\midrule
\multirow{3}{*}{AA}
& H & 0.9376 & -0.0002 & 0.0011 & -0.0164 & 0.0180 & 0.0021 \\
& V & 0.9085 & -0.0090 & -0.0035 & -0.0181 & 0.0061 & -0.0029 \\
& D & 0.8635 & -0.0066 & -0.0029 & 0.0004 & -0.0079 & 0.0006 \\
\bottomrule
\end{tabular*}
\end{table}
see my splendid table \ref{XXXXX}.
\end{document}
这使
- 但是,如果您喜欢将牢房内容放在“监狱”中,那么您可以这样做:
\documentclass{article}
\usepackage{multirow}
\usepackage{siunitx}
\begin{document}
\begin{table}[!htbp]
\centering
\setlength\extrarowheight{2pt}
\begin{tabular}{|l|l||S[table-format=1.4]|
*{5}{S[table-format=-1.4]|}}
\hline
\multirow{2}{*}[-0.5ex]{A}
& \multirow{2}{*}[-0.5ex]{B}
& {\multirow{2}{*}[-0.5ex]{C}}
& \multicolumn{5}{c|}{D} \\
\cline{4-8}
& & & {Q} & {R} & {s} & {T} & {P} \\
\hline
\multirow{3}{*}{AA}
& H & 0.9376 & -0.0002 & 0.0011 & -0.0164 & 0.0180 & 0.0021 \\
\cline{2-8}
& V & 0.9085 & -0.0090 & -0.0035 & -0.0181 & 0.0061 & -0.0029 \\
\cline{2-8}
& D & 0.8635 & -0.0066 & -0.0029 & 0.0004 & -0.0079 & 0.0006 \\
\hline
\end{tabular}
\end{table}
\end{document}
编辑 在你编辑问题之后,我的上述回答(被认为是你的文档序言)给出了
我觉得这个表看起来很丑。会把它变成下一个形式:
\documentclass[final,3p,times,authoryear]{elsarticle}
\journal{AA}
%\usepackage[top=2.5cm, bottom=1.8cm,left=2.5cm]{geometry}
\usepackage{booktabs, multirow}
\usepackage{siunitx}
\begin{document}
\begin{table}[!htbp]
\caption{AAAA}
\label{XXXXX}
\centering
\begin{tabular}{ll
S[table-format=1.4]
*{5}{S[table-format=-1.4]}
}
\toprule
\multirow{2}{*}[-1ex]{A}
& \multirow{2}{*}[-1ex]{B}
& {\multirow{2}{*}[-1ex]{C}}
& \multicolumn{5}{c}{D} \\
\cmidrule{4-8}
& & & {Q} & {R} & {s} & {T} & {P} \\
\midrule
\multirow{3}{*}{AA}
& H & 0.9376 & -0.0002 & 0.0011 & -0.0164 & 0.0180 & 0.0021 \\
& V & 0.9085 & -0.0090 & -0.0035 & -0.0181 & 0.0061 & -0.0029 \\
& D & 0.8635 & -0.0066 & -0.0029 & 0.0004 & -0.0079 & 0.0006 \\
\bottomrule
\end{tabular}
\end{table}
see my splendid table \ref{XXXXX}.
\end{document}
如您所见,两种情况下表的引用均有效!