[Tex/LaTex] Flush left and right in a same equation environment

equationshorizontal alignment

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

Best Answer

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