Evenly spacing matrix elements Rmarkdown

Hi there,

I am trying to figure how to evenly space and centre matrix elements in Rmarkdown. The exmple below should highlight what I mean. As the example shows, the white space around 0's in the 2nd column is different to elsewhere (as there is no "spaced" entry). And the the entries with "spaced" are off centre.

I have come across some LatTex solutions:

But I have not got a clue as to how to translate this into something I can use in Rmarkdown - Is this able to be fixed within Rmarkdown?

\mathbf{G} = \left[\begin{array}
{rrrr}
1 & 0 & spaced & 0 \\
spaced & 0 & 1 & 0 \\
0 & 0 & 1 & spaced \\
0 & 0 & 1 & 0 \\

\end{array}\right]

Also, sorry I don't know how to render the LaTex in the post :slight_smile:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.