我正在尝试在这个矩阵的前面和后面添加一点空间\hline
:
\documentclass[a4paper,journal]{IEEEtran}
\usepackage[cmex10]{amsmath}
\interdisplaylinepenalty=2500
\usepackage{array}
\begin{document}
\begin{multline}
\boldsymbol{J^{-1}} = \\ \left[ \begin{array}{ccc|ccc}
\frac{\partial \delta_2}{\partial P_2} & \hdots & \frac{\partial \delta_n}{\partial P_2} &
\frac{\partial \delta_2}{\partial Q_2} & \hdots & \frac{\partial \delta_n}{\partial Q_2} \\
\vdots & \boldsymbol{J_{11}^\prime} & \vdots & \vdots & \boldsymbol{J_{21}^\prime} & \vdots \\
\frac{\partial \delta_2}{\partial P_n} & \hdots & \frac{\partial \delta_n}{\partial P_n} &
\frac{\partial \delta_2}{\partial Q_n} & \hdots & \frac{\partial \delta_n}{\partial Q_n} \\
\hline
\frac{1}{|V_2|}\frac{\partial |V_2|}{\partial P_2} & \hdots & \frac{1}{|V_n|}\frac{\partial |V_n|}{\partial P_2} &
\frac{1}{|V_2|}\frac{\partial |V_2|}{\partial Q_2} & \hdots & \frac{1}{|V_n|}\frac{\partial |V_n|}{\partial Q_2} \\
\vdots & \boldsymbol{J_{12}^\prime} & \vdots& \vdots & \boldsymbol{J_{22}^\prime} & \vdots \\
\frac{1}{|V_2|}\frac{\partial |V_2|}{\partial P_n} & \hdots & \frac{1}{|V_n|}\frac{\partial |V_n|}{\partial P_n} &
\frac{1}{|V_2|}\frac{\partial |V_2|}{\partial Q_n} & \hdots & \frac{1}{|V_n|}\frac{\partial |V_n|}{\partial Q_n} \\
\end{array} \right]
\\\label{eq:Jinv}
\end{multline}
\end{document}
输出:
目前,我已经这样做了:
... \\[0.5em]
\hline
&&&&&\\[-0.8em]
...
哪个有效:
但有点混乱。有没有更干净的方法来做到这一点?
答案1
您可以定义几个新命令。我不确定这是否比您自己的解决方案更好,但这是一种替代方法。
其中两个新命令是\bottomstrut
和\topstrut
。第三个命令将这两个命令与换行符和 组合起来,hline
以适应多行环境。以下两个是示例:
\documentclass[a4paper,journal]{IEEEtran}
\usepackage[cmex10]{amsmath}
\interdisplaylinepenalty=2500
\newcommand{\bottomstrut}[1]{\rule[-#1]{0pt}{#1}}
\newcommand{\topstrut}[1]{\rule{0pt}{#1}}
\newcommand{\dividerline}[2]{\bottomstrut{#1}\\\hline\topstrut{#2}}
\usepackage{array}
\begin{document}
Example with \verb=\bottomstrut{2ex}\\\hline\topstrut{3ex}=
\begin{multline}
\boldsymbol{J^{-1}} = \\ \left[ \begin{array}{ccc|ccc}
\frac{\partial \delta_2}{\partial P_2} & \hdots & \frac{\partial \delta_n}{\partial P_2} &
\frac{\partial \delta_2}{\partial Q_2} & \hdots & \frac{\partial \delta_n}{\partial Q_2} \\
\vdots & \boldsymbol{J_{11}^\prime} & \vdots & \vdots & \boldsymbol{J_{21}^\prime} & \vdots \\
\frac{\partial \delta_2}{\partial P_n} & \hdots & \frac{\partial \delta_n}{\partial P_n} &
\frac{\partial \delta_2}{\partial Q_n} & \hdots & \frac{\partial \delta_n}{\partial Q_n}
\bottomstrut{2ex}\\\hline\topstrut{3ex}
\frac{1}{|V_2|}\frac{\partial |V_2|}{\partial P_2} & \hdots & \frac{1}{|V_n|}\frac{\partial |V_n|}{\partial P_2} &
\frac{1}{|V_2|}\frac{\partial |V_2|}{\partial Q_2} & \hdots & \frac{1}{|V_n|}\frac{\partial |V_n|}{\partial Q_2} \\
\vdots & \boldsymbol{J_{12}^\prime} & \vdots& \vdots & \boldsymbol{J_{22}^\prime} & \vdots \\
\frac{1}{|V_2|}\frac{\partial |V_2|}{\partial P_n} & \hdots & \frac{1}{|V_n|}\frac{\partial |V_n|}{\partial P_n} &
\frac{1}{|V_2|}\frac{\partial |V_2|}{\partial Q_n} & \hdots & \frac{1}{|V_n|}\frac{\partial |V_n|}{\partial Q_n} \\
\end{array} \right]
\\\label{eq:Jinv:1}
\end{multline}
Example with \verb=\dividerline{2ex}{3ex}=
\begin{multline}
\boldsymbol{J^{-1}} = \\ \left[ \begin{array}{ccc|ccc}
\frac{\partial \delta_2}{\partial P_2} & \hdots & \frac{\partial \delta_n}{\partial P_2} &
\frac{\partial \delta_2}{\partial Q_2} & \hdots & \frac{\partial \delta_n}{\partial Q_2} \\
\vdots & \boldsymbol{J_{11}^\prime} & \vdots & \vdots & \boldsymbol{J_{21}^\prime} & \vdots \\
\frac{\partial \delta_2}{\partial P_n} & \hdots & \frac{\partial \delta_n}{\partial P_n} &
\frac{\partial \delta_2}{\partial Q_n} & \hdots & \frac{\partial \delta_n}{\partial Q_n}
\dividerline{2ex}{3ex}
\frac{1}{|V_2|}\frac{\partial |V_2|}{\partial P_2} & \hdots & \frac{1}{|V_n|}\frac{\partial |V_n|}{\partial P_2} &
\frac{1}{|V_2|}\frac{\partial |V_2|}{\partial Q_2} & \hdots & \frac{1}{|V_n|}\frac{\partial |V_n|}{\partial Q_2} \\
\vdots & \boldsymbol{J_{12}^\prime} & \vdots& \vdots & \boldsymbol{J_{22}^\prime} & \vdots \\
\frac{1}{|V_2|}\frac{\partial |V_2|}{\partial P_n} & \hdots & \frac{1}{|V_n|}\frac{\partial |V_n|}{\partial P_n} &
\frac{1}{|V_2|}\frac{\partial |V_2|}{\partial Q_n} & \hdots & \frac{1}{|V_n|}\frac{\partial |V_n|}{\partial Q_n} \\
\end{array} \right]
\\\label{eq:Jinv:2}
\end{multline}
\end{document}