3

I am trying to write this matrix

enter image description here

But this matrix is awful aesthetically. The middle matrix is tall, the other two are short. I want to make all 3 matrixes the same height.

This is my Latex code:

\tt \color{Black}
\begin{bmatrix}
1 & -1 & -1\\
0 & 13 & -10\\
0 & 7 & \phantom{-} 17 
\end{bmatrix}

\begin{bmatrix}
I_{1}\\
I_{2}\\
I_{3}
\end{bmatrix}

=

\begin{bmatrix}
\phantom{-}0\\
\phantom{-}4\\
-3
\end{bmatrix}

But this is my problem. I am using macOS Pages that have limited Latex support. This is what apple has to say about it.

Unfortunately this solution is not working.

Is there a way to make everything the same height?

thanks

5

I looked at the supported commands and it says that \color is supported. This allows one to cheat by putting a white, i.e. invisible, dot on top of the symbols.

\documentclass{article}
\usepackage{amsmath}
\usepackage{color}
\begin{document}
\[
\begin{bmatrix}
\color{white}\dot{\color{black}1} & -1 & -1\phantom{0}\\
\color{white}\dot{\color{black}0} & 13 & -10\\
\color{white}\dot{\color{black}0} & \phantom{-}7 & \phantom{-} 17 
\end{bmatrix}
%
\begin{bmatrix}
I_{1}\\
I_{2}\\
I_{3}
\end{bmatrix}
%
=
%
\begin{bmatrix}
\phantom{-}\color{white}\dot{\color{black}0}\\
\phantom{-}\color{white}\dot{\color{black}4}\\
-\color{white}\dot{\color{black}3}
\end{bmatrix}
\]
\end{document}

I Just checked myself, if you remove the %, i.e. insert

\[
\begin{bmatrix}
\color{white}\dot{\color{black}1} & -1 & -1\phantom{0}\\
\color{white}\dot{\color{black}0} & 13 & -10\\
\color{white}\dot{\color{black}0} & \phantom{-}7 & \phantom{-} 17 
\end{bmatrix}

\begin{bmatrix}
I_{1}\\
I_{2}\\
I_{3}
\end{bmatrix}

=

\begin{bmatrix}
\phantom{-}\color{white}\dot{\color{black}0}\\
\phantom{-}\color{white}\dot{\color{black}4}\\
-\color{white}\dot{\color{black}3}
\end{bmatrix}
\]

you'll get

enter image description here

(For other Mac users: in a document inside the text, click on the insert symbol, which looks a bit like a reverse double-stroke P, and click insert equation, you'll be able to verify that it works. Whether or not this is an appropriate question for this site, I cannot judge.)

NOTE: I removed the \vphantom parts I had originally as this seems not to be supported by pages.

  • In a case like this, rather than a \vphantom, I’d use a \mathstrut (which is itself a \vphantom, namely \vphantom () everywhere. – GuM May 25 '18 at 1:26
  • Also beware that, in the last matrix, -3 should now be {-3} (the \vphantom inserts an empty box, which is a \mathord). The same remark applies to @mas’ answer too. – GuM May 25 '18 at 1:41
  • \vphantom is not working for me. Like I said, Pages has a very limited set of Latex. I have tried \phantom and it almost works. The matrices got equal sizes but the alignment is gone. – SpaceDog May 25 '18 at 1:55
  • There is a minor typo on your code... on the part you type \phantom{-1}7... I think the correct is \phantom{-}7. Adding the 1 shifts the 7 slightly to the right on my Pages. Anyway, your code is fantastic. Thanks. – SpaceDog May 26 '18 at 0:17
  • Let me ask you something. I have another question about latex on mac, that is how to create a box around a formula. I have searched the whole web and nothing works. Do you by any chance know? If you say yes I will open another question, to let you earn a few points... 😃 – SpaceDog May 26 '18 at 1:38
6

In addition to marmot's answer, you can use mathtools to right justify the numbers:

\documentclass{article}                                                                   
\usepackage{mathtools}                                                                    
\begin{document}                                                                          
\[                                                                                        
\begin{bmatrix*}[r]                                                                       
\vphantom{I_{1}}1 & -1 & -1\\                                                             
\vphantom{I_{1}}0 & 13 & -10\\                                                            
\vphantom{I_{1}}0 & 7 & 17                                                                
\end{bmatrix*}                                                                            
%                                                                                         
\begin{bmatrix}                                                                           
I_{1}\\                                                                                   
I_{2}\\                                                                                   
I_{3}                                                                                     
\end{bmatrix}                                                                             
%                                                                                         
=                                                                                         
%                                                                                         
\begin{bmatrix*}[r]                                                                       
\vphantom{I_{1}} 0\\                                                                      
\vphantom{I_{1}} 4\\                                                                      
\vphantom{I_{1}}-3                                                                        
\end{bmatrix*}                                                                            
\]                                                                                        
\end{document} 

enter image description here

  • \vphantom is not working for me. Like I said, Pages has a very limited set of Latex. I have tried \phantom and it almost works. The matrices got equal sizes but the alignment is gone. BTW that is the meaning of having bmatrix and bmatrix*? – SpaceDog May 25 '18 at 1:55

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.