Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 8 down vote accepted

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

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

share|improve this answer
    
Thank you very much. –  kan May 26 '12 at 13:09

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

share|improve this answer
    
Thank you very much. I am not good with Tikz yet. But, I thank you for posting a solution. :) –  kan May 26 '12 at 13:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.