LaTeX multiline equation is not working

  • LaTeX
  • Thread starter analogmaster
  • Start date
  • Tags
    Latex
In summary, the conversation discusses the use of different environments and operators for rendering multi-line equations in LaTeX. The participants suggest using the split, eqnarray, and align environments, as well as using \left and \right instead of splitting brackets. They also mention using the starred versions of these environments to avoid equation numbers.
  • #1
analogmaster
2
0
Hi all,

I am using LeD and texlive09 for latex editing. I want to render a multi-line equation and for that I am trying with "\\" - this operator. But it is not rendering. I have included "amsmath" package. I am clueless about why the problem happens. Please help me...

Regards
Sam
 
Physics news on Phys.org
  • #2
What are you trying to type? You can even just enter it into your reply to test if it works. Quote my reply to see what I typed below:

[tex]
\begin{gather*}
\nabla \cdot \vec E = \frac{\rho}{\epsilon_0} \\
\nabla \times \vec E = -\dfrac{\partial \vec B}{\partial t} \\
\nabla \cdot \vec B = 0 \\
\nabla \times \vec B = \mu_0\epsilon_0\dfrac{\partial \vec E}{\partial t} + \mu_0 \vec J
\end{gather*}
[/tex]
 
  • #3
Yes it works! But it doesn't show up the reference to the equation in toc. using \begin{equation} it should work...shouldn't it?

regards
Sam
 
  • #4
You typically have to enter an additional environment. I don't believe the standard compiler I use allows multiline equations simply inside of the equation environment. I use the split environment, e.g.
[tex]
\begin{equation}
\begin{split}
a &= b + 1\\
c &= a + 10
\end{split}
\end{equation}
[/tex]

Code:
\begin{equation}
\begin{split}
a &= b + 1\\
c &= a + 10
\end{split}
\end{equation}
 
  • #5
I always use "\begin{eqnarray}" then your \\ will work., though it numbers the lines.

If the problem persists it may be you're trying to break up brackets:

Code:
\begin{equation}
\begin{array}{c}
this is a test \left(hello \\
hello two \right)
\end{array}
\end{equation}

gives an error but

Code:
\begin{equation}
\begin{array}{c}
this is a test (hello \\
hello two )
\end{array}
\end{equation}

doesn't. Can't split the \left( and \right)'s up
 
Last edited:
  • #6
Hepth said:
I always use "\begin{eqnarray}" then your \\ will work., though it numbers the lines.

If the problem persists it may be you're trying to break up brackets:

Code:
\begin{equation}
\begin{array}{c}
this is a test \left(hello \\
hello two \right)
\end{array}
\end{equation}

gives an error but

Code:
\begin{equation}
\begin{array}{c}
this is a test (hello \\
hello two )
\end{array}
\end{equation}

doesn't. Can't split the \left( and \right)'s up

You cannot split \left<stuff> and \right<stuff>
You must use "fake" right/left instead:

Code:
\begin{equation}
\begin{array}{c}
this is a test \left(hello \right.\\
\left. hello two \right)
\end{array}
\end{equation}
 
  • #7
There are several environments that essentially perform the same thing with subtle differences.

I personally use {align} if I want to reference every line.
 
  • #8
hi!

I have this equation that I want to split in 4 parts.

\[ d(x,z) = \mid x-z \mid _{p} = \mid (x-y) + (y-z) \mid _{p} \leqslant \mbox{ max (} \mid x-y \mid _{p} \mbox{, } \mid y-z \mid _{p} \mbox{)} = \mbox{ max (} d(x,y), d(y,z) \mbox{).} \]

I have tried : \[ d(x,z) = & \left(\mid x-z \mid _{p} \right. \\
& \left. = \mid (x-y) + (y-z) \mid _{p} \right. \\
& \left. \leqslant \mbox{ max (} \mid x-y \mid _{p} \mbox{, } \mid y-z \mid _{p} \mbox{)} \right. \\
& \left. \mbox{ max (} d(x,y), d(y,z) \mbox{).} \] \right) \]

But it is not working.

Can you help me? Thank you,
Miha
 
  • #9
[tex]
\begin{align} d(x,z) &= \mid x-z \mid _{p} \\
&= \mid (x-y) + (y-z) \mid _{p} \\
&\leqslant \mbox{ max (} \mid x-y \mid _{p} \mbox{, } \mid y-z \mid _{p} \mbox{)} \\
&= \mbox{ max (} d(x,y), d(y,z) \mbox{).}
\end{align}
[/tex]

If you don't want equation numbers, use the starred versions of align,
[tex]
\begin{align*} d(x,z) &= \mid x-z \mid _{p} \\
&= \mid (x-y) + (y-z) \mid _{p} \\
&\leqslant \mbox{ max (} \mid x-y \mid _{p} \mbox{, } \mid y-z \mid _{p} \mbox{)} \\
&= \mbox{ max (} d(x,y), d(y,z) \mbox{).}
\end{align*}
[/tex]
 
  • #10
Thank you very much!

regards,
miha
 

Related to LaTeX multiline equation is not working

1. Why is my LaTeX multiline equation not working?

There could be several reasons why your LaTeX multiline equation is not working. It could be due to a syntax error, missing packages, or conflicting packages. It is also possible that there is an error in your code, such as missing curly brackets or incorrect use of math mode.

2. How do I fix my LaTeX multiline equation?

To fix your LaTeX multiline equation, you can start by checking for any syntax errors or missing packages. You can also try simplifying your equation or breaking it down into smaller parts to identify the source of the issue. Additionally, checking for any conflicting packages and addressing them may also help resolve the issue.

3. Why is my LaTeX multiline equation not aligning correctly?

If your LaTeX multiline equation is not aligning correctly, it could be due to a misplacement of the alignment characters (&) or incorrect use of the alignment environment. Make sure to properly use the ampersand symbol to indicate the alignment points in your equation and to use the correct alignment environment, such as align or alignat.

4. Can I use a multiline equation in any LaTeX environment?

Yes, you can use a multiline equation in various LaTeX environments, such as equation, align, gather, and many more. However, different environments may have different alignment and formatting options, so make sure to choose the appropriate environment for your equation.

5. How can I create a multiline equation with multiple equations and conditions?

To create a multiline equation with multiple equations and conditions, you can use the cases or aligned environment. These environments allow you to specify different equations and conditions for each line of your multiline equation. Make sure to properly use the alignment characters and curly brackets to indicate the conditions and equations for each line.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
866
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
23
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
3K
Back
Top