5

Following

\documentclass[varwidth]{standalone}
\usepackage{amsmath}
\usepackage{stackengine}
\usepackage{xcolor}
\renewcommand{\vec}[1]{\mathbf{#1}}

\begin{document}
\stackMath
\begin{equation*}
    \mathcal{G} = \stackunder{p6mm}{\vec{a},\vec{b}} \overset{t[\mathit{3}]}{>}
    \mathcal{Z} = \stackunder{c2mm}{\braceVectorstack{{\vec{a}-\vec{b},\vec{a}+\vec{b}} {\vec{a}+2\vec{b},-\vec{a}} {\textcolor{red}{2\vec{a}+\vec{b},\vec{b}}}}}
\end{equation*}
\end{document}

gives

enter image description here

I want to add another block in separate curly braces into the understack and have only a brace on the left side. See the image modified with an image editor:

enter image description here

Nesting of \Shortunderstack{ \braceVectorstack{} ...} looks like is not possible. The naive attempt

    \mathcal{Z} = \Shortunderstack{{c2mm} {\braceVectorstack{{\vec{a}-\vec{b},\vec{a}+\vec{b}} {\vec{a}+2\vec{b},-\vec{a}} {\textcolor{red}{2\vec{a}+\vec{b},\vec{b}}}}}}

gives me

l.12 ...xtcolor{red}{2\vec{a}+\vec{b},\vec{b}}}}}}


./demo.tex:12: Package listofitems Error: 3 is an invalid index, index [] retained.

How can I achieve this with the package stackengine or a different way/package?

The documentation of stackengine states

Except in circumstances that require the particular features of this package, stackengine may not be the best package for math mode since there are many packages that already cater directly to the need to stack and align mathematical objects.

Actually, I only know the package amsmath with \substack, \overset, \underset. I would appreciate if someone could mention a few of the many packages the author is referring to.

8

I'm not quite sure of what the intended output should be, but in this case I'd just go with an array, and maybe also the cases environment from amsmath.

\documentclass{article}

\usepackage{amsmath}

\usepackage{xcolor}
\renewcommand{\vec}[1]{\mathbf{#1}}

\begin{document}
\[
\mathcal{Z} =
\begin{array}[t]{l}
\multicolumn{1}{c}{foo}\\
\begin{cases}
\vec{a}-\vec{b},\vec{a}+\vec{b}\\
\vec{a}+2\vec{b},-\vec{a}\\
\textcolor{red}{2\vec{a}+\vec{b},\vec{b}}
\end{cases}
\\
\begin{cases}
\vec{a}-\vec{b},\vec{a}+\vec{b}\\
\vec{a}+2\vec{b},-\vec{a}\\
\textcolor{red}{2\vec{a}+\vec{b},\vec{b}}
\end{cases}
\end{array}
%
= % second version
%
\begin{array}[t]{l}
\multicolumn{1}{c}{foo}\\
\left\{\begin{array}{@{}c@{}}
\vec{a}-\vec{b},\vec{a}+\vec{b}\\
\vec{a}+2\vec{b},-\vec{a}\\
\textcolor{red}{2\vec{a}+\vec{b},\vec{b}}
\end{array}\right.
\\[4ex]
\left\{\begin{array}{@{}c@{}}
\vec{a}-\vec{b},\vec{a}+\vec{b}\\
\vec{a}+2\vec{b},-\vec{a}\\
\textcolor{red}{2\vec{a}+\vec{b},\vec{b}}
\end{array}\right.
\end{array}
\]

\end{document}

enter image description here

I've written "foo" in the first line because I didn't understand whether c2mm was a typo or not.

  • I was not aware that the baseline is matched with the first row in a top-aligned array. I am happy to have learned this. So thanks for your answer. BTW c2mm is a 2D crystallographic group; it is not a typo. – Hotschke Oct 22 at 13:43
  • @Hotschke Learned something new,,, I wasn't sure because c2mm looked through my TeX glasses like a c column and 2mm... :-) – campa Oct 22 at 13:49
  • The optional argument [pos] of the environments array and tabular is described in the section 8.23 Tabular of the unofficial reference manual for LaTeX2e. The section for array refers to 8.23 for the argument [pos]. This manual is available on ctan, typically on the command line via $ texdoc latex2e, and on latexref.xyz as pdf or html. Also someone converted into a docset for zeal/dash. – Hotschke Oct 23 at 7:29
6

You can use \Shortunderstack with two cases environments or \stackunder with two blocks in a blockarray environment:

\documentclass{article}
\usepackage{mathtools}
\usepackage{blkarray}
\usepackage{stackengine}
\usepackage{xcolor}
\renewcommand{\vec}[1]{\mathbf{#1}}

\begin{document}

\stackMath
\begin{equation*}
    \mathcal{G} = \stackunder{p6mm}{\vec{a},\vec{b}} \overset{t[\mathit{3}]}{>}
    \mathcal{Z} = \Shortunderstack{{c2mm} {\begin{dcases}\begin{matrix}\vec{a}-\vec{b},\vec{a}+\vec{b}\\ \vec{a}+2\vec{b},-\vec{a}\\ \textcolor{red}{2\vec{a}+\vec{b},\vec{b}}\end{matrix}\end{dcases}} { \begin{dcases}\vec{a}-\vec{b},\vec{a}+\vec{b}\\ \vec{a}+2\vec{b},-\vec{a}\\ \textcolor{red}{2\vec{a}+\vec{b},\vec{b}}\end{dcases}}}
\end{equation*}

\begin{equation*}
     \mathcal{G} = \stackunder{p6mm}{\vec{a},\vec{b}} \overset{t[\mathit{3}]}{>}
     \mathcal{Z} = \stackunder{c2mm}{\begin{blockarray}{c}\begin{block}{\{c}\vec{a}-\vec{b},\vec{a}+\vec{b}\\ \vec{a}+2\vec{b},-\vec{a}\\ \textcolor{red}{2\vec{a}+\vec{b},\vec{b}}\\ \end{block}\begin{block}{\{r}\vec{a}-\vec{b},\vec{a}+\vec{b}\\ \vec{a}+2\vec{b},-\vec{a}\\ \textcolor{red}{2\vec{a}+\vec{b},\vec{b}}\\ \end{block}\end{blockarray}}
\end{equation*}

\end{document} 

enter image description here

4

Nesting of \stackunder{anchor}{\stackunder{b1}{\stackunder{b2}{...}}}

I have figured out another solution using stackengine by nesting \stackunder{} and using \left\{\Vectorstack{item1 item2 item3}\right. for the blocks.

\documentclass[varwidth]{standalone}
\usepackage{amsmath}
\usepackage{stackengine}

\begin{document}
\stackMath
\begin{equation*}
      \mathcal{Z} = \stackunder
      {c2mm}
      {\stackunder
         {\left\{\Vectorstack{block1 block1 block1}\right.}
         {\stackunder
           {\left\{\Vectorstack{block2 block2 block2}\right.}
           {\left\{\Vectorstack{block3 block3 block3}\right.}
         }
      }
\end{equation*}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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