我在表格格式方面遇到了麻烦,因为表格中的条目不适合,这使得表格很奇怪,我正在使用带有下面提到的示例的双列文档,请帮帮我。
\documentclass[journal]{IEEEtran}
%Comment this line ou t
\usepackage{graphicx}
\usepackage{cite}
\usepackage[cmex10]{amsmath}
\usepackage[utf8]{inputenc}
\usepackage{comment}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{tabularx}
\usepackage[acronym]{glossaries}
\IEEEoverridecommandlockouts
\usepackage[ruled,longend,linesnumbered]{algorithm2e}
\SetArgSty{textup}
\SetKwBlock{Loop}{Loop}{end}
\usepackage{physics}
\usepackage{lscape}
\usepackage{xcolor}
\usepackage{array}\usepackage{makecell}
\usepackage{multirow}
\usepackage{pbox}
\usepackage{amssymb}
\usepackage{stackengine}
\usepackage{makecell}
\usepackage{siunitx}
\usepackage{float}
\usepackage{amsmath,mathtools}
\usepackage{xcolor}
\usepackage{soul}
%\usepackage{soulutf8}
\usepackage[switch,columnwise]{lineno}
\linenumbers
\usepackage{nomencl}
\makenomenclature
\begin{document}
\begin{table}[H]
\caption{\hl{Key values}}
\centering
\label{tab:II}
\setlength{\arrayrulewidth}{0.3mm}
\setlength{\tabcolsep}{0.5pt}
\setcellgapes{3pt}\makegapedcells
\renewcommand{\arraystretch}{1}
\begin{tabular}{ |c|p{1.9cm}|p{1.9cm}|p{1.9cm}|p{1.9cm}|}
\hline
&\multicolumn{4}{|c|}{Hyperparameters}\\
\cline{2-5}
\thead{MOHSa} & S I & S II & S III & S IV \\
\hline
\multirow{1}{*}{ht} &$C_{bt}=1, M_{bt}=1, P_c=0.9 P_m= 0.1$ & $C_{bt}=2, M_{bt}=2, P_c=0.8. P_m= 0.2$ & $C_{bt}=3, M_{bt}=3, P_c=0.7. P_m= 0.5$ & $C_{bt}=4, M_{bt}=4, P_c=0.5. P_m= 0.4$ \\
\hline
\multirow{1}{*}{ntsk} &$\overrightarrow {v_i}_{\mathrm max}=-\overrightarrow {v_i}_{\mathrm in}=4,\alpha_1=\alpha_2=1,\overrightarrow{v_i}=2$
&$\overrightarrow {v_i}_{\mathrm max}=-\overrightarrow {v_i}_{\mathrm min}=6,\alpha_1=\alpha_2=3, \overrightarrow{v_i}=$
&$\overrightarrow {v_i}_{\mathrm max}=-\overrightarrow {v_i}_{\mathrm min}=8,\alpha_1=\alpha_2=3,\overrightarrow{v_i}=4$
& $\overrightarrow {v_i}_{\mathrm max}=-\overrightarrow {v_i}_{\mathrm min}=10,\alpha_1=\alpha_2=5, \overrightarrow{v_i}=8$ \\
\hline
\multirow{1}{*}{mj} & $F=0.7, P_{ce}=0.9, {p_e^{L,u}}=[30,100]$ &$F=0.8, P_{ce}=0.8, {p_e^{L,u}}=[60,150]$ &$F=0.9, P_{ce}=0.7 {p_e^{L,u}}=[70,200]$ &$F=0.5, P_{ce}=0.5, {p_e^{L,u}}=[100,300]$\\
\hline
\multirow{1}{*}{lut} & ${HMc}$=0.9, ${Pa_{min, max}}=[0.01, 1]$, $b_{min,max} =[0.001, 1]$& ${HMc}=0.8$, ${Pa_{min, max}}=[0.05, 1]$, $b_{min,max} =[0.002, 1]$&${HMc}=0.7$, ${Pa_{min, max}}=[0.5, 1],$ $b_{min,max} =[0.004, 1]$ &${HMc}=0.5$, ${Pa_{min, max}}=[0.05, 1]$, $b_{min,max} =[0.02, 1]$ \\
\hline
\end{tabular}
\end{table}
\end{document}
答案1
切勿在表格中重复信息。以下是我的建议:
\documentclass[journal]{IEEEtran}
\usepackage{newtxtext,newtxmath}
\usepackage{amsmath}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\caption{Key values}
\label{tab:II}
\begin{tabular}{
@{\quad}
l
cccc
@{}
}
\toprule
\multicolumn{1}{@{}c}{MOHSa} & \multicolumn{4}{c}{Hyperparameters}\\
\cmidrule{2-5}
& S I & S II & S III & S IV \\
\midrule
\multicolumn{1}{@{}l}{ht} \\
$C_{bt}$ & 1 & 2 & 3 & 4 \\
$M_{bt}$ & 1 & 2 & 3 & 4 \\
$P_c$ & 0.9 & 0.8 & 0.7 & 0.5 \\
$P_m$ & 0.1 & 0.2 & 0.5 & 0.4 \\
\midrule
\multicolumn{1}{@{}l}{ntsk} \\
$\overrightarrow {v_i}_{\max}=-\overrightarrow {v_i}_{\mathrm{in}}$ & 4 & 6 & 8 & 10 \\
$\alpha_1=\alpha_2$ & 1 & 3 & 3 & 5 \\
$\overrightarrow{v_i}$ & 2 & ? & 4 & 8 \\
\midrule
\multicolumn{1}{@{}l}{mj} \\
$F$ & 0.7 & 0.8 & 0.9 & 0.5 \\
$P_{ce}$ & 0.9 & 0.8 & 0.7 & 0.5 \\
$p_e^{L,u}$ & $[30,100]$ & $[60,150]$ & $[70,200]$ & $[100,300]$ \\
\midrule
\multicolumn{1}{@{}l}{lut} \\
$\mathit{HMc}$ & 0.9 & 0.8 & 0.7 & 0.5 \\
$\mathit{Pa}_{\min,\max}$ & $[0.01, 1]$ & $[0.05,1]$ & $[0.5,1]$ & $[0.05,1]$ \\
$b_{\min,\max}$ & $[0.001, 1]$ & $[0.002, 1]$ & $[0.004, 1]$ & $[0.02, 1]$ \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
您可以使用 来达到列宽tabular*
。
\documentclass[journal]{IEEEtran}
\usepackage{newtxtext,newtxmath}
\usepackage{amsmath}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\caption{Key values}
\label{tab:II}
\setlength{\tabcolsep}{0pt}
\begin{tabular*}{\columnwidth}{
@{\extracolsep{\fill}\quad}
l
cccc
}
\toprule
\multicolumn{1}{c}{MOHSa} & \multicolumn{4}{c}{Hyperparameters}\\
\cmidrule{2-5}
& S I & S II & S III & S IV \\
\midrule
\multicolumn{1}{l}{ht} \\
$C_{bt}$ & 1 & 2 & 3 & 4 \\
$M_{bt}$ & 1 & 2 & 3 & 4 \\
$P_c$ & 0.9 & 0.8 & 0.7 & 0.5 \\
$P_m$ & 0.1 & 0.2 & 0.5 & 0.4 \\
\midrule
\multicolumn{1}{l}{ntsk} \\
$\overrightarrow {v_i}_{\max}=-\overrightarrow {v_i}_{\mathrm{in}}$ & 4 & 6 & 8 & 10 \\
$\alpha_1=\alpha_2$ & 1 & 3 & 3 & 5 \\
$\overrightarrow{v_i}$ & 2 & ? & 4 & 8 \\
\midrule
\multicolumn{1}{l}{mj} \\
$F$ & 0.7 & 0.8 & 0.9 & 0.5 \\
$P_{ce}$ & 0.9 & 0.8 & 0.7 & 0.5 \\
$p_e^{L,u}$ & $[30,100]$ & $[60,150]$ & $[70,200]$ & $[100,300]$ \\
\midrule
\multicolumn{1}{l}{lut} \\
$\mathit{HMc}$ & 0.9 & 0.8 & 0.7 & 0.5 \\
$\mathit{Pa}_{\min,\max}$ & $[0.01, 1]$ & $[0.05,1]$ & $[0.5,1]$ & $[0.05,1]$ \\
$b_{\min,\max}$ & $[0.001, 1]$ & $[0.002, 1]$ & $[0.004, 1]$ & $[0.02, 1]$ \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}