# Is there any way to put \ddots in an "x" shape?

I tried using this code but ir isn't the result I wanted

\newcommand{\xdots}{\ensuremath{{}^\cdot_\cdot}\cdot^\cdot_\cdot}


It has to go into this matrix

$$B_j\rightarrow\tilde{B}_j=\begin{pmatrix}a_{11}&\dots&a_{1,j-1}&0&a_{1,j+1}&\dots&a_{1n}\\\vdots&\ddots&\vdots&\vdots&\vdots&\ddots&\vdots\\a_{i-1,1}&\dots&a_{i-1,j-1}&0&a_{i-1,j+1}&\dots&a_{i-1,n}\\0&\dots&0&1&0&\dots&0\\a_{i+1,1}&\dots&a_{i+1,j-1}&0&a_{i+1,j+1}&\dots&a_{i+1,n}\\\vdots&\xdots&\vdots&\vdots&\vdots&\ddots&\vdots\\a_{n11}&\dots&a_{n,j-1}&0&a_{n,j+1}&\dots&a_{nn}\end{pmatrix}$$


Instead of \ddots but the upper and lower dots are smaller in my way, if there isn't a way i will use \ddots

I am inspired by the definition of \ddots macro and I suggest to define:

\def\xdots{\mathinner{\mkern1mu
\raise.1em\hbox{.}\kern-.33em{\ddots}\kern-.33em\raise.7em\hbox{.}\mkern1mu}}


Here, I reflect \ddots and superimpose it to create the X shape of dots.

EDITED to address row spacing issue raised by barbara.

\documentclass{article}
\usepackage{amsmath,graphicx}
\newcommand\xdots{\ooalign{$\ddots$\cr\scalebox{-1}[1]{$\ddots$}}}
\begin{document}
$B_j\rightarrow\tilde{B}_j=\begin{pmatrix} a_{11}&\dots&a_{1,j-1}&0&a_{1,j+1}&\dots&a_{1n}\\ \vdots&\ddots&\vdots&\vdots&\vdots&\ddots&\vdots\\ a_{i-1,1}&\dots&a_{i-1,j-1}&0&a_{i-1,j+1}&\dots&a_{i-1,n}\\[5pt] 0&\dots&0&1&0&\dots&0\\[3pt] a_{i+1,1}&\dots&a_{i+1,j-1}&0&a_{i+1,j+1}&\dots&a_{i+1,n}\\ \vdots&\xdots&\vdots&\vdots&\vdots&\ddots&\vdots\\ a_{n11}&\dots&a_{n,j-1}&0&a_{n,j+1}&\dots&a_{nn} \end{pmatrix}$
\end{document}


• Nice! The same as I did, but with much less work :). What does \ooalign do? Jan 30, 2018 at 11:43
• @PhelypeOleinik \ooalign is a TeX primative for superimposing things. It is defined on p.356 of the TeXbook. Jan 30, 2018 at 11:45
• Thanks for that! I'm on page 74 yet :) Jan 30, 2018 at 11:49
• @PhelypeOleinik This answer from egreg contains a nice explanation of \ooalign, if you don't want to skip 300 pages ;-) Jan 30, 2018 at 12:09
• irrelevant to answer, but the line with the zeros is really too close to the adjacent lines. Jan 30, 2018 at 13:46

Here's a different approach of what you suggested.

The macro \xdots first saves a \ddots in a box. Then this box is used to place the \ddots, and then a negative \hskip of the width of the box is applied to return to the original position. Finally, a \reflectbox is used to place the other part of the X.

\documentclass{article}

\usepackage{amsmath}
\usepackage{graphicx}

\newcommand{\xdots}{%
\newbox\dotsbox%
\savebox\dotsbox{$$\ddots$$}%
\usebox\dotsbox\hskip-\wd\dotsbox\relax%
\reflectbox{$$\ddots$$}%
}

\begin{document}

$$B_j\rightarrow\tilde{B}_j=\begin{pmatrix}a_{11}&\dots&a_{1,j-1}&0&a_{1,j+1}&\dots&a_{1n}\\\vdots&\ddots&\vdots&\vdots&\vdots&\ddots&\vdots\\a_{i-1,1}&\dots&a_{i-1,j-1}&0&a_{i-1,j+1}&\dots&a_{i-1,n}\\0&\dots&0&1&0&\dots&0\\a_{i+1,1}&\dots&a_{i+1,j-1}&0&a_{i+1,j+1}&\dots&a_{i+1,n}\\\vdots&\xdots&\vdots&\vdots&\vdots&\ddots&\vdots\\a_{n11}&\dots&a_{n,j-1}&0&a_{n,j+1}&\dots&a_{nn}\end{pmatrix}$$

\end{document}


You can obtain it with the \adots glyph from yhmath, superimposed to \ddots. Here are two ways:

\documentclass{article}
\usepackage[utf8]{inputenc}%
\usepackage{xcolor}
\usepackage{mathtools, yhmath}
\usepackage{stackengine}
$\xdots\qquad \sixdots$%