## LaTeX forum ⇒ Math & Science ⇒ Multi-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

Hello, I want to use multi-line equation in my essay but when I use it the alignment of the equations become destruct.

this is my code:
\documentclass[5p,fleqn]{elsarticle} \usepackage{lineno,hyperref}\modulolinenumbers[10]\usepackage{amsmath} \begin{document} \begin{equation}\begin{aligned}z=0, \forall r \in [R_i,R_o]: (uC_i)=(uC_i)_{in}, T=T_{in}, \\P=P_{in}, (u_p C_{j,p})=0, \\i=CH_4,H_2O, CO, CO_2,  j=H_2O,H_2 \label{E21}\end{aligned}\end{equation} \begin{equation}\begin{split}r=r_0, \forall z \in [0,L]: \frac{\partial (uC_i)}{\partial r}=0,\\k_a \frac{\partial T}{\partial r}=h_w (T_w-T)\label{E22}\end{split}\end{equation}  \begin{equation}\begin{split}r=r_i, \forall z \in [0,L]: \frac{\partial (uC_i)}{\partial r}=0,\\& i=CH_4,H_2O, CO, CO_2,\\&\frac{d_p}{Pe_m}\frac{\partial (uC_j)}{\partial r}=N_m, j=H_2,\\      &\frac{\partial T}{\partial r}=0 \label{E23}\end{split}\end{equation} \end{document}

Attachments
Capture.JPG (24.04 KiB) Viewed 8456 times

Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm
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
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 ?

Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm
Crosspost

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

Edit: The following code gives the attached screenshot.
\documentclass[5p,fleqn]{elsarticle} \usepackage{showframe}\usepackage{lineno}\modulolinenumbers[10]\usepackage{amsmath} \setlength{\mathindent}{0pt}\usepackage{hyperref}\begin{document} \begin{equation}\begin{aligned}z=0, \forall r \in [R_i,R_o]: (uC_i)=(uC_i)_{in}, T=T_{in}, \\P=P_{in}, (u_p C_{j,p})=0, \\i=CH_4,H_2O, CO, CO_2,  j=H_2O,H_2 \label{E21}\end{aligned}\end{equation} \begin{equation}\begin{split}r=r_0, \forall z \in [0,L]: \frac{\partial (uC_i)}{\partial r}=0,\\k_a \frac{\partial T}{\partial r}=h_w (T_w-T)\label{E22}\end{split}\end{equation}  \begin{equation}\begin{split}r=r_i, \forall z \in [0,L]: \frac{\partial (uC_i)}{\partial r}=0,\\ i=CH_4,H_2O, CO, CO_2,\\\frac{d_p}{Pe_m}\frac{\partial (uC_j)}{\partial r}=N_m, j=H_2,\\      \frac{\partial T}{\partial r}=0 \label{E23}\end{split}\end{equation} \end{document}