# Inserting matrix equation

I have a difficulty inserting a matrix equation in my document. Here is photo of the matrix:

Any idea of how to insert this. Do I have to use tiKz for this ?

• You can do that with TikZ or pst-node. If you can accept dotted lines, you even do not need any of these. – Bernard Feb 5 '18 at 2:00
• what's the distinction between the upright and italic "X"? or should they really be all the same? – barbara beeton Feb 5 '18 at 17:31

Just for fun: something which reproduces your screenshot rather closely.

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\newcommand{\tikznode}[2]{\tikz[remember picture,baseline=(#1.base)]{\node(#1)[inner sep=0pt]{#2};}}
\begin{document}
$X^{(p)}=\begin{bmatrix} \tikznode{11}{\strut} & & 0\\ & & \\ \boldsymbol{L}_x^{(p)} & & \tikznode{33}{\strut}\\[0.2cm] \tikznode{41}{\strut}~~ & & \tikznode{43}{\strut}\\ & \boldsymbol{X}^{(p)}_c &\\[0.2cm] \tikznode{61}{\strut}~~ & & \tikznode{63}{\strut}\\ & & \boldsymbol{U}_x^{(p)}\\ 0 & & \tikznode{83}{\strut} \end{bmatrix}$
\tikz[overlay,remember picture]{\draw[dashed](11.north)--(33.south east);
\draw[-](41.north west)--(43.north east);
\draw[-](61.north west)--(63.north east);
\draw[dashed](61.west)--(83.south east);}
\end{document}


As Bernard mentioned, there are several different ways of producing similar things.

To make Mico a bit happier, here is a more artistic version:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand{\tikznode}[2]{\tikz[remember picture,baseline=(#1.base)]{\node(#1)[inner sep=0pt]{#2};}}
\begin{document}
$X^{(p)}=\begin{bmatrix} \tikznode{11}{\strut} & & \tikznode{13}{\strut}\\ & \tikznode{22}{\strut} & \\ ~~\boldsymbol{L}_x^{(p)} & & \tikznode{33}{\strut}\\[0.2cm] \tikznode{41}{\strut}~~ & & \tikznode{43}{\strut}\\ & \boldsymbol{X}^{(p)}_c &\\[0.2cm] \tikznode{61}{\strut}~~ & & \tikznode{63}{\strut}\\ & \tikznode{72}{\strut} & \boldsymbol{U}_x^{(p)}~~\\ \tikznode{81}{\strut} & & \tikznode{83}{\strut} \end{bmatrix}$
\tikz[overlay,remember picture]{\draw[dashed](11.north)--(33.south east);
\draw[-](41.north west)--(43.north east);
\draw[-](61.north west)--(63.north east);
\draw[dashed](61.west)--(83.south east);
\node at ($(13)!0.2!(22)$) {\Large0};
\node at ($(81)!0.2!(72)$) {\Large0};
}
\end{document}


• +1. The \boldsymbol{L}_x^{(p)}, though, seems to be placed a bit too far to the left, and \boldsymbol{U}_x^{(p)} seems to be placed a bit too far to the right. Is is straightforward to adjust their horizontal alignments? – Mico Feb 5 '18 at 5:51