# Vertical dotted column in matrix

If I wanted to "draw" dots in entire row, I'd use for expample \hdotsfor{4}, but how can I "draw" an entire column with dots, I haven't found something like \vdotsfor. With \hdotsfor{5} we get this,

\documentclass[11pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{lmodern} % load a font with all the characters
\begin{document}
$$\begin{bmatrix} x_{11} & x_{12} & x_{13} & \dots & x_{1n} \\ x_{21} & x_{22} & x_{23} & \dots & x_{2n} \\ \hdotsfor{5} \\ x_{d1} & x_{d2} & x_{d3} & \dots & x_{dn} \end{bmatrix}$$

\end{document}


But how can I do something like this:

• It would help to see some code. What environment are you using? – Steven B. Segletes Apr 12 '16 at 18:45
• @StevenB.Segletes I updated the post. – Gjekask Apr 12 '16 at 19:50
• Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackages, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – erik Apr 12 '16 at 22:58
• @erik I'm very sorry. This is my first post at tex.sx. I wrote the all the code now. – Gjekask Apr 13 '16 at 7:22
• @Gjekask No worries, and welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. I was just trying to point out that example code should be complete. It's a boilerplate response, so sorry if it came across as curt. – erik Apr 13 '16 at 13:35

You can get inspiration from the macro \vdotfill<number of lines> shown in this code:

\def\vdotfill#1{\vtop to0pt{\null \dimen0=#1\baselineskip\advance\dimen0 by-.4ex

$$\pmatrix{ x_{11} & x_{12} & x_{13} & \vdotfill4 & x_{1n} \cr x_{21} & x_{22} & x_{23} & & x_{2n} \cr \multispan3 \dotfill & & \dotfill \cr x_{d1} & x_{d2} & x_{d3} & & x_{dn} }$$

\bye


With the lastest version of nicematrix, it's very easy.

\documentclass[11pt, a4paper]{article}
\usepackage{nicematrix}
\NiceMatrixOptions{transparent,nullify-dots}
\begin{document}
$\begin{bmatrix} x_{11} & x_{12} & x_{13} & \vdots & x_{1n} \\ x_{21} & x_{22} & x_{23} & & x_{2n} \\ \hdotsfor{3} & & \hdotsfor{1}\\ x_{d1} & x_{d2} & x_{d3} & & x_{dn} \end{bmatrix}$
\end{document}


This is probably a horrible idea because it is more a brute-force method, but here's how I would do it:

\documentclass[12pt,a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{matrix}

\begin{document}

\begin{tikzpicture}
\matrix(m)[matrix of math nodes, row sep=2em, column sep=2em, text height=1.5ex, text depth=0.25ex]
{ x_{11} & x_{12} & x_{13} & \phantom{x_{21}} & x_{1n} \\
x_{21} & x_{22} & x_{23} & \phantom{x_{21}} & x_{2n} \\
\phantom{x_{21}} & \phantom{x_{21}} & \phantom{x_{21}} & \phantom{x_{21}} & \phantom{x_{21}} \\
x_{d1} & x_{d2} & x_{d3} & \phantom{x_{21}} & x_{dn} \\ };
\draw[loosely dotted] (m-3-1.west) -- (m-3-5.east);
\draw[loosely dotted] (m-1-4.north) -- (m-4-4.south);
\end{tikzpicture}

\end{document}


If need be, you can also shorten either end of the lines with the "shorten <= xpt", "shorten >= xpt" option. And you can also embed this picture into an equation like this: Align an equation and a tikz picture with anchor and baseline