latex code for block matrix [duplicate]

could anyone help me how to write in latex suc kind of matrix? I tried for the first one but didnt get exact form..thanks for helping

marked as duplicate by Stefan Pinnow, Romain Picot, Seamus, Community♦Jul 5 '16 at 10:47

\documentclass{article}
\usepackage{amsmath}
\usepackage{lmodern}
\begin{document}
$\left[ \begin{matrix} L_{\varepsilon_1} & & & & 0\\ & L_{\varepsilon_2} & & & \\ & & \ddots & & \\ & & & L_{\varepsilon_r} & \\ & & & & A_p+\lambda B_p\\ \end{matrix} \right]$
\end{document}


• (+1) if you have amsmath package loaded, why than not use \begin{bmatrix} ...\end{bmatrix} from it and erase \left[ and right]? – Zarko Jul 5 '16 at 9:35
• @Zarko: just because I'm too lazy to remember english names for () [] || ;-) – Ignasi Jul 5 '16 at 10:16

I tried to reproduce as faithfully the image in the post:

\documentclass{article}
\usepackage{mathtools}
\usepackage{mathptmx}
\usepackage{makebox, bigstrut}
\newcommand\mydot{\makebox*{$L_{\varepsilon}$}{.}}
\usepackage{array}

\begin{document}

$% \setlength\arraycolsep{-1.2pt} \setlength\extrarowheight{-0.2ex} \setlength\bigstrutjot{3pt} \begin{bmatrix} L_{\varepsilon_1} & & & & & & 0\bigstrut[t]\\ & L_{\varepsilon_2} \\ & & \mydot \\ & & & \mydot \\& & & & \mydot \\ & & & & & L_{\varepsilon_p}\\ & & & & & & A_p {+} \lambda B_p \bigstrut \end{bmatrix}$%

\end{document}