是否有一种简单的方法可以强制矩阵括号根据“数组”环境的幻像内容进行拉伸?

是否有一种简单的方法可以强制矩阵括号根据“数组”环境的幻像内容进行拉伸?

我得到的输出

在此处输入图片描述

我想要的输出是相同的,只是Z_bus矩阵的括号应该拉伸以包含array环境的幻影内容,如下所示

在此处输入图片描述

显然,我可以\phantom在其中使用和定义我需要的数组,但是在尝试写入可见内容之后\bar{\mathnormalbold{Z}}_{bus},内容开始进一步延伸。

我的MWE

\documentclass{book}


    % ========== Table packages ==========
    \usepackage{tabularx}
% BEGIN_FOLD

        \newcommand{\arraystretchdefaultl}{1.3}
        \newcommand{\arraystretchdefault}{ \renewcommand{\arraystretch}{\arraystretchdefaultl} }
        \arraystretchdefault

% END_FOLD

    \usepackage{booktabs}
    \usepackage{makecell}


    % ========== Equations and math packages ==========
    \usepackage{amsmath}
    \usepackage{amssymb, amsfonts}
    \usepackage{mathtools}
    \usepackage[defaultmathsizes, italic, eulergreek, symbolre, symbolmisc]{mathastext}


\begin{document}

\begin{align}
    \left[
        \begin{array}{c}
            \mathnormalbold{V}_{G}
            \\
        %
            \Xhline{0.25mm}
            V_{R, \thinspace i}
        %
            \\
            V_{R, \thinspace j}
        \end{array}
    \right] &=
%
    \left[
        \begin{array}{c !{\vrule width 0.25mm}c c}
            \bar{\mathnormalbold{Z}}_{GG} & \bar{\mathnormalbold{Z}}_{GR_{i}} & \bar{\mathnormalbold{Z}}_{GR_{j}}
        \\
            \Xhline{0.25mm}
        %
            \bar{\mathnormalbold{Z}}_{R_{i}G} & \bar{Z}_{RR, \thinspace ii} & \bar{Z}_{RR, \thinspace ij}
        %
        \\
            \bar{\mathnormalbold{Z}}_{R_{j}G} & \bar{Z}_{RR, \thinspace ij} & \bar{Z}_{R, \thinspace jj}
        \end{array}
    \right]
    %
    \left[      
        \begin{array}{c}
            \bar{\mathnormalbold{I}}_{G}
        \\
        \Xhline{0.25mm}
        %
            \bar{I}_{R, \thinspace i}
        \\
        %
            \bar{I}_{R, \thinspace j}
        \end{array}
    \right]
\label{eq:op_imp_load_RER_int_op}
\\
\intertext{where}
\bar{\mathnormalbold{Z}}_{bus} &=
    \left[
        \begin{array}{c !{\vrule width 0.25mm}c c}
            \bar{\mathnormalbold{Z}}_{GG} & \bar{\mathnormalbold{Z}}_{GR_{i}} & \bar{\mathnormalbold{Z}}_{GR_{j}}
        \\
        \Xhline{0.25mm}
        %           
            \bar{\mathnormalbold{Z}}_{R_{i}G} & \bar{Z}_{RR, \thinspace ii} & \bar{Z}_{RR, \thinspace ij}
        \\
        %
            \bar{\mathnormalbold{Z}}_{R_{j}G} & \bar{Z}_{RR, \thinspace ij} & \bar{Z}_{R, \thinspace jj}
        \end{array}
    \right]
\label{eq:Z_bus_hat_def}
\end{align}

\end{document}

答案1

随意使用更广泛的规则(我不认为你应该这么做)。我删除了mathastext它,结果很痛苦。

\documentclass{book}
\usepackage{amsmath,bm}

\newcommand{\bigarraystretch}{\renewcommand{\arraystretch}{1.3}}

\begin{document}

\begingroup\bigarraystretch
\newcommand{\Zbus}{%
  \begin{array}{@{} c | c c @{}}
    \bar{\bm{Z}}_{GG} & \bar{\bm{Z}}_{GR_{i}} & \bar{\bm{Z}}_{GR_{j}} \\
    \hline
    \bar{\bm{Z}}_{R_{i}G} & \bar{Z}_{RR,ii} & \bar{Z}_{RR,ij} \\
    \bar{\bm{Z}}_{R_{j}G} & \bar{Z}_{RR,ij} & \bar{Z}_{R,jj}
  \end{array}%
}
\begin{align}
\left[\begin{array}{@{}c@{}}
  \bm{V}_{G} \\
  \hline
  V_{R,i} \\
  V_{R,j}
\end{array}\right]
&=
\begin{bmatrix}
\vphantom{\Zbus}
\ooalign{\hphantom{$\Zbus$}\cr\hfil$\bar{\bm{Z}}_{\mathrm{bus}}$\hfil\cr}
\end{bmatrix}
\left[\begin{array}{@{} c @{}}
  \bar{\bm{I}}_{G} \\
  \hline
  \bar{I}_{R,i} \\
  \bar{I}_{R,j}
\end{array}\right]
\label{eq:op_imp_load_RER_int_op}
\\
\intertext{where}
\bar{\bm{Z}}_{\mathrm{bus}} &= \left[\Zbus\right]
\label{eq:Z_bus_hat_def}
\end{align}
\endgroup

\end{document}

其想法是保存 Zbus 矩阵的内容,并将其用于\ooalign将符号叠加在矩阵占据的水平空间上,并使用其之前的垂直空间来设置括号的大小。

在此处输入图片描述

答案2

这是一个带有saveboxes 的解决方案:

\documentclass{book}


    % ========== Table packages ==========
    \usepackage{tabularx}
% BEGIN_FOLD

        \newcommand{\arraystretchdefaultl}{1.3}
        \newcommand{\arraystretchdefault}{ \renewcommand{\arraystretch}{\arraystretchdefaultl} }
        \arraystretchdefault

% END_FOLD

    \usepackage{booktabs}
    \usepackage{makecell}


    % ========== Equations and math packages ==========
    \usepackage{amsmath}
    \usepackage{amssymb, amsfonts}
    \usepackage{mathtools}
    \usepackage[defaultmathsizes, italic, eulergreek, symbolre, symbolmisc]{mathastext}

\newsavebox{\mybox}
\newsavebox{\mysbox}
\begin{document}

\begin{align}
    \left[
        \begin{array}{c}
            \mathnormalbold{V}_{G}
            \\
        %
            \Xhline{0.25mm}
            V_{R, \thinspace i}
        %
            \\
            V_{R, \thinspace j}
        \end{array}
    \right] &=
%
    \left[
        \savebox{\mybox}{\hbox{\(\begin{array}{c !{\vrule width 0.25mm}c c}
            \bar{\mathnormalbold{Z}}_{GG} & \bar{\mathnormalbold{Z}}_{GR_{i}} & \bar{\mathnormalbold{Z}}_{GR_{j}}
        \\
            \Xhline{0.25mm}
        %
            \bar{\mathnormalbold{Z}}_{R_{i}G} & \bar{Z}_{RR, \thinspace ii} & \bar{Z}_{RR, \thinspace ij}
        %
        \\
            \bar{\mathnormalbold{Z}}_{R_{j}G} & \bar{Z}_{RR, \thinspace ij} & \bar{Z}_{R, \thinspace jj}
        \end{array}\)}}\savebox{\mysbox}{\hbox{\(\bar{Z}_{bus}\)}}
        \vphantom{\usebox{\mybox}}\hspace{\dimexpr(\dimexpr\wd\mybox/2)-\dimexpr(\wd\mysbox/2)}\usebox{\mysbox}\hspace{\dimexpr(\dimexpr\wd\mybox/2)-\dimexpr(\wd\mysbox/2)}
    \right]
    %
    \left[      
        \begin{array}{c}
            \bar{\mathnormalbold{I}}_{G}
        \\
        \Xhline{0.25mm}
        %
            \bar{I}_{R, \thinspace i}
        \\
        %
            \bar{I}_{R, \thinspace j}
        \end{array}
    \right]
\label{eq:op_imp_load_RER_int_op}
\\
\intertext{where}
\bar{\mathnormalbold{Z}}_{bus} &=
    \left[
        \begin{array}{c !{\vrule width 0.25mm}c c}
            \bar{\mathnormalbold{Z}}_{GG} & \bar{\mathnormalbold{Z}}_{GR_{i}} & \bar{\mathnormalbold{Z}}_{GR_{j}}
        \\
        \Xhline{0.25mm}
        %           
            \bar{\mathnormalbold{Z}}_{R_{i}G} & \bar{Z}_{RR, \thinspace ii} & \bar{Z}_{RR, \thinspace ij}
        \\
        %
            \bar{\mathnormalbold{Z}}_{R_{j}G} & \bar{Z}_{RR, \thinspace ij} & \bar{Z}_{R, \thinspace jj}
        \end{array}
    \right]
\label{eq:Z_bus_hat_def}
\end{align}

\end{document}

当然,将此功能放在里面可能会更好\newcommand。如果您觉得可以,请随时向我询问。

在此处输入图片描述

相关内容