2

I would like to do something like

\begin{align*}
\flushleft A(x) = \\
\flushright B(x) \\
\flushright + C(x)
\end{align*}

My problem is to set a nice layout for this long equation, where I have to cut a sum in multiple lines.

enter image description here

2

Environment multline of package amsmath has \shoveleft and \shoveright for flush right and left:

\documentclass[a5paper]{article}
\usepackage{amsmath}
\begin{document}
  \begin{multline*}
    % First line is flush left
    A(x) = \\
    % Move to the right, default is centered
   \shoveright{B(x)} \\
    % Last line is flush right
    + C(x)
  \end{multline*}
\end{document}

Result

Variation

Alignment point is set for the relational operators. The parts left of the less signs are right aligned, the parts right of the alignment point is left aligned:

\documentclass[a5paper]{article}
\usepackage{amsmath}
\begin{document}
  \begin{align*}
    A(x) & \leq \\
    B(x) \\
    {} + C(x) & < 3 \epsilon
  \end{align*}
\end{document}

Result

1

I'd avoid “flush right”:

\documentclass{article}
\usepackage{amsmath}

\newcommand\diff{\mathop{}\!\mathrm{d}}

\begin{document}

\begin{align*}
& \biggl|
    \int_{[0,1]^n}
    f\Bigl(\frac{x_1+\dots+x_n}{n}\Bigr)
    \diff x_1 \dots \diff x_n
    -f(1/2)
  \biggr|
\\
&\qquad\le
  \int_{[0,1]^n}
  \biggl|
    (f-p)\Bigl(\frac{x_1+\dots+x_n}{n}\Bigr)
  \biggr|
  \diff x_1 \dots \diff x_n
\\
&\qquad\qquad+\lvert p(1/2)-f(1/2)\rvert\vphantom{\int}
\\
&\qquad\qquad+
  \biggl| 
    \int_{[0,1]^n} 
    p\Bigl(\frac{x_1+\dots+x_n}{n}\Bigr)
    \diff x_1 \dots \diff x_n
    -p(1/2)
  \biggr|
\\
&\qquad<3\varepsilon
\end{align*}

\end{document}

enter image description here

  • I finally chose your solution but the other answer addresses better the question asked... Thanks! – Colas Nov 1 '16 at 17:26

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.