Math & ScienceMulti-line equation alignment

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

Multi-line equation alignment

Post by Alirezakn »

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:

Code: Select all

\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}
And the results attached. https://latex.org/forum/download/file.p ... w&id=10498
Attachments
Capture.JPG
Capture.JPG (24.04 KiB) Viewed 62463 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

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

Multi-line equation alignment

Post by Johannes_B »

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

Multi-line equation alignment

Post by Alirezakn »

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: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Multi-line equation alignment

Post by Johannes_B »

Crosspost

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


Edit: The following code gives the attached screenshot.

Code: Select all

\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}
alirezaknAlignEquations.png
alirezaknAlignEquations.png (45.93 KiB) Viewed 62447 times
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply