# How to write a matrix like this [duplicate]

How to write a matrix like this

I tryed this

$$\begin{pmatrix} J_0 & O &\cdots\\ 0& J_{n+1} & 0\cdots \end{pmatrix}$$


I don't know how to do

## marked as duplicate by user36296, Stefan Pinnow, Alan Munn, Mensch, Andrew SwannMay 30 '18 at 17:08

• There are dozens of block matrix questions on the site, see e.g. tex.stackexchange.com/a/216458/82917. – campa May 30 '18 at 15:59
• @campa how to do the points between J_r and J_{n+1} – Poline Sandra May 30 '18 at 16:01
• That's simply \ddots. – campa May 30 '18 at 16:02
• @campa it do not work – Poline Sandra May 30 '18 at 16:07
• @PolineSandra - Please be more specific as to what "it do[es] not work" entails. – Mico May 30 '18 at 16:13

Does one of these examples work for you?

\documentclass[preview]{standalone}

\usepackage{amsmath}

\begin{document}
$$\begin{pmatrix} J_0 & 0 & \cdots & 0 \\ 0 & J_{n+1} & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & J_r \end{pmatrix}$$
$$\begin{pmatrix} J_0 & 0 & \cdots & \\ 0 & J_{n+1} & \cdots & \\ \vdots & \vdots & \ddots & \\ & & & J_r \end{pmatrix}$$
\end{document}


Result: I personally like the left one better, it leaves less room for mis-interpretation.

See Why is $...$ preferable to $$...$$? for why I used $$ $$ instead of $$ $$.

• Thank you, see if you can help me here tex.stackexchange.com/questions/434179/… – Poline Sandra May 30 '18 at 16:59
• @PolineSandra Surely this answer simply duplicates the question you link to in your comment? And please, instead of just posting images in your questions, please show complete compilable code that shows what you've tried. – Alan Munn May 30 '18 at 17:01
• @PolineSandra In addition to what Alan Munn wrote, with which I completely agree, if this answer solves your question please mark it as accepted. – Max May 30 '18 at 17:06
• no it is not the same i have a decalage 4 colums at 1 5 in the second line how to do ? – Poline Sandra May 30 '18 at 17:14
• It is not exactly the same matrix, but you should be able to rework this answer to output the matrix in the other question. The macros and environments are the same. – Max May 30 '18 at 17:16