## LaTeX forum ⇒ Math & Science ⇒ Inline Column Vectors

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
georgefrost123
Posts: 2
Joined: Mon Mar 08, 2010 11:49 pm

### Inline Column Vectors

Hi,

I'm new both to LaTeX and to the forum - nice to meet you all!

I've been having a problem getting column vectors to display in a way that they don't interrupt the flow of the text. I have 3-vectors that I'd ideally like to display inline with minimal disruption to the line spacing above or below.

Currently I've been using:

\newcommand{\tvect}[3]{ \begin{pmatrix} #1 \\ #2 \\ #3 \end{pmatrix} }...$\tvect{1}{2}{3}$

to define the 3-vector, but that's making a huge vector and messing up the flow of the text.

Thanks,
George

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm
Hi,

you could try using the smallmatrix environment:

\documentclass{article}\usepackage{amsmath} \newcommand{\tvect}[3]{%   \ensuremath{\Bigl(\negthinspace\begin{smallmatrix}#1\\#2\\#3\end{smallmatrix}\Bigr)}} \begin{document} text text text text text text text text text text text text text text text text text text text text $\tvect{1}{2}{3}$ text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text \end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...

georgefrost123
Posts: 2
Joined: Mon Mar 08, 2010 11:49 pm
That's exactly what I was looking for, thanks! Didn't know the smallmatrix environment existed.

Is is possible to centralise (or right-align) the elements in the matrix?


Don't worry; you can ask as many questions as you wish.

\ensuremath is a LaTeX2e command that ensures that its argument is typeset always in math mode by enclosing it, if necessary, with signs. \negthinspace, \negmedspace and \negthickspace are commands implemented by the amsmath package to produce negative horizontal spacing; their default value is 3mu, 4mu plus 2mu minus 4mu, and 5mu plus 5mu, respectively. Those commands can be used both in text and math mode. 1,1,2,3,5,8,13,21,34,55,89,144,233,... gmedina Posts: 2313 Joined: Wed Jul 11, 2007 11:45 pm There was an extra \hfil command in the definition of rsmallmatrix; here's the corrected version: % smallmatrix with right alignment\newenvironment{rsmallmatrix}{\null\,\vcenter\bgroup \Let@\restore@math@cr\default@tag \baselineskip6\ex@ \lineskip1.5\ex@ \lineskiplimit\lineskip \ialign\bgroup\hfil\m@th\scriptstyle##$&&\thickspace\hfil$\m@th\scriptstyle##\$\crcr}{%   \crcr\egroup\egroup\,%}
1,1,2,3,5,8,13,21,34,55,89,144,233,...

kamrul
Posts: 3
Joined: Wed Sep 01, 2010 9:12 am
Thanks! great work.