Is there a simple way to force matrix brackets to stretch according to phantom contents of `array`...
How to acknowledge an embarrassing job interview, now that I work directly with the interviewer?
                
                    If I delete my router's history can my ISP still provide it to my parents?
                
                    Is Draco canonically good-looking?
                
                    Why is c4 a better move in this position?
                
                    How to use a mathematical expression as xticklable
                
                    Why is working on the same position for more than 15 years not a red flag?
                
                    Meth dealer reference in Family Guy
                
                    What can I substitute for soda pop in a sweet pork recipe?
                
                    If a druid in Wild Shape swallows a creature whole, then turns back to her normal form, what happens?
                
                    What to do when being responsible for data protection in your lab, yet advice is ignored?
                
                    Using AWS Fargate as web server
                
                    Can chords be played on the flute?
                
                    Do commercial flights continue with an engine out?
                
                    What are these green text/line displays shown during the livestream of Crew Dragon's approach to dock with the ISS?
                
                    How to approximate rolls for potions of healing using only d6's?
                
                    Do my Windows system binaries contain sensitive information?
                
                    Is it a fallacy if someone claims they need an explanation for every word of your argument to the point where they don't understand common terms?
                
                    Can the Count of Monte Cristo's calculation of poison dosage be explained?
                
                    On what did Lego base the appearance of the new Hogwarts minifigs?
                
                    What's a good word to describe a public place that looks like it wouldn't be rough?
                
                    Auto Insert date into Notepad
                
                    Dilemma of explaining to interviewer that he is the reason for declining second interview
                
                    Does Windows 10's telemetry include sending *.doc files if Word crashed?
                
                    What happens if a wizard reaches level 20 but has no 3rd-level spells that they can use with the Signature Spells feature?
Is there a simple way to force matrix brackets to stretch according to phantom contents of `array` environment?
breaking lines in a matrix/array environmentWhat is the best way to indicate repeated off diagonal elements in a matrix/array?Is there a way to paste a matrix cell-by-cell in Lyx?Inserting matrix/array in Table of ContentsIllustrating a matrix assembly within the array environmentHow to write the following matrix requiring both case and block array environment?Adding brackets above/below and left/right of array matrixIn LyX, how do you remove the brackets around a matrix after they're already there?In `array` environment, why does `multirow` stretch rows too much when using `=` for width entry?Is there a way to left align a simple equation without juggling spaces with hspace?
The output I get

The output I want is the same except that the brackets of the Z_bus matrix should stretch to contain phantom content of array environment as follows

Clearly, I can use phantom and define the array I need inside it, but after  try to write the visible content bar{mathnormalbold{Z}}_{bus}, the content starts stretching further.
My 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}
align matrices arrays
add a comment |
The output I get

The output I want is the same except that the brackets of the Z_bus matrix should stretch to contain phantom content of array environment as follows

Clearly, I can use phantom and define the array I need inside it, but after  try to write the visible content bar{mathnormalbold{Z}}_{bus}, the content starts stretching further.
My 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}
align matrices arrays
add a comment |
The output I get

The output I want is the same except that the brackets of the Z_bus matrix should stretch to contain phantom content of array environment as follows

Clearly, I can use phantom and define the array I need inside it, but after  try to write the visible content bar{mathnormalbold{Z}}_{bus}, the content starts stretching further.
My 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}
align matrices arrays
The output I get

The output I want is the same except that the brackets of the Z_bus matrix should stretch to contain phantom content of array environment as follows

Clearly, I can use phantom and define the array I need inside it, but after  try to write the visible content bar{mathnormalbold{Z}}_{bus}, the content starts stretching further.
My 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}
align matrices arrays
align matrices arrays
edited 11 hours ago
Al-Motasem Aldaoudeyeh
asked 11 hours ago
Al-Motasem AldaoudeyehAl-Motasem Aldaoudeyeh
1,588312
1,588312
add a comment |
add a comment |
                                2 Answers
                            2
                        
active
oldest
votes
Here is a solution with 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(dimexprwdmybox/2)-dimexpr(wdmysbox/2)}usebox{mysbox}hspace{dimexpr(dimexprwdmybox/2)-dimexpr(wdmysbox/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}
It could be better to put this functionality inside a newcommand of course. Feel free to ask me for this if this way seems ok to you.

add a comment |
Feel free to use wider rules (I don't think you should). I removed mathastext that yields a painful result.
documentclass{book}
usepackage{amsmath,bm}
newcommand{bigarraystretch}{renewcommand{arraystretch}{1.3}}
begin{document}
begingroupbigarraystretch
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$}crhfil$bar{bm{Z}}_{mathrm{bus}}$hfilcr}
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[Zbusright]
label{eq:Z_bus_hat_def}
end{align}
endgroup
end{document}
The idea is to save the contents of the Zbus matrix and to use ooalign to superimpose the symbol over the horizontal space taken by the matrix, with the vertical space before it to set the size of the brackets.

add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f477593%2fis-there-a-simple-way-to-force-matrix-brackets-to-stretch-according-to-phantom-c%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
                                2 Answers
                            2
                        
active
oldest
votes
                                2 Answers
                            2
                        
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here is a solution with 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(dimexprwdmybox/2)-dimexpr(wdmysbox/2)}usebox{mysbox}hspace{dimexpr(dimexprwdmybox/2)-dimexpr(wdmysbox/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}
It could be better to put this functionality inside a newcommand of course. Feel free to ask me for this if this way seems ok to you.

add a comment |
Here is a solution with 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(dimexprwdmybox/2)-dimexpr(wdmysbox/2)}usebox{mysbox}hspace{dimexpr(dimexprwdmybox/2)-dimexpr(wdmysbox/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}
It could be better to put this functionality inside a newcommand of course. Feel free to ask me for this if this way seems ok to you.

add a comment |
Here is a solution with 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(dimexprwdmybox/2)-dimexpr(wdmysbox/2)}usebox{mysbox}hspace{dimexpr(dimexprwdmybox/2)-dimexpr(wdmysbox/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}
It could be better to put this functionality inside a newcommand of course. Feel free to ask me for this if this way seems ok to you.

Here is a solution with 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(dimexprwdmybox/2)-dimexpr(wdmysbox/2)}usebox{mysbox}hspace{dimexpr(dimexprwdmybox/2)-dimexpr(wdmysbox/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}
It could be better to put this functionality inside a newcommand of course. Feel free to ask me for this if this way seems ok to you.

answered 11 hours ago


koleygrkoleygr
11.6k11038
11.6k11038
add a comment |
add a comment |
Feel free to use wider rules (I don't think you should). I removed mathastext that yields a painful result.
documentclass{book}
usepackage{amsmath,bm}
newcommand{bigarraystretch}{renewcommand{arraystretch}{1.3}}
begin{document}
begingroupbigarraystretch
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$}crhfil$bar{bm{Z}}_{mathrm{bus}}$hfilcr}
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[Zbusright]
label{eq:Z_bus_hat_def}
end{align}
endgroup
end{document}
The idea is to save the contents of the Zbus matrix and to use ooalign to superimpose the symbol over the horizontal space taken by the matrix, with the vertical space before it to set the size of the brackets.

add a comment |
Feel free to use wider rules (I don't think you should). I removed mathastext that yields a painful result.
documentclass{book}
usepackage{amsmath,bm}
newcommand{bigarraystretch}{renewcommand{arraystretch}{1.3}}
begin{document}
begingroupbigarraystretch
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$}crhfil$bar{bm{Z}}_{mathrm{bus}}$hfilcr}
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[Zbusright]
label{eq:Z_bus_hat_def}
end{align}
endgroup
end{document}
The idea is to save the contents of the Zbus matrix and to use ooalign to superimpose the symbol over the horizontal space taken by the matrix, with the vertical space before it to set the size of the brackets.

add a comment |
Feel free to use wider rules (I don't think you should). I removed mathastext that yields a painful result.
documentclass{book}
usepackage{amsmath,bm}
newcommand{bigarraystretch}{renewcommand{arraystretch}{1.3}}
begin{document}
begingroupbigarraystretch
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$}crhfil$bar{bm{Z}}_{mathrm{bus}}$hfilcr}
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[Zbusright]
label{eq:Z_bus_hat_def}
end{align}
endgroup
end{document}
The idea is to save the contents of the Zbus matrix and to use ooalign to superimpose the symbol over the horizontal space taken by the matrix, with the vertical space before it to set the size of the brackets.

Feel free to use wider rules (I don't think you should). I removed mathastext that yields a painful result.
documentclass{book}
usepackage{amsmath,bm}
newcommand{bigarraystretch}{renewcommand{arraystretch}{1.3}}
begin{document}
begingroupbigarraystretch
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$}crhfil$bar{bm{Z}}_{mathrm{bus}}$hfilcr}
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[Zbusright]
label{eq:Z_bus_hat_def}
end{align}
endgroup
end{document}
The idea is to save the contents of the Zbus matrix and to use ooalign to superimpose the symbol over the horizontal space taken by the matrix, with the vertical space before it to set the size of the brackets.

answered 8 hours ago


egregegreg
724k8819173221
724k8819173221
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f477593%2fis-there-a-simple-way-to-force-matrix-brackets-to-stretch-according-to-phantom-c%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown