2

I define the \underin command to make its first argument apper below its second argument with a rotated \in in between. It looks small, so I also define a command \dunderin by adding a \displaystyle into \underin. Here is the code:

\documentclass{article}
\usepackage{amsmath,mathtools}

\newcommand{\underin}[2]{
    \ensuremath{\underset{\substack{
        \rotatebox{90}{$\in$} \\
        \mathclap{#1}
    }}{#2}}
}

\newcommand{\dunderin}[2]{
    \underin{\displaystyle#1}{#2}
}

\begin{document}
\[
\underin{a}{A} \underin{b}{B} \underin{c}{C} \quad
\dunderin{a}{A} \dunderin{b}{B} \dunderin{c}{C}
\]
\end{document}

And here is the result:

enter image description here

It looks like in the first case the content is aligned by the median line, and by the ascender in the second. But why?

I know how to solve the problem by inserting \vpantom in each \dunderin, but I also would be interested in a solution using some sort of array environment to align it properly in an easily extendable way. The goal is to produce something similar to the following picture:

enter image description here

1
  • Try \newcommand{\dunderin}[2]{ \underin{\displaystyle\strut#1}{#2} } Commented Aug 19, 2015 at 10:45

1 Answer 1

3

By adding a \strut to your definition, as noted in my comment, I think it takes care of things (at least for this MWE).

\documentclass{article}
\usepackage{amsmath,mathtools}

\newcommand{\underin}[2]{
    \ensuremath{\underset{\substack{
        \rotatebox{90}{$\in$} \\
        \mathclap{#1}
    }}{#2}}
}

\newcommand{\dunderin}[2]{
    \underin{\displaystyle\strut#1}{#2}
}

\begin{document}
\[
x \in \dunderin{a_1}{A}\cdot \dunderin{b_2}{BB} \cdot \dunderin{c_3,d_4}{CCC}
   \cdot \dunderin{e^f}{I}
\]
\end{document}

enter image description here

If, as the OP indicates, there is the need to handle undersets of different vertical sizes, a TABstack approach can handle that:

\documentclass{article}
\usepackage{mathtools,tabstackengine}
\stackMath

\def\swin{\protect\rotatebox{90}{$\in$}}

\begin{document}
\[
\TABbinary
x \in \tabbedShortunderstack{
  A& \cdot & BB & \cdot & CCC & \cdot & I\\
\swin&&\swin&&\swin&&\swin \\
  a_1 && b_2 && c_3,d_4 &&\frac{e^f}{2}
}
\]
\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 .