[Tex/LaTex] Long dashes for denoting omitted columns of a matrix

matrices

Mathematicians would often to like to think of a row of a m by n matrix with entries from a , say, field, as a vector in the n-dimensional vector space over the field.

Though I am not a mathematician yet, I am stuck with a situation where my proof becomes significantly simpler if I did not care about the entries of the row but just think of it as a vector.

For instance, I'd like my rows to look like how the columns look here. The code for one of the matrices there:

$P=
\begin{bmatrix} 
\biggl |& \biggl|&\biggl|\\
x_1&x_2 &x_3\\
\biggl|&\biggl|&\biggl|
\end{bmatrix}$

I'd be grateful if some one helped me.

Best Answer

Here's a way, inspired by \rightarrofill:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\longdash}[1][2em]{%
  \makebox[#1]{$\m@th\smash-\mkern-7mu\cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill\mkern-7mu\smash-$}}
\makeatother
\newcommand{\omitskip}{\kern-\arraycolsep}
\newcommand{\llongdash}[1][2em]{\longdash[#1]\omitskip}
\newcommand{\rlongdash}[1][2em]{\omitskip\longdash[#1]}

\begin{document}
\[
\begin{bmatrix}
\llongdash & x_{1}   & \rlongdash \\
\llongdash & x_{2}+y & \rlongdash \\
\llongdash & x_{n}   & \rlongdash
\end{bmatrix}
\]
\end{document}

I use \llongdash and \rlongdash to back up slightly and so to ensure the correct alignment of the dashes.

enter image description here

If dots are needed for denoting omitted rows, one can use \hdotsfor:

\begin{bmatrix}
\llongdash & x_{1}   & \rlongdash \\
\llongdash & x_{2}+y & \rlongdash \\
\hdotsfor{3} \\
\llongdash & x_{n}   & \rlongdash
\end{bmatrix}

instead of the code above will produce

enter image description here

Alternatively, one can use only one column

\[
\begin{bmatrix}
\longdash\hfill x_{1} \hfill \longdash \\
\longdash\hfill x_{2} + y \hfill \longdash \\
\longdash\hfill x_{n} \hfill \longdash \\
\end{bmatrix}
\]

and get

enter image description here

Related Question