我有一张表格,第一列是空的。所有其他列都填有文本或公式。我想在不改变表格整体外观的情况下,在第一列的整个部分(除了前两行(已使用))上垂直写上“DC grid”字样。
问题是,我不能简单地使用,\multirow
因为我想在多个单元格(而不仅仅是行)上书写。我尝试在表格内创建表格(嵌套表格),但我无法摆脱嵌套表格增加的额外空间。
这是我的表格(我想在空白的第一列垂直写上“DC 电网”):
\begin{table}[!htbp]%200pts de large
\centerline{\resizebox{0.90\linewidth}{!}{\begin{tabular}
{|>{\centering}p{15pt}|>{\centering}p{25pt}|>{\centering}p{55pt}|>{\centering}p{20pt}|>{\centering}p{23pt}|>{\centering}p{70pt}|}\hline %\pm
%
\multicolumn{3}{|c|}{\multirow{2}{*}{\textbf{Eigenvalues}}} & \textbf{Freq. (Hz)} & \textbf{Damp. ratio} & \centering \multirow{2}{*}{\textbf{Dominant states}}\tabularnewline\hline
%
& \multirow{1}{*}{$\lambda_{dc_{1,2}}$} & \multirow{1}{*}{$-56.7 \pm j2130$} & \multirow{1}{*}{$339$} & \multirow{1}{*}{$0.027$} & $X_{p_1}$, $X_{p_2}$, $X_{p_3}$, \tabularnewline\cline{2-5}
%
& \multirow{1}{*}{$\lambda_{dc_{2,3}}$} & \multirow{1}{*}{$-56.7 - j2011$} & \multirow{1}{*}{$320$} & \multirow{1}{*}{$0.028$} & $\Delta u_{s_1}$, $\Delta u_{s_2}$, $\Delta u_{s_3}$ \tabularnewline\cline{2-5}
%
& \multirow{1}{*}{$\lambda_{dc_{5,6}}$} & \multirow{1}{*}{$-60.0 \pm j1426$} & \multirow{1}{*}{$227$} & \multirow{1}{*}{$0.040$} & $\Delta u_{s_4}$, $\Delta u_{s_5}$\tabularnewline\cline{2-6}
%
& \multirow{4}{*}{$\lambda_{dc_{7,8}}$} & \multirow{4}{*}{$-57 \pm j1223$} & \multirow{4}{*}{$195$} & \multirow{4}{*}{$0.047$} & $i_{l_{1_1}}$, $i_{l_{2_1}}$, $i_{l_{1_4}}$, $i_{l_{2_4}}$, $i_{l_{1_5}}$, $i_{l_{2_5}}$\vspace{0.4mm}, $\Delta u_{s_1}$, $\Delta u_{s_2}$, $\Delta u_{s_3}$, $\Delta u_{s_4}$, $\Delta u_{s_5}$\tabularnewline\cline{2-6}
%
& \multirow{1}{*}{$\lambda_{dc_{9}}$} & \multirow{1}{*}{$-117.1$} & \multirow{1}{*}{ -- } & \multirow{1}{*}{ -- } & $i_{l_{1_1}}$, $i_{l_{2_1}}$, $i_{l_{1_2}}$,\tabularnewline\cline{2-5}
%
& \multirow{1}{*}{$\lambda_{dc_{10}}$} & \multirow{1}{*}{$-4.497$} & \multirow{1}{*}{ -- } & \multirow{1}{*}{ -- } & $i_{l_{2_2}}$, $i_{l_{1_3}}$, $i_{l_{2_3}}$,\tabularnewline\cline{2-5}
%
& \multirow{1}{*}{$\lambda_{dc_{11}}$} & \multirow{1}{*}{$-4.476$} & \multirow{1}{*}{ -- } & \multirow{1}{*}{ -- } & $i_{l_{1_4}}$, $i_{l_{2_4}}$, $i_{l_{1_5}}$,\tabularnewline\cline{2-5}
%
& \multirow{1}{*}{$\lambda_{dc_{12}}$} & \multirow{1}{*}{$-0.604$} & \multirow{1}{*}{ -- } & \multirow{1}{*}{ -- } & $i_{l_{2_5}}$, $i_{l_{1_6}}$, $i_{l_{2_6}}$,\tabularnewline\cline{1-6}
%
%
\end{tabular}}}\vspace{3mm}
\caption{Modal Analysis of the 5-Terminal HVDC Grid}\label{tab5}\end{table}%
答案1
你的意思是像这样吗?
\documentclass{Article}
\usepackage{multirow,graphicx,array}
\begin{document}
\begin{table}[!htbp]
\centering %% use this instead of \centerline
\resizebox{0.90\linewidth}{!}{\begin{tabular}
{|>{\centering}p{15pt}|>{\centering}p{25pt}|>{\centering}p{63pt}|>{\centering}p{26pt}|
>{\centering}p{33pt}|>{\centering}p{83pt}|}\hline %\pm
%
\multicolumn{3}{|c|}{\multirow{2}{*}{\textbf{Eigenvalues}}} & \textbf{Freq. (Hz)} & \textbf{Damp. ratio} & \centering \multirow{2}{*}{\textbf{Dominant states}}\tabularnewline\hline
%
& \multirow{1}{*}{$\lambda_{dc_{1,2}}$} & \multirow{1}{*}{$-56.7 \pm j2130$} & \multirow{1}{*}{$339$} & \multirow{1}{*}{$0.027$} & $X_{p_1}$, $X_{p_2}$, $X_{p_3}$, \tabularnewline\cline{2-5}
%
& \multirow{1}{*}{$\lambda_{dc_{2,3}}$} & \multirow{1}{*}{$-56.7 - j2011$} & \multirow{1}{*}{$320$} & \multirow{1}{*}{$0.028$} & $\Delta u_{s_1}$, $\Delta u_{s_2}$, $\Delta u_{s_3}$ \tabularnewline\cline{2-5}
%
& \multirow{1}{*}{$\lambda_{dc_{5,6}}$} & \multirow{1}{*}{$-60.0 \pm j1426$} & \multirow{1}{*}{$227$} & \multirow{1}{*}{$0.040$} & $\Delta u_{s_4}$, $\Delta u_{s_5}$\tabularnewline\cline{2-6}
%
& \multirow{4}{*}{$\lambda_{dc_{7,8}}$} & \multirow{4}{*}{$-57 \pm j1223$} & \multirow{4}{*}{$195$} & \multirow{4}{*}{$0.047$} & $i_{l_{1_1}}$, $i_{l_{2_1}}$, $i_{l_{1_4}}$, $i_{l_{2_4}}$, $i_{l_{1_5}}$, $i_{l_{2_5}}$\vspace{0.4mm}, $\Delta u_{s_1}$, $\Delta u_{s_2}$, $\Delta u_{s_3}$, $\Delta u_{s_4}$, $\Delta u_{s_5}$\tabularnewline\cline{2-6}
%
& \multirow{1}{*}{$\lambda_{dc_{9}}$} & \multirow{1}{*}{$-117.1$} & \multirow{1}{*}{ -- } & \multirow{1}{*}{ -- } & $i_{l_{1_1}}$, $i_{l_{2_1}}$, $i_{l_{1_2}}$,\tabularnewline\cline{2-5}
%
& \multirow{1}{*}{$\lambda_{dc_{10}}$} & \multirow{1}{*}{$-4.497$} & \multirow{1}{*}{ -- } & \multirow{1}{*}{ -- } & $i_{l_{2_2}}$, $i_{l_{1_3}}$, $i_{l_{2_3}}$,\tabularnewline\cline{2-5}
%
& \multirow{1}{*}{$\lambda_{dc_{11}}$} & \multirow{1}{*}{$-4.476$} & \multirow{1}{*}{ -- } & \multirow{1}{*}{ -- } & $i_{l_{1_4}}$, $i_{l_{2_4}}$, $i_{l_{1_5}}$,\tabularnewline\cline{2-5}
%
\multirow{-11}{*}{\rotatebox[origin=c]{90}{DC Grid}} %% change 11 as you add further rows and put this in the last row.
& \multirow{1}{*}{$\lambda_{dc_{12}}$} & \multirow{1}{*}{$-0.604$} & \multirow{1}{*}{ -- } & \multirow{1}{*}{ -- } & $i_{l_{2_5}}$, $i_{l_{1_6}}$, $i_{l_{2_6}}$,\tabularnewline\cline{1-6}
%
%
\end{tabular}}%\vspace{3mm}
\caption{Modal Analysis of the 5-Terminal HVDC Grid}\label{tab5}
\end{table}%
\end{document}
答案2
使用包,您可以获得更简单的代码makecell
。该caption
包有助于获得像 OP 问题中的图像那样的标题。但是,我建议使用另一种布局booktabs
,没有垂直线。下面的代码显示了两种布局:
\documentclass{article}
\usepackage{multirow,graphicx}
\usepackage{mathtools}
\usepackage{makecell, booktabs}
\renewcommand\theadfont{\bfseries}
\renewcommand\cellalign{lc}
\setcellgapes{2pt}
\usepackage{array}
\usepackage{caption}
\DeclareCaptionLabelFormat{uppercase}{\MakeUppercase{#1}~\Roman{table}}
\captionsetup{textfont=sc, labelformat=uppercase, labelsep=newline}
\begin{document}
\setcounter{table}{3}
\begin{table}[!htbp]
\centering \makegapedcells%%
\resizebox{0.90\linewidth}{!}{%
$ \begin{array}{|>{\centering}p{15pt}|c|c|c|c|>{\centering\arraybackslash $}p{90pt}<{$}|}
\hline %
\multicolumn{3}{|c|}{\thead{\text{Eigenvalues}}}& \thead{\text{Freq.}\\ \text{(Hz)}} & \thead{\text{Damp.}\\ \text{ratio}} & \thead{\text{Dominant states}} \\
\hline
& \lambda_{dc_{1,2}} & -56.7 \pm j2130 & 339 & 0.027 & \multirowcell{4}[0.3ex]{
X_{p_1}, X_{p_2}, X_{p_3} , \\ \Delta u_{s_1}, \Delta u_{s_2}, \Delta u_{s_3}, \\ \Delta u_{s_4}, \Delta u_{s_5}} \\
\cline{2-5}
%
& \lambda_{dc_{2,3}} & -56.7 - j2011 & 320 & 0.028 & \\
\cline{2-5}
%
& \lambda_{dc_{5,6}} & -60.0 \pm j1426 & 227 & 0.040 & \\
\cline{2-6}
%
\rotatebox[origin=c]{90}{DC Grid} & \lambda_{dc_{7,8}} & -57 \pm j1223 & 195 & 0.047 & \makecell{ i_{l_{1_1}}, i_{l_{2_1}}, i_{l_{1_4}}, i_{l_{2_4}},\\ i_{l_{1_5}}, i_{l_{2_5}}, \Delta u_{s_1}, \Delta u_{s_2},\\ \Delta u_{s_3}, \Delta u_{s_4}, \Delta u_{s_5}\bigskip} \\
\cline{2-6}
%
& \lambda_{dc_{9}} & -117.1 & \textendash & \textendash & \multirowcell{4}[-1ex]{ i_{l_{1_1}}, i_{l_{2_1}}, i_{l_{1_2}}, i_{l_{2_2}}, \\ i_{l_{1_3}}, i_{l_{2_3}}, i_{l_{1_4}}, i_{l_{2_4}}, \\ i_{l_{1_5}}, i_{l_{2_5}}, i_{l_{1_6}}, i_{l_{2_6}}} \\
\cline{2-5}
%
& \lambda_{dc_{10}} & -4.497 & \textendash & \textendash & \\
\cline{2-5}
%
& \lambda_{dc_{11}} & -4.476 & \textendash & \textendash & \\
\cline{2-5}
%
& \lambda_{dc_{12}} & -0.604 & \textendash & \textendash & \\
\cline{1-6}%
\end{array} $}%
\caption{Modal Analysis of the 5-Terminal HVDC Grid}\label{tab5}
\end{table}%
\vskip 0.5cm
\begin{table}[!htbp]
\centering \makegapedcells%%
\resizebox{0.90\linewidth}{!}{%
$ \begin{array}{c*{4}{c}>{\centering\arraybackslash $}p{90pt}<{$}}
& \multicolumn{2}{c}{\thead{\text{Eigenvalues}}}& \thead{\text{Freq.}\\ \text{(Hz)}} & \thead{\text{Damp.}\\ \text{ratio}} & \thead{\text{Dominant states}} \\
\addlinespace[-1ex]
\cmidrule[\heavyrulewidth]{2-6}
& \lambda_{dc_{1,2}} & -56.7 \pm j2130 & 339 & 0.027 & \multirowcell{4}[0.5ex]{
X_{p_1}, X_{p_2}, X_{p_3} , \\ \Delta u_{s_1}, \Delta u_{s_2}, \Delta u_{s_3}, \\ \Delta u_{s_4}, \Delta u_{s_5}} \\
& \lambda_{dc_{2,3}} & -56.7 - j2011 & 320 & 0.028 & \\
%
& \lambda_{dc_{5,6}} & -60.0 \pm j1426 & 227 & 0.040 & \\
\cmidrule(lr){2-6}
%
\rotatebox[origin=c]{90}{DC Grid} & \lambda_{dc_{7,8}} & -57 \pm j1223 & 195 & 0.047 & \makecell{ i_{l_{1_1}}, i_{l_{2_1}}, i_{l_{1_4}}, i_{l_{2_4}},\\ i_{l_{1_5}}, i_{l_{2_5}}, \Delta u_{s_1}, \Delta u_{s_2},\\ \Delta u_{s_3}, \Delta u_{s_4}, \Delta u_{s_5}} \\
\cmidrule(lr){2-6}
%
& \lambda_{dc_{9}} & -117.1 & \textendash & \textendash & \multirowcell{4}[-1ex]{ i_{l_{1_1}}, i_{l_{2_1}}, i_{l_{1_2}}, i_{l_{2_2}}, \\ i_{l_{1_3}}, i_{l_{2_3}}, i_{l_{1_4}}, i_{l_{2_4}}, \\ i_{l_{1_5}}, i_{l_{2_5}}, i_{l_{1_6}}, i_{l_{2_6}}} \\
%
& \lambda_{dc_{10}} & -4.497 & \textendash & \textendash & \\
%
& \lambda_{dc_{11}} & -4.476 & \textendash & \textendash & \\
%
& \lambda_{dc_{12}} & -0.604 & \textendash & \textendash & \\
\cmidrule[\heavyrulewidth]{2-6}
\end{array} $}%
\caption{Modal Analysis of the 5-Terminal HVDC Grid}\label{tab5-a}
\end{table}%
\end{document}