6

I'm trying to set up my equations for 3 hours and it's driving me crazy. I'm new in LaTeX so I don't master it at all.

This is the closest, with the simplest code, that I could get.

\documentclass[a4paper,11pt]{report}

\usepackage{amsmath}
\begin{document}

\begin{align}
dX(t)=&-f1*X(t)L(t)dt+g1*U(t)dt\\
    &-\sqrt{f1*X(t)L(t)}dW1(t)+\sqrt{g1*U(t)}dW2(t)
\end{align}
\begin{align}
dL(t)=&-f1*X(t)L(t)dt+g1*U(t)dt-f2*U(t)L(t)dt+g2*Y(t)dt\\
    &-\sqrt{f1*X(t)L(t)}dW1(t)+\sqrt{g1*U(t)}dW2(t)\\
    &-\sqrt{f2*U(t)L(t)}dW3(t)+\sqrt{g2*Y(t)}dW4(t)
\end{align}
\begin{align}
dU(t)=&f1*X(t)L(t)dt-g1*U(t)dt-f2*U(t)L(t)dt+g2*Y(t)dt\\
    &+\sqrt{f1*X(t)L(t)}dW1(t)-\sqrt{g1*U(t)}dW2(t)\\
    &-\sqrt{f2*U(t)L(t)}dW3(t)+\sqrt{g2*Y(t)}dW4(t)
\end{align}
\begin{align}
dY(t)=&f2*U(t)L(t)dt-g2*Y(t)dt\\
    &+\sqrt{f2*U(t)L(t)}dW3(t)-\sqrt{g2*Y(t)}dW4(t)
\end{align}
\end{document}

And it's giving me this this

It's close to what I want but I want the dX, dL, ... to be aligned aswell. And, if possible, but not very important, to get only one number of ref. for the whole set.

I tried numerous ways with align, split, aligned and I couldn't do it.

I've the conviction that the answer is very simple but I don't know what to try anymore, I've read so many post about it here and I'm still blocked.

Thank you.

Edit :

As suspected, it wasn't tricky at all, thank you very much.

2 Answers2

5

Key changes:

  1. a single align block, with extra \\ for blank lines

  2. ={}&, not =&, to get the proper spacing around =

  3. \notag for unnumbered lines

Here is the revision.

\documentclass[a4paper,11pt]{report}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath}
\begin{document}
\begin{align}
dX(t)={}&-f1*X(t)L(t)dt+g1*U(t)dt\notag\\
    &-\sqrt{f1*X(t)L(t)}dW1(t)+\sqrt{g1*U(t)}dW2(t)\\
\notag\\
dL(t)={}&-f1*X(t)L(t)dt+g1*U(t)dt-f2*U(t)L(t)dt+g2*Y(t)dt\notag\\
    &-\sqrt{f1*X(t)L(t)}dW1(t)+\sqrt{g1*U(t)}dW2(t)\notag\\
    &-\sqrt{f2*U(t)L(t)}dW3(t)+\sqrt{g2*Y(t)}dW4(t)\\
\notag\\
dU(t)={}&f1*X(t)L(t)dt-g1*U(t)dt-f2*U(t)L(t)dt+g2*Y(t)dt\notag\\
    &+\sqrt{f1*X(t)L(t)}dW1(t)-\sqrt{g1*U(t)}dW2(t)\notag\\
    &-\sqrt{f2*U(t)L(t)}dW3(t)+\sqrt{g2*Y(t)}dW4(t)\\
\notag\\
dY(t)={}&f2*U(t)L(t)dt-g2*Y(t)dt\notag\\
    &+\sqrt{f2*U(t)L(t)}dW3(t)-\sqrt{g2*Y(t)}dW4(t)
\end{align}
\end{document}

enter image description here

4

Nest split in align:

\documentclass[a4paper,11pt]{report}
\usepackage{amsmath}

\newcommand{\diff}{\mathop{}\!d}

\begin{document}

\begin{align}
\begin{split}
\diff X(t)&=-f_1*X(t)L(t)\diff t+g_1*U(t)\diff t\\
     &\qquad-\sqrt{f_1*X(t)L(t)}\diff W_1(t)+\sqrt{g_1*U(t)}\diff W_2(t)
\end{split}\\[1ex]
\begin{split}
\diff L(t)&=-f_1*X(t)L(t)\diff t+g_1*U(t)\diff t\\
     &\qquad-f_2*U(t)L(t)\diff t+g_2*Y(t)\diff t\\
     &\qquad-\sqrt{f_1*X(t)L(t)}\diff W_1(t)+\sqrt{g_1*U(t)}\diff W_2(t)\\
     &\qquad-\sqrt{f_2*U(t)L(t)}\diff W_3(t)+\sqrt{g_2*Y(t)}\diff W_4(t)
\end{split}\\[1ex]
\begin{split}
\diff U(t)&=f_1*X(t)L(t)\diff t-g_1*U(t)\diff t\\
     &\qquad-f_2*U(t)L(t)\diff t+g_2*Y(t)\diff t\\
     &\qquad+\sqrt{f_1*X(t)L(t)}\diff W_1(t)-\sqrt{g_1*U(t)}\diff W_2(t)\\
     &\qquad-\sqrt{f_2*U(t)L(t)}\diff W_3(t)+\sqrt{g_2*Y(t)}\diff W_4(t)
\end{split}\\[1ex]
\begin{split}
\diff Y(t)&=f_2*U(t)L(t)\diff t-g_2*Y(t)\diff t\\
     &\qquad+\sqrt{f_2*U(t)L(t)}\diff W_3(t)-\sqrt{g_2*Y(t)}\diff W_4(t)
\end{split}
\end{align}
\end{document}

I added some vertical space between the blocks in order to better separate them.

I also added the \diff macro for improving the appearance of the differentials and also used subscripts. Are you sure about *?

enter image description here

egreg
  • 1,121,712
  • 2
    Battle of the Leprechauns! – Steven B. Segletes Dec 29 '16 at 00:49
  • Yes, I need to add subscripts and remove * but it wasn't my main issue at all, one problem at a time. :p – Emil Cioran Dec 29 '16 at 00:55
  • Your proposition is very good and look slightly better than the other Leprechaun one but I have too much equations to rework to handle it, for the importance of my report at least. Anyway, the differential d is a nice addition! Thank you. – Emil Cioran Dec 29 '16 at 00:58