Register to reply 
Multiline Equation Problem in Latex 
Share this thread: 
#1
Jul1609, 09:20 AM

P: 597

Hello,
I have an equation like this one: [tex]f(x)=1+g(x)[/tex] where [tex]g(x)[/tex] is a very long term, and I have to split it into two halfs, but I want the second half be exactly under the '+' sign, not under the '=' sign. How can I do that? Thanks in advance 


#2
Jul1609, 10:05 AM

P: 175

I think there is some information on this in "The Not So Short Guide to [tex]\LaTeXe[/tex]." You should be able to google it. I don't remember exactly, but I think you need to use some & to create something like tabs?
Anyway, I'm pretty sure it's in there (Chapter 4?). Kerry EDIT: Actually it's "The Not So Short Introduction to [tex]\LaTeXe[/tex]." It's available here: http://tobi.oetiker.ch/lshort/lshort.pdf 


#3
Jul1609, 10:34 AM

Sci Advisor
P: 1,750

[tex]\begin{align*} 


#4
Jul1609, 10:38 AM

Mentor
P: 15,065

Multiline Equation Problem in Latex
Even better, use the AMSLaTex macros, which are part of the standard LaTeX distribution.
A Short Math Guide for LaTeX: ftp://ftp.ams.org/pub/tex/doc/amsmat...mathguide.pdf amsmath user's guide: ftp://ftp.ams.org/pub/tex/doc/amsmath/amsldoc.pdf 


#5
Jul1609, 11:02 AM

P: 597

Yes, but I need this inside a split enviroment. When I use split alone it is ok, but when I use split inside split, or align inside split enviroment, the equation inside the inner enviroment becomes above and under the '+' sign, and not in the same line. This is exactly my problem.
Regards 


#6
Jul1609, 02:34 PM

Sci Advisor
P: 1,498

Once your inside the split environment you can simply use ampersands as alignment points.
\begin{equation} \begin{split} f(x) = 1 &+ \\ &g(x) \end{split} \end{equation} [/tex] 


#7
Jul1609, 02:51 PM

P: 597

Thank you all for replying, but may be I did not make my point clear, so I will give an example:
[tex]\begin{equation}\begin{split}f(x)=&1+g(x)\\ =&1+\text{Expansion of g(x)} \end{split} \end{equation}[/tex] the expansion of g(x) spans more than one line, so I want to split it inside a split enviroment. I hope that my point is clear now. Regards 


#8
Jul1609, 02:52 PM

P: 74

[tex] \newcommand{\newln}{\\&\quad\quad{}} \begin{align}\begin{split} &\rho^s \sum_{k=0}^\infty k(k1)a_k\rho^{k2} + 2(s+1)\rho^{s1}\sum_{k=0}^\infty k a_k\rho^{k1}  \rho^s \sum_{k=0}^\infty k a_k\rho^{k1} \newln + (\eta  1  s)\rho^{s1}\sum_{k=0}^\infty a_k\rho^k + [s(s+1)  l(l+1)]\rho^{s2} \sum_{k=0}^\infty a_k\rho^k = 0 \end{split}\end{align} [/tex] To fit your example: [tex] \newcommand{\parenthnewln}{\right.\\&\left.\quad\quad{}} \begin{align}\begin{split} f(x) &= 1 + g(x)\\ &= 1 + \left( 1 + x + \frac{x^2}{2} + \parenthnewln + \frac{x^3}{3!} + \ldots \parenthnewln + \frac{x^n}{n!} + \ldots \right) \end{split}\end{align} [/tex] 


#9
Jul1709, 07:50 AM

Sci Advisor
P: 1,498

I think I got you. In certain math packages, more than one alignment character "&" is allowed, as long as the same amount are used each line. In this case, you could put one at the equals sign and one at the plus sign . I'm not sure how its treated here, but you could do something like
Edit: Wait so just to clarify, this isn't what you want? [tex] \begin{equation} \begin{split} f(x) = 1 +& g(x) \\ =1 +& sin(x) + cos(x) + \cdots \\ +&tan(x) \end{split} \end{equation} [/tex] 


#10
Jul1709, 09:23 AM

P: 597

Thank you both Fenn and minger. Both codes are working well. But I want to ask: in the code that minger gave, the '&' character was not used to align the '=' characters. How is that?
Regards 


#11
Jul1709, 10:21 AM

P: 74

That alignment example looks very nice in the forums, minger. Which math package allows you to do that? When I use only amsmath in my document, my compiler complains about the multiple alignment tabs per line.



#12
Jul1709, 12:12 PM

P: 597




#13
Jul1709, 12:46 PM

Sci Advisor
P: 1,498

It's because I got lucky. Now, there are math packages which allow multiple alignement tabs (I think they're called) per line, as I mentioned, as long as they are the same number per line.
In this case, I simply got lucky because on each line before the + sign, there is only a 1 and an equals sign. It lines up by default really. 


#14
Jul1709, 12:50 PM

P: 74

Ooh, pretty. Yes, that looks very nice. With my suggestion earlier of defining new commands, it is fairly straightforward to split the equation when it is within parenthesis:
\newcommand{\parenthnewln}[1]{\right.\\#1&\left.{}} \begin{equation} \begin{split} f(x)=1+&g(x)\\ =1+&\left(x+x^2+\dots \parenthnewln{+}x^n+\ldots\right) \end{split} \end{equation} [/tex] 


#15
Jul1709, 03:22 PM

P: 597

We are learning something new each time. Thank you all guys.



#16
Jul1809, 08:45 AM

P: 74

One thing I'd like to learn is how to number multiline equations with subindices like (a) (b) (c).
Something like [tex] \begin{align} I = \begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix} \end{align} \end{align} \begin{align} f &= ma\\ E &= mc^2\\ \pi &\text{ is exactly three!} \end{align} [/tex] What I would like to see in this example, is the first line numbered (1), as it is now, and then the group of three numbered (2a), (2b), (2c). Does anyone have any suggestions that would accomplish this? I've noticed that the split environment clusters the equations together into one equation number, but that really only helps if I am defining a multiline equation like where this topic started. 


#17
Jul2009, 05:17 PM

P: 74

Alright, I found my answer, in case anyone is looking. It's the subequations environment from the amsmath package.
[tex] \begin{align} I = \begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix} \end{align} \begin{subequations}\begin{align} f &= ma\\ E &= mc^2\\ \pi &\text{ is exactly three!} \end{align}\end{subequations} [/tex] 


#18
Jul2009, 11:13 PM

P: 597

Regards 


Register to reply 
Related Discussions  
Cut of text line in latex  Math & Science Software  1  
Multiline Equation in Latex  Math & Science Software  2  
Find the equation of the normal line of the given parabola that is parallel to a line  Calculus & Beyond Homework  9  
Equation of line parallel to plane and intersaction with other line  Precalculus Mathematics Homework  5  
Equation of a line problem  Precalculus Mathematics Homework  5 