\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{bm}
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts,booktabs}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{mathtools}
\usepackage{multirow}
\usepackage{inputenc}
\usepackage{array}
\usepackage{enumerate}
\begin{document}
% Please add the following required packages to your document preamble:
% \usepackage{multirow}
\begin{table}[]
\begin{tabular}{clccc}
\multicolumn{1}{l}{\textbf{Variations}} & \multicolumn{1}{c}{\textbf{Parameters}} & \textbf{\begin{tabular}[c]{@{}c@{}}DE based\\ PID\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}TLBO based \\ 2-dof PID\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}GWO based\\ 3-dof PID\end{tabular}} \\
\multirow{3}{*}{\textbf{Area 1}} & \textbf{Settling time} & 12.3404 & 10.562 & 6.741 \\
& \textbf{\begin{tabular}[c]{@{}l@{}}Peak \\ Undershoot\end{tabular}} & -0.0284 & -0.00853 & -0.00156 \\
& \textbf{\begin{tabular}[c]{@{}l@{}}Peak\\ Overshoot\end{tabular}} & 0.0026 & 0.000576 & 0.000255 \\
\multirow{3}{*}{\textbf{Area 2}} & \textbf{Settling time} & 8.2911 & 11.4377 & 5.756 \\
& \textbf{\begin{tabular}[c]{@{}l@{}}Peak \\ Undershoot\end{tabular}} & -0.024 & -0.000869 & -0.000639 \\
& \textbf{\begin{tabular}[c]{@{}l@{}}Peak\\ Overshoot\end{tabular}} & 0.0068 & 0.0054 & 0.00354 \\
\multirow{3}{*}{\textbf{Tie-Line}} & \textbf{Settling time} & 14.0627 & 10.0456 & 5.658 \\
& \textbf{\begin{tabular}[c]{@{}l@{}}Peak \\ Undershoot\end{tabular}} & -0.0046 & -0.0028 & -0.00021 \\
& \textbf{\begin{tabular}[c]{@{}l@{}}Peak\\ Overshoot\end{tabular}} & 0.00023 & 0.00021 & 0.00015
\end{tabular}
\end{table}
\end{document}
这就是我需要得到的。
答案1
编辑:
提供 mwe 之后现在很清楚,您有两列文档,并且您可能喜欢在一列中有表格。在这种情况下,第一个例子是没有用的,第二个 id 现在已更新。
第一个例子:预期标准article
文档类别:
表格代码:
\documentclass{article}
\usepackage{booktabs, makecell}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{}
\usepackage{siunitx}
\begin{table}[htb]
\setlength\tabcolsep{0pt}
\sisetup{table-format=2.6}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
>{\bfseries}c
>{\bfseries}l
SSS}
\toprule
\thead[l]{Variations}
& \thead{Parameters}
& {\thead{DE based\\ PID}}
& {\thead{TLBO based \\ 2-dof PID}}
& {\thead{GWO based\\ 3-dof PID}} \\
\midrule
Area 1
& Settling time & 12.3404 & 10.562 & 6.741 \\
& Peak Undershoot & -0.0284 & -0.00853 & -0.00156 \\
& Peak Overshoot & 0.0026 & 0.000576 & 0.000255 \\
\addlinespace
Area 2
& Settling time & 8.2911 & 11.4377 & 5.756 \\
& Peak Undershoot & -0.024 & -0.000869 & -0.000639 \\
& Peak Overshoot & 0.0068 & 0.0054 & 0.00354 \\
\addlinespace
Tie-Line
& Settling time & 14.0627 & 10.0456 & 5.658 \\
& Peak Undershoot & -0.0046 & -0.0028 & -0.00021 \\
& Peak Overshoot & 0.00023 & 0.00021 & 0.00015 \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}
第二个例子: 考虑的是您对问题的编辑:
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{bm}
\usepackage{textcomp}
\usepackage{cite}
\usepackage{mathtools,amssymb}% mathtools load amsmath, amsymb contain amstex too
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{enumerate}
\usepackage{xcolor}
\usepackage{%array,
booktabs, % loaded by makecell
makecell, % added
multirow} % not used in this mwe
\renewcommand\theadfont{\small\bfseries}
\renewcommand\theadgape{}
\usepackage{siunitx}
\usepackage{lipsum} % added for dummy text
\begin{document}
\lipsum[11]
\begin{table}[htb]
\setlength\tabcolsep{0pt}
\sisetup{table-format=2.6}
\small
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
l
SSS}
\toprule
\thead{Parameters}
& {\thead{DE based\\ PID}}
& {\thead{TLBO based \\ 2-dof PID}}
& {\thead{GWO based\\ 3-dof PID}} \\
\midrule
\multicolumn{4}{l}{\textbf{Area 1}} \\
Settling time & 12.3404 & 10.562 & 6.741 \\
Peak Undershoot & -0.0284 & -0.00853 & -0.00156 \\
Peak Overshoot & 0.0026 & 0.000576 & 0.000255 \\
\addlinespace
\multicolumn{4}{l}{\textbf{Area 2}} \\
Settling time & 8.2911 & 11.4377 & 5.756 \\
Peak Undershoot & -0.024 & -0.000869 & -0.000639 \\
Peak Overshoot & 0.0068 & 0.0054 & 0.00354 \\
\addlinespace
\multicolumn{4}{l}{\textbf{Tie-Line}} \\
Settling time & 14.0627 & 10.0456 & 5.658 \\
Peak Undershoot & -0.0046 & -0.0028 & -0.00021 \\
Peak Overshoot & 0.00023 & 0.00021 & 0.00015 \\
\bottomrule
\end{tabular*}
\end{table}
\lipsum[1-4]
\end{document}
这使:
如您所见,表格经过重新设计,可以放在一列中。在此,我建议将第一列“转换”为行(参见上面的 mwe)。上面的 mwe 用法为:
thead
用于包中的列标题宏\makecell
S
对于数字,请与包中的最后三列列类型对齐siunitx
(它也支持 SI 单位的书写)- 宏
@\extracolsep{\fill}}
,它确定列之间的距离。它们的大小首先设置为零,然后通过它计算,使表宽度等于列宽。
关于表格设计:值得一看“哪些标签真正地来自哪里”该网站还提供了许多精美的设计。