This is my MWE:
\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{mathtools}
\usepackage{physics}
\usepackage{easybmat}
\begin{document}
First attempt:
\begin{align*}
&\left[\begin{BMAT}{c1c}{c1c}
a& \begin{matrix} b_1& b_2 \end{matrix} \\
\begin{matrix} c_1 \\ c_2 \end{matrix}& D
\end{BMAT}\right]
\left[\begin{BMAT}{c1c}{c1c}
a& \mathmakebox[\widthof{$\begin{matrix} b_1& b_2 \end{matrix} $}]{\vb*b}\\
\begin{matrix} c_1 \\ c_2 \end{matrix}& D
\end{BMAT}\right]\\
&\left[\begin{BMAT}{c1c}{c1c}
a& \mathmakebox[\widthof{$\begin{matrix} b_1& b_2 \end{matrix} $}]{\vb*b}\\
\begin{matrix} c_1 \\ c_2 \end{matrix}& D
\end{BMAT}\right]
\end{align*}
Second attempt:
\begin{align*}
&\left[\begin{BMAT}{c1c}{c1c}
a& \begin{matrix} b_1& b_2 \end{matrix} \\
\begin{matrix} c_1 \\ c_2 \end{matrix}& D
\end{BMAT}\right]
\left[\begin{BMAT}{c1c}{c1c}
a& \begin{matrix}
\mathmakebox[\widthof{$\begin{matrix} b_1& b_2 \end{matrix} $}]{\vb*b}
\end{matrix}\\
\begin{matrix} c_1 \\ c_2 \end{matrix}& D
\end{BMAT}\right]\\
&\left[\begin{BMAT}{c1c}{c1c}
a& \begin{matrix}
\mathmakebox[\widthof{$\begin{matrix} b_1& b_2 \end{matrix} $}]{\vb*b}
\end{matrix}\\
\begin{matrix} c_1 \\ c_2 \end{matrix}& D
\end{BMAT}\right]
\end{align*}
\end{document}
Here the mathtools
package should be necessary for the command \mathmakebox
; I'm using the easybmat
package because it's a great tool for handling blocks in matrices, which is necessary for my purposes; the physics
package here is used just for quick vector notation, but of course it's not necessary. One should get this result:
I often need to divide a matrix into several sectors, or merge several blocks into some bigger blocks, and so on… In doing this I often would like corresponding objects to have the very same visual dimensions.
In the MWE above, I tried to show how it is possible to make a "multi-column" matrix element of the same width of some consecutive elements in the same row with \mathmakebox
and \widthof
. [*]
In the "first attempt" it is shown that this trick works perfectly with horizontal spacing, but not with vertical spacing; in the "second attempt" a workaround for the vertical spacing is shown.
My questions are:
- Is there any cleaner solutions than the one I used above (in the MWE)?
- (fundamental) Is there a similar procedure to have a "multirow" matrix element of the same height of some consecutive elements within the same column?, in the MWE, just think of replacing the column (c1,c2) with a vector c, analogously to what has been done with (b1,b2) and b; I ask this especially because
\heightof
in\mathmakebox
doesn't do the trick. [**] - (more general) Is there a way to make a box, intended to be filled with math, with the same dimensions (the height and width) of some other math expression?, eventually is there a way to use two different expressions, one for width and one for height?
[*] I have to add, here, that I usually avoid merging columns and/or rows when managing matrices; I find nesting matrices a simpler solution; of course, I may very well be wrong on this!, anyway this question may eventually make sense also for other purposes, unrelated to matrices.
[**] I may have a workaround also for this problem, by using boxes with null width in which putting phantom expressions; I refrained from posting it: it is so inelegant that, had I posted, I'd have been banned for ever.
physics
; I guess that "vb" stands for "vector bold", the starred version is for italic while the non-starred version is for normal. Anyway, I see from your answer that you already figured out…