# [Tex/LaTex] Typesetting inline row vector

amsmathinline()matricesvector

I have (another) question on typesetting inline row vectors.
I'm using amsmath and mathtools. I'm aware of the smallmatrix environment. Unfortunately, the elements of the vector get scaled. This seems completely unnecessary to me. Also the bmatrix environment is not a solution for me, since the delimiters are larger than "normal" text brackets.

I'd like to have something more like

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}
\begin{document}
Text $[\,x^* \quad y^*\,]^*$
$\begin{bmatrix} x^* & y^* \end{bmatrix}^* or \begin{bsmallmatrix} x^* & y^* \end{bsmallmatrix}^*$

\end{document}


Is there a package that can handle this special case for an arbitrary number of elements in the row vector?

I recommend a general solution so that you can change the behaviour later, apart from using a more clean input code. Here's one with expl3.

\documentclass{scrartcl}

\usepackage{xparse,mathtools}

\ExplSyntaxOn

\NewDocumentCommand \vect { s o m }
{
\IfBooleanTF {#1}
{ \vectaux*{#3} }
{ \IfValueTF {#2} { \vectaux[#2]{#3} } { \vectaux{#3} } }
^*
}

\DeclarePairedDelimiterX \vectaux [1] {\lbrack} {\rbrack}
{ \, \dbacc_vect:n { #1 } \, }

\cs_new_protected:Npn \dbacc_vect:n #1
{
\seq_set_split:Nnn \l_tmpa_seq { , } { #1 }
\seq_use:Nn \l_tmpa_seq { \enspace }
}
\ExplSyntaxOff

\begin{document}

Text
$\vect{x^*,y^*}$
$\begin{bsmallmatrix} x^* & y^* \end{bsmallmatrix}^*$

\end{document}


And you can input \vect{x,y,z,t,u,v}, or \vect*{\int,\sum,\prod} or \vect[\Big]{a,b,\frac{n}{z}}, etc. like any other delimiter from \DeclarePairedDelimiter. Substitute \enspace for any space you want.

In case what you want is to input \vect{x,y,z} and get [x^* y^* z^*]^* just change one command
\cs_new_protected:Npn \dbacc_vect:n #1