6

I am trying to write some matrices with latex in Keynote and I cant make them the same height. There are some answers to this problem but can't make them work in Keynote.

The equation looks like this:

 \begin{pmatrix}
 X'\hat R^{-1}X & X'\hat R^{-1}Z_1 & X'\hat R^{-1}Z_2 & X'\hat R^{-1}Z_3 \\
 Z'_1\hat R^{-1}X & Z'_1\hat R^{-1}Z_1 + G^{-1}_1& Z'_1\hat R^{-1}Z_2 & Z'_1\hat R^{-1}Z_3 \\
 Z'_2\hat R^{-1}X & Z'_2\hat R^{-1}Z_1 & Z'_2\hat R^{-1}Z_2 + G^{-1}_2& Z'_2\hat R^{-1}Z_3 \\
 Z'_3\hat R^{-1}X & Z'_3\hat R^{-1}Z_1 & Z'_3\hat R^{-1}Z_2 & Z'_3\hat R^{-1}Z_3 + G^{-1}_3
 \end{pmatrix} 
 \begin{pmatrix}
 \alpha \\ 
 \gamma \\ 
 \delta \\ 
 \epsilon 
 \end{pmatrix} 
 =  
 \begin{pmatrix}
 X'\hat R^{-1}y \\
 Z'_1\hat R^{-1}y \\
 Z'_2\hat R^{-1}y \\
 Z'_3\hat R^{-1}y
 \end{pmatrix}

And I get: enter image description here

0

2 Answers 2

6

As Keynote.app uses a limited set of LaTeX commands (see this page), we cannot have a perfect result. In particular, there's not a \vphantom command available. But with \phantom{\hat{I}_{.}} before \alpha etc., we obtain a not so bad result.

\begin{pmatrix}
 X'\hat R^{-1}X & X'\hat R^{-1}Z_1 & X'\hat R^{-1}Z_2 & X'\hat R^{-1}Z_3 \\
 Z'_1\hat R^{-1}X & Z'_1\hat R^{-1}Z_1 + G^{-1}_1& Z'_1\hat R^{-1}Z_2 & Z'_1\hat R^{-1}Z_3 \\
 Z'_2\hat R^{-1}X & Z'_2\hat R^{-1}Z_1 & Z'_2\hat R^{-1}Z_2 + G^{-1}_2& Z'_2\hat R^{-1}Z_3 \\
 Z'_3\hat R^{-1}X & Z'_3\hat R^{-1}Z_1 & Z'_3\hat R^{-1}Z_2 & Z'_3\hat R^{-1}Z_3 + G^{-1}_3
 \end{pmatrix} 
 \begin{pmatrix}
 \phantom{\hat{I}_{.}}\alpha \\ 
 \phantom{\hat{I}_{.}}\gamma \\ 
 \phantom{\hat{I}_{.}}\delta \\ 
 \phantom{\hat{I}_{.}}\epsilon 
 \end{pmatrix} 
 =  
 \begin{pmatrix}
 X'\hat R^{-1}y \\
 Z'_1\hat R^{-1}y \\
 Z'_2\hat R^{-1}y \\
 Z'_3\hat R^{-1}y
 \end{pmatrix}

enter image description here

For better result, and true LaTeX output, I suggest the use of the app LaTeXit, which is installed by a default MacTeX distribution. With this app, you can export transparent vectoriel images of equations to Keynote.app, and modify it later if needed.

3
  • 1
    space ahead of \alpha, \gamma ... is unuseful.
    – pzorba75
    Commented Apr 4, 2019 at 12:07
  • @pzorba75 with the limited set of available LaTeX commands (in particular, not \vphantom but only \phantom), I don’t have found a way to suppress the little space before \alpha etc. The command \phantom is used here in order to create the necessary vertical space in the second pmatrix environment. Do you know a material with the height of \hat{I}_{.} but with a width of zero which can be create with the limited set of LaTeX command available in Keynote.app?
    – quark67
    Commented Apr 4, 2019 at 12:59
  • Non, I don't know such material or command to suppress the unuseful space.
    – pzorba75
    Commented Apr 5, 2019 at 13:54
4

(It's been pointed out that this solution cannot work with Keynote, since that app knows only a rather limited subset of TeX and LaTeX commands. In particular, \vphantom isn't understood by Keynote. I've decided not to delete this answer, though, as it might come in handy some day for some readers not tied to Keynote.)

You could insert suitably defined typographic struts in each element of the "short" vector.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for 'pmatrix' environment
\newcommand\mystrut{\vphantom{Z'_3\hR}} 
\newcommand\hR{\hat{R}^{-1}} % handy shortcut macro
\begin{document}
\[
\begin{pmatrix}
 X'\hR X & X'\hR Z_1 & X'\hR & X'\hR Z_3 \\
 Z'_1\hR X & Z'_1\hR Z_1 + G^{-1}_1& Z'_1\hR Z_2 & Z'_1\hR Z_3 \\
 Z'_2\hR X & Z'_2\hR Z_1 & Z'_2\hR Z_2 + G^{-1}_2& Z'_2\hR Z_3 \\
 Z'_3\hR X & Z'_3\hR Z_1 & Z'_3\hR Z_2 & Z'_3\hR Z_3 + G^{-1}_3
\end{pmatrix} 
\begin{pmatrix}
 \alpha\mystrut \\ 
 \gamma\mystrut \\ 
 \delta\mystrut \\ 
 \epsilon\mystrut 
\end{pmatrix} 
=  
\begin{pmatrix}
 X'\hR y   \\
 Z'_1\hR y \\
 Z'_2\hR y \\
 Z'_3\hR y
\end{pmatrix}
\]
\end{document}
2
  • Keynote.app doesn't provide access to all LaTeX commands. See my answer.
    – quark67
    Commented Apr 4, 2019 at 0:16
  • @quark67 - Thanks. I've added a disclaimer to the top of my answer.
    – Mico
    Commented Apr 4, 2019 at 7:27

You must log in to answer this question.

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