I have a simple matrix equation, but one of the matrices has subscripts and superscripts on both lines:
\documentclass{article}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}
\[
\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}
\]
\end{document}
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?
=
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 inalign
.\vphantom
command, which measures the height and depth of its argument and typesets a rule with that height and depth.