0

In the following MWE, I tried to have double alignment inside alignat environment. I want (x_i^4)^2 be placed under k_i^2 in the second equation. However, it seems this MWE is not correct and the output is not suitable.

\documentclass{article}
\usepackage{amsmath}

\begin{document}


\begin{alignat}{2}
&\dot{x}_i^1 = x_i^2 &&\nonumber\\
&\dot{x}_i^2 = x_i^3&&\left(k_i^2 + \frac{k_i^3}{\left(1 + 
\left(x_i^3\right)^2\right)^{\frac{1}{2}}}\left(x_i^2 - \frac{k_i^1}{\left(1 
+ \left(x_i^3\right)^2\right)^{\frac{1}{2}}}x_i^4\right)^2 + \frac{k_i^1} 
{\left(1 + x_3^2\right)^{\frac{3}{2}}}\right.\nonumber\\
&&\left.\left (x_i^4\right)^2\vphantom{\left(x_i^2 - \frac{k_i^1}{\left(1 + 
\left(x_i^3\right)^2\right)^{\frac{1}{2}}}x_i^4\right)^2}\right)\nonumber\\
&\dot{x}_i^3 = x_i^4 &&\nonumber\\
&\dot{x}_i^4 = v_i &&
\end{alignat}

\end{document}
  • Why have you used \vphantom? – Sebastiano Jul 23 '18 at 8:29
  • This 3rd row seems to be the end of the formula above. Is there any reason why it should be on a separate row? – Bernard Jul 23 '18 at 8:52
  • @Sebastiano I wanted the parenthesis in the second line of equation 2 be as large as the parentheses in the first line of equation 2. – AbbasKaramali Jul 23 '18 at 8:55
  • @ Bernard If I wanted to continoue with no line break, it would be cross the standard size of the considered page as I tested once. – AbbasKaramali Jul 23 '18 at 8:57
1

You do not say what layout you want, but perhaps

enter image description here

\documentclass{article}
\usepackage{amsmath}

\begin{document}


\begin{equation}
\begin{aligned}
\dot{x}_i^1 &= x_i^2\\
\dot{x}_i^2 &= x_i^3\Biggl(k_i^2 + \frac{k_i^3}{(1 + 
(x_i^3)^2)^{\frac{1}{2}}}\Bigl(x_i^2 - \frac{k_i^1}{(1 
+ (x_i^3)^2)^{\frac{1}{2}}}x_i^4\Bigr)^2 + \frac{k_i^1} 
{(1 + x_3^2)^{\frac{3}{2}}}(x_i^4)^2\Biggr)\\
\dot{x}_i^3 &= x_i^4\\[\jot]
\dot{x}_i^4 &= v_i
\end{aligned}
\end{equation}

\end{document}

Note that \left\right as well as making brackets that are often too tall adds extra horizontal space which is hardly ever wanted, especially in cases like this where you need to fit an expression that is already quite long.

  • 1
    1 + x_3^2 copied from question, but should it be (1+x^3)^2 ? looks odd as it is. – David Carlisle Jul 23 '18 at 18:56
  • Thank you for your answer and you are right about 1 + x_3^2. However, If the second equation be larger such that it must be broken into second row, what would be the solution then? – AbbasKaramali Jul 25 '18 at 7:32
  • @AbbasKaramali you can put \\ anywhere that you want a break, probably \\ &\qquad (x... so the broken part is in the right hand side, and indented a bit – David Carlisle Jul 25 '18 at 8:30

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.