14

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.

0

2 Answers 2

10

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

0
5

Here is a solution based on TikZ:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}

% possible to customize here the dash aspect
\newcommand{\mydash}{
\draw(0.3,0.5ex)--(-0.3,0.5ex);
}

\begin{document}
\[P=
\begin{tikzpicture}[baseline=-0.5ex]
\matrix(m)[matrix of math nodes,left delimiter=(,right delimiter=),ampersand replacement=\&]
{
\mydash \&   y_1 \&   \mydash   \\
\mydash \&   y_2+z_2 \&  \mydash    \\
\mydash \&   y_3 \&   \mydash \\
};
\end{tikzpicture}
\]

\end{document}

which gives:

enter image description here

1
  • Thank you very much. I am not good with Tikz yet. But, I thank you for posting a solution. :)
    – kan
    Commented May 26, 2012 at 13:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .