# [texhax] Amstex problem: sideset or operatorname

Philip G. Ratcliffe philip.ratcliffe at fastwebnet.it
Mon Jul 2 01:22:27 CEST 2007

> I am trying to use the \sideset option to create a macro
> which prints one argument (say v) inside brackets, with a
> "subscript", on the left of the left bracket.  The code for
> the macro is
> **************************************************************
> \newcommand{\matrepvec}[2]{\ensuremath{\sideset{_{#1}}{}{\oper
atorname{\lbrack #2\rbrack}}}}
> **************************************************************
>
> It gives me the effect I want, but has curious behavior with
> respect to variable #2:  when I
> invoke
>
> $\matrepvec{B}{\vec{v}}$
>
> I get not v surmounted by an arrow, but v tilde (or something
> like it) inside the brackets.  What is causing this?

Well, that's what you get for "misusing" macros (the ams manual does warn
you).

Try looking at the "tensor" package; the following should then provide what
you want:

\newcommand{\matrepvec}[2]{\ensuremath{\tensor[_{#1}]{\lbrack #2\rbrack}{}}}

And if you want the letter "v" in Roman and not math italics (you did notice
that didn't you?*) then use, eg,

$\matrepvec{B}{\vec{\mathrm{v}}}$

Cheers,  Phil

* Can you guess what the problem is now?