2

\newbieallert

This is what I want to accomplish:

s = a + b + c
  +  de + fg
  +     h

1 Answer 1

3

As suggested in the comments, you can use the array environment inside an equation.

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\begin{document}

\begin{equation}
\begin{array}{rc}
s =& a + b + c\\
  +&  de + fg\\
  +&     h
\end{array}
\end{equation}

\end{document}
7
  • The right side of the equation will be left aligned, not centered + de + fg
    – Erik Neves
    Commented May 25, 2020 at 0:57
  • 1
    Sorry, I didn't see that in my browser. Check the update @ErikNeves Commented May 25, 2020 at 1:12
  • That update is perfect. Thank you!
    – Erik Neves
    Commented May 25, 2020 at 1:41
  • @SebastiánV.Romero Can you explain what \newcolumntype{R}{>{$}r<{$}} and \newcolumntype{C}{>{$}c<{$}} do? I don't understand how they are able to enforce the constraints required by OP.
    – lazulikid
    Commented May 25, 2020 at 5:40
  • 2
    You can just use \begin{equation} \begin{array}{rcc} s &=& a + b + c\\ &+& de + fg\\ &+& h \end{array} \end{equation}. There is no need for a tabular and switching back and forth between math and text mode.
    – user194703
    Commented May 25, 2020 at 6:54

You must log in to answer this question.

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