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}
4
  • Why have you used \vphantom?
    – Sebastiano
    Commented Jul 23, 2018 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
    Commented Jul 23, 2018 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. Commented Jul 23, 2018 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. Commented Jul 23, 2018 at 8:57

1 Answer 1

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.

3
  • 1
    1 + x_3^2 copied from question, but should it be (1+x^3)^2 ? looks odd as it is. Commented Jul 23, 2018 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? Commented Jul 25, 2018 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 Commented Jul 25, 2018 at 8:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .