LaTeX forum ⇒ Math & ScienceMulti-line equation alignment

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Alirezakn
Posts: 3
Joined: Sat Nov 17, 2018 8:23 am

Multi-line equation alignment

Postby Alirezakn » Thu Nov 22, 2018 9:02 am

Hello, I want to use multi-line equation in my essay but when I use it the alignment of the equations become destruct.
please help me, thank you in advance

this is my code:
  1. \documentclass[5p,fleqn]{elsarticle}
  2.  
  3. \usepackage{lineno,hyperref}
  4. \modulolinenumbers[10]
  5. \usepackage{amsmath}
  6.  
  7. \begin{document}
  8.  
  9. \begin{equation}
  10. \begin{aligned}
  11. z=0, \forall r \in [R_i,R_o]: (uC_i)=(uC_i)_{in}, T=T_{in}, \\
  12. P=P_{in}, (u_p C_{j,p})=0, \\
  13. i=CH_4,H_2O, CO, CO_2, j=H_2O,H_2
  14. \label{E21}
  15. \end{aligned}
  16. \end{equation}
  17.  
  18. \begin{equation}
  19. \begin{split}
  20. r=r_0, \forall z \in [0,L]: \frac{\partial (uC_i)}{\partial r}=0,\\
  21. k_a \frac{\partial T}{\partial r}=h_w (T_w-T)
  22. \label{E22}
  23. \end{split}
  24. \end{equation}
  25.  
  26.  
  27. \begin{equation}
  28. \begin{split}
  29. r=r_i, \forall z \in [0,L]: \frac{\partial (uC_i)}{\partial r}=0,\\
  30. & i=CH_4,H_2O, CO, CO_2,\\
  31. &\frac{d_p}{Pe_m}\frac{\partial (uC_j)}{\partial r}=N_m, j=H_2,\\
  32. &\frac{\partial T}{\partial r}=0
  33. \label{E23}
  34. \end{split}
  35. \end{equation}
  36.  
  37. \end{document}

And the results attached. https://latex.org/forum/download/file.p ... w&id=10498
Attachments
Capture.JPG
Capture.JPG (24.04 KiB) Viewed 226 times

User avatar
Johannes_B
Site Moderator
Posts: 3905
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Thu Nov 22, 2018 9:26 am

Welcome to the forum,

i am not quite sure where you are trying to align or if you even attempt to align anything? Remove the ampersands in the last equation for a start.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Alirezakn
Posts: 3
Joined: Sat Nov 17, 2018 8:23 am

Postby Alirezakn » Thu Nov 22, 2018 9:59 am

Johannes_B wrote:Welcome to the forum,

i am not quite sure where you are trying to align or if you even attempt to align anything? Remove the ampersands in the last equation for a start.



Thank you it's become better but I want to align equation from left to right. As you can see in picture, the second and third line align by the right of the first line
how can I fix it ?

User avatar
Johannes_B
Site Moderator
Posts: 3905
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Thu Nov 22, 2018 10:29 am

Crosspost

By the way, you should use a package like chemformula for the chemistry.


Edit: The following code gives the attached screenshot.
  1. \documentclass[5p,fleqn]{elsarticle}
  2.  
  3. \usepackage{showframe}
  4. \usepackage{lineno}
  5. \modulolinenumbers[10]
  6. \usepackage{amsmath}
  7.  
  8. \setlength{\mathindent}{0pt}
  9. \usepackage{hyperref}
  10. \begin{document}
  11.  
  12. \begin{equation}
  13. \begin{aligned}
  14. z=0, \forall r \in [R_i,R_o]: (uC_i)=(uC_i)_{in}, T=T_{in}, \\
  15. P=P_{in}, (u_p C_{j,p})=0, \\
  16. i=CH_4,H_2O, CO, CO_2, j=H_2O,H_2
  17. \label{E21}
  18. \end{aligned}
  19. \end{equation}
  20.  
  21. \begin{equation}
  22. \begin{split}
  23. r=r_0, \forall z \in [0,L]: \frac{\partial (uC_i)}{\partial r}=0,\\
  24. k_a \frac{\partial T}{\partial r}=h_w (T_w-T)
  25. \label{E22}
  26. \end{split}
  27. \end{equation}
  28.  
  29.  
  30. \begin{equation}
  31. \begin{split}
  32. r=r_i, \forall z \in [0,L]: \frac{\partial (uC_i)}{\partial r}=0,\\
  33. i=CH_4,H_2O, CO, CO_2,\\
  34. \frac{d_p}{Pe_m}\frac{\partial (uC_j)}{\partial r}=N_m, j=H_2,\\
  35. \frac{\partial T}{\partial r}=0
  36. \label{E23}
  37. \end{split}
  38. \end{equation}
  39.  
  40. \end{document}


alirezaknAlignEquations.png
alirezaknAlignEquations.png (45.93 KiB) Viewed 210 times
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.


Return to “Math & Science”

Who is online

Users browsing this forum: No registered users and 6 guests