3

How can I make the top of the aligned pack vertically aligns with the x ->? How can I use a box or something to achieve this? (There are other options of course but I would like to use box or something ...?)

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
          f(x) : \quatS \quad &\maps \quad \quatS \\
                        x \quad &\mapsto \quad 
          \begin{aligned}
             &f(x) = \\
             &g \circ h(x) 
          \end{aligned}
\end{align}
\end{document}

enter image description here

  • \quatS and \maps are not defined. – Heiko Oberdiek Sep 7 '15 at 9:02
5

Environment has an optional argument for the vertical position, e.g.:

\documentclass{article}
\usepackage{amsmath}
\providecommand*{\quatS}{QS}% some dummy
\providecommand*{\maps}{\rightarrow}% some dummy
\begin{document}
\begin{align}
          f(x) : \quatS \quad &\maps \quad \quatS \\
                        x \quad &\mapsto \quad
          \begin{aligned}[t]
             &f(x) = \\
             &g \circ h(x)
          \end{aligned}
\end{align}
\end{document}

Result

  • ahh, did not found that in the ams manual – Gabriel Sep 7 '15 at 11:09
  • 2
    @Gabriel It's mentioned in section 3.7 (first sentence on page 8). – Torbjørn T. Sep 7 '15 at 12:24
1

Here's a stackengine approach. It seems to get the vertical alignments slightly better than the aligned alternative (i.e., the "Q", the "f" and the "g" alignment).

\documentclass{article}
\usepackage{amsmath,stackengine}
\stackMath
\providecommand*{\quatS}{QS}% some dummy
\providecommand*{\maps}{\rightarrow}% some dummy
\begin{document}
\begin{align}
          f(x) : \quatS \quad &\maps \quad \quatS \\
                        x \quad &\mapsto \quad 
             \def\stackalignment{l}\def\stacktype{L}
             \stackunder{
             f(x) = }{
             g \circ h(x)
          }
\end{align}
\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.