# A matrix representation of certain matrix in LaTeX

How can we write the following statement with the matrix form in the LaTeX ? (We wish to represent it in the matrix form)

By $\delta_{ij}(a)$  we mean a n by n matrices
in $M_n(\mathbb{R})$ which has only one nonzero
entry $a$ at $i$, th row and j th column.


If I understand well, is it something like this you want?

\documentclass{article}
\usepackage{fourier}
\usepackage{amsmath}
\usepackage{blkarray, bigstrut}

\begin{document}

\begin{equation*}
\begin{blockarray}{rl@{}c@{}r}
& & \makebox[0pt]{column $j$} \\[-0.5ex]
& & \,\downarrow \\[-0.5ex]
\begin{block}{r(l@{}c@{}r)}
& \makebox[3.1em]{\Large $0$\bigstrut[t]} & \vdots &\makebox[4.2em]{\Large $0$} \\[-0.2ex]
\text{row }i \to \mkern-9mu & \raisebox{0.5ex}{\makebox[3.2em][l]{\dotfill}} & 1 & \raisebox{0.5ex}{\makebox[4.2em][r]{\dotfill}} \\[-1ex]
& \makebox[3.1em]{\Large $0$} & \vdots &\makebox[4.2em]{\bigstrut\Large $0$} \\
\end{block}
\end{blockarray}
\end{equation*}

\end{document}


With {NiceMatrix} of the package nicematrix.

\documentclass{article}
\usepackage{nicematrix}
\usepackage{tikz}

\begin{document}

\NewDocumentCommand{\zero}{}{\Block{}<\Large>{0}}

$\begin{NiceMatrix}[nullify-dots,columns-width=4mm,xdots/shorten=5pt] \CodeBefore \SubMatrix({3-2}{5-4}) \Body & & \clap{column$j$} \\ & & \downarrow \\[1mm] & \zero & \Vdots & \zero \\ \text{row } i \to & \Cdots & 1 & \Cdots \\ & \zero & \Vdots & \zero \end{NiceMatrix}$

\end{document}


You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

• Thank you very much for your answer May 4, 2021 at 15:37