5

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?

matrix height mismatch

4
  • 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. Oct 3, 2013 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, 2013 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. Oct 3, 2013 at 13:00
  • Yeah, I was trying to delete or replace my comment when the time limit ran out. Oct 3, 2013 at 13:02

1 Answer 1

7

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.

\renewcommand\arraystretch{1.2}

works here

enter image description here

1
  • Perfect - I can use it before a sequence of equations and put it back to normal afterwards.
    – Chris H
    Oct 3, 2013 at 14:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .