I have a simple matrix equation, but one of the matrices has subscripts and superscripts on both lines:



\begin{vmatrix} x_2 \\x_2' \end{vmatrix} 
\begin{vmatrix} \frac{d_2}{f_1}&-\frac{d_1d_2}{f_1}\\-\frac{1}{f_1}&1-\frac{d_1}{f_1} \end{vmatrix}
\begin{vmatrix} x_1\\x_1' \end{vmatrix}


so the matrices are slightly different heights (top line in example below - red rule added to demonstrate). It wouldn't look so bad if they were very different. I can use \vphantom\frac... to enlarge the two smaller matrices:

\begin{vmatrix} x_2 \vphantom{\frac{d_2}{f_1}}\\x_2'\vphantom{\frac{d_2}{f_1}} \end{vmatrix} 
\begin{vmatrix} \frac{d_2}{f_1}&-\frac{d_1d_2}{f_1}\\-\frac{1}{f_1}&1-\frac{d_1}{f_1} \end{vmatrix} 
\begin{vmatrix} x_1\vphantom{\frac{d_2}{f_1}}\\x_1'\vphantom{\frac{d_2}{f_1}} \end{vmatrix}

(second line in example image) but is there a way to make all the matrix heights in an equation match - either within a particular equation, or something I can do globally?

matrix height mismatch

| improve this question | | | | |
  • You can use a strut, an invisible character which is as large at the largest entry. You place the strut in every row of every matrix. First you need to find the maximum height (see \settoheight) then create your strut using \rule. – John Kormylo Oct 3 '13 at 12:53
  • No unless you use some insane input syntax, how should the construction before the = know about the size of the matrix. So you need some strange construction to do all the measuring and stuff behind the scenes. And then you have the problems of applying this to say typesetting this in align. – daleif Oct 3 '13 at 12:53
  • @JohnKormylo He’s basically doing this with the \vphantom command, which measures the height and depth of its argument and typesets a rule with that height and depth. – Qrrbrbirlbel Oct 3 '13 at 13:00
  • Yeah, I was trying to delete or replace my comment when the time limit ran out. – John Kormylo Oct 3 '13 at 13:02

arrays already add a strut to every entry so "reasonable" entries produce equal sized arrays. If the entries are larger than the strut the array grows.

So if you have a lot of large entries and want to keep the matricies consistent just enlarge the strut.


works here

enter image description here

| improve this answer | | | | |
  • Perfect - I can use it before a sequence of equations and put it back to normal afterwards. – Chris H Oct 3 '13 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.