Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

My MWE:

\documentclass{report}
\usepackage{amsmath}

\begin{document}

\begin{align}
&u = \frac{1}{\theta_{2,3}} \left [ -z_1 - \left ( c_2 + \frac{\epsilon}{2} \right )z_2 - \theta_{2,1}\sin(x_1) - \hat{\theta}_{2,2}x_2 + \dot{\alpha}_1 \right ] \\ 
&\dot{\xi}_{2,2} = - \frac{\partial \beta_2}{\partial x_2}\left [ \theta_{2,1}\sin(x_1)+\left ( \xi_{2,2}  + \beta_2(x_2) \right ) x_2 + \theta_{2,3}u \right ]  \\
&\hat{\theta}_{2,2} = \xi_{2,2} + \beta_2(x_2) \\
&\beta_2 =  \frac{\gamma}{2}x_2^2 
\end{align}

\end{document}

The result: enter image description here

What I want: enter image description here

That is, next to the left alignment, I want to align the equal signs of equations (2) to (4).

share|improve this question
    
align always aligns with the left-hand side aligned to the right before the sign of relation. you'd be better off using alignat, for which you need to explicitly indicate where you want spacing. –  barbara beeton Aug 6 at 17:21

1 Answer 1

up vote 4 down vote accepted

If you want two alignment points for the last three equations, you can use the alignat environment, combined with \mathrlap command, defined in mathtools (which loadsamsmath`):

\documentclass{report}
\usepackage{mathtools}

\begin{document}

\begin{alignat}{2}
&u \mathrlap{{}=\frac{1}{\theta_{2,3}} \left [ -z_1 - \left ( c_2 + \frac{\epsilon}{2} \right )z_2 - \theta_{2,1}\sin(x_1) - \hat{\theta}_{2,2}x_2 + \dot{\alpha}_1 \right ]} \\
&\dot{\xi}_{2,2} &&= - \frac{\partial \beta_2}{\partial x_2}\left [ \theta_{2,1}\sin(x_1)+\left ( \xi_{2,2}  + \beta_2(x_2) \right ) x_2 + \theta_{2,3}u \right ]  \\
 & \hat{\theta}_{2,2} & &= \xi_{2,2} + \beta_2(x_2) \\
&\beta_2 &&= \frac{\gamma}{2}x_2^2
\end{alignat}

\end{document} 

enter image description here

share|improve this answer
    
Why do you use \begin{alignat}{3}? It is not enough with \begin{alignat}{2}? –  skpblack Aug 6 at 18:05
    
I forgot to go back to 2. I always do that to have the possibility to add an ampersand or two if required on testing. I'll reset the correct value at once.You're right, it might be confusing. –  Bernard Aug 6 at 18:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.