4

I'm trying to get something like the second Figure; however, the best thing I got is like Figure 1. How can I fix it?

Here is the code:

\documentclass{article}
\usepackage{amsmath}
\begin{subequations}
\begin{alignat}{2}
&\begin{multlined}[b]
\{e\}^{n+1} - \{e\}^n = \Delta t \{\dot{e}\}^{n}
+ \beta \Delta t^2 \{\ddot{e}\}^{n+1} \\
+ \Delta t^2 \left( \dfrac{1}{2}-\beta \right) \{\ddot{e}\}^{n}
\end{multlined}\\
&\dfrac{1}{\Delta t} \left( \{\dot{e}\}^{n+1}  -  \{\dot{e}\}^{n} \right)=\dfrac{1}{2} \left( \{\ddot{e}\}^{n+1}  +  \{\ddot{e}\}^{n}  \right) 
\end{alignat}
\end{subequations}

\end{document}

Fig. 1 (Top) and Fig. 2 (Bottom)

  • Welcome to TeX.SX! I can see no reason for the second type of alignment: there's no relationship between the plus and the minus. – egreg Apr 10 '18 at 8:57
  • Thanks! This is just a simple example of the problem I've faced. I didn't bring the original equation, as it is pretty long. – Mat123 Apr 10 '18 at 9:00
2

Embed a \tabbedShortstack inside a \Shortstack.

\documentclass{article}
\usepackage{amsmath,tabstackengine}
\TABstackMath
\stackMath
\setstackgap{S}{6pt}
\begin{document}
\begin{equation}
\TABbinary
\Shortstack[l]{
\{e\}^{n+1} - \{e\}^n = \Delta t \{\dot{e}\}^{n}
+ \beta \Delta t^2 \{\ddot{e}\}^{n+1} \\
\tabbedShortstack[l]{
&+ \Delta t^2 \left( \dfrac{1}{2}-\beta \right) \{\ddot{e}\}^{n}\\
\dfrac{1}{\Delta t} \bigl( \{\dot{e}\}^{n+1}  &-  \{\dot{e}\}^{n} \bigr)=
 \dfrac{1}{2} \left( \{\ddot{e}\}^{n+1}  +  \{\ddot{e}\}^{n}  \right) }}
\end{equation}
\end{document}

enter image description here

0

I would use an align environment, with a \omit\rlap{...} for the first line.

To have the equation number only at the end, I've used \nonumber for the first two rows.

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\begin{document}
\begin{align}
  \omit\rlap{$\{e\}^{n+1} - \{e\}^n = \Delta t \{\dot{e}\}^{n} + \beta \Delta t^2 \{\ddot{e}\}^{n+1}$}\nonumber\\
   &{}+\Delta t^2 \left( \dfrac{1}{2}-\beta \right) \{\ddot{e}\}^{n} \nonumber\\
  \dfrac{1}{\Delta t} \left( \{\dot{e}\}^{n+1}\right. & {}-  \left.\{\dot{e}\}^{n} \right)=\dfrac{1}{2} \left( \{\ddot{e}\}^{n+1}  +  \{\ddot{e}\}^{n}  \right)
\end{align}
\end{document}

enter image description here

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.