1

I have always tried to achieve this but after a few tries decided to skip and concentrate on writing instead of solving it.

I am using align environment and trying to align the multiple lined equations to the right except the first line. It is even better if this works with some equation marks are aligned. For example:

\begin{align*}
  x &= a + b \\
    + c + d \\ % this line should be aligned to the right
  y &= a + b \\
    + c + d + e % this should be aligned right too
\end{align*} % equals signs should be aligned as well

It should look something like this: right aligned except first

1

Something like that?

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

\begin{document}

\begin{alignat*}{2}
  x &= a + b &\\[-1ex]
    & & {} + c + d & \\ % this line should be aligned to the right
  y &= a + b \\[-1ex]
    & & \mathllap{{}+ c + d + e} & % this should be aligned right too
\end{alignat*}

\end{document}

enter image description here

0

I recommend the usage of the simple command \hspace{xcm}. The \hspacecommand when put infront of an equation, pushes it farther towards the right and the shift is basically defined by the user in cm. I haven't tried left shifts but I guess negative values within the braces can get the job done.

Additionally, to align the equations, one can use an ampersand to denote the starting point of the alignment

\begin{align*} x =& a + b \\ &\hspace{1cm}+ c + d \\ % this line should be aligned to the right y =& a + b \\ &\hspace{0.5cm}+ c + d + e % this should be aligned right too \end{align*} % equals signs should be aligned as well

The updated code works fine. Give it a try. I'm just too lazy to put the picture again ;)

enter image description here

  • the spacing after the = signs is wrong. either put the & before the = (as recommended) or put {} after each = sign. – barbara beeton Feb 18 '16 at 1:44

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.