4

How do I typeset two vectors shifted vertically by half a column height with a scaled line in between? Also, the spacing should preferably not be too large.

enter image description here

The closest I got so far is

$\left.
\raisebox{-0.3ex}{\begin{smallmatrix}a\\a\\s\end{smallmatrix}}
\middle|
raisebox{0.3ex}{\begin{smallmatrix}s\\a\\a\end{smallmatrix}}
\right.$

However, Lyx gives me a bunch of errors about missing "$"s, which makes me think I'm not supposed to put a smallmatrix inside a raisebox. Also, the amount of vertical shift is pure guesswork. Is there a better way to do this?

2 Answers 2

1

What you have basically works, you just need to put $...$ around the smallmatrix environments.

Here is a fancier version that defines a macro for constructing your matrices. The syntax is

$\shiftedcolumns{a,a,s}{s,a,a}$

This produces what you want:

enter image description here

The macro accepts columns of arbitrary length, and the lengths on both sides can be different, so something like $\shiftedcolumns{a,b,c,d}{d,e,f,g,h}$ is fine:

enter image description here

Here is the full code:

\documentclass{amsart}
\usepackage{etoolbox}
\newcommand\MatrixColumn[1]{%
  \def\sep{\relax\gdef\sep{\\}}% put a \\ between columns
  \begin{smallmatrix}\forcsvlist{\sep}{#1}\end{smallmatrix}%
}
\newcommand\shiftedcolumns[2]{\left.\raisebox{-0.3ex}{$\MatrixColumn{#1}$}\middle|%
                                    \raisebox{0.3ex}{$\MatrixColumn{#2}$}\right.}

\begin{document}
  $\shiftedcolumns{a,a,s}{s,a,a}$

  \bigskip

  $\shiftedcolumns{a,b,c,d}{d,e,f,g,h}$
\end{document}

The \shiftedcolumns is essentially what you had except that it uses \MatrixColumn to typeset the matrix. This is done using a for-loop, \forcsvloop from the etoolbox package, inside a smallmatrix command.

1

Adding the missing $s

\documentclass{article}
\usepackage{amsmath}

\begin{document}
$\left.
\raisebox{-0.3ex}{$\begin{smallmatrix}a\\a\\s\end{smallmatrix}$}
\middle|
\raisebox{0.3ex}{$\begin{smallmatrix}s\\a\\a\end{smallmatrix}$}
\right.$
\end{document} 

enter image description here

You must log in to answer this question.

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