LaTeX multiline equation is not working

  • Context: LaTeX 
  • Thread starter Thread starter analogmaster
  • Start date Start date
  • Tags Tags
    Latex
Click For Summary

Discussion Overview

The discussion revolves around issues related to rendering multi-line equations in LaTeX, specifically using different environments and commands. Participants explore various methods to achieve the desired formatting and address common pitfalls encountered in LaTeX editing.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant, Sam, reports difficulty rendering a multi-line equation using "\\" and mentions including the "amsmath" package.
  • Another participant provides an example using the "gather" environment, which successfully renders multi-line equations.
  • Sam notes that using the "equation" environment does not show references in the table of contents and questions its effectiveness.
  • A different participant suggests using the "split" environment within "equation" to allow for multi-line formatting.
  • Another participant mentions using the "eqnarray" environment, noting that it numbers the lines but may cause issues if brackets are improperly split.
  • One participant warns against splitting "\left" and "\right" commands, suggesting alternative formatting to avoid errors.
  • Another participant mentions the "align" environment as a preferred option for referencing each line in equations.
  • Miha shares an attempt to split an equation into four parts but reports it is not working, seeking assistance.
  • A participant responds with a correct usage of the "align" environment, providing both numbered and unnumbered versions for clarity.

Areas of Agreement / Disagreement

Participants express various methods for formatting multi-line equations, with no consensus on a single best approach. Different environments and commands are suggested, indicating multiple competing views on the topic.

Contextual Notes

Some participants highlight limitations related to specific environments and the need for proper handling of brackets, which may affect the rendering of equations.

analogmaster
Messages
2
Reaction score
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
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:

<br /> \begin{gather*}<br /> \nabla \cdot \vec E = \frac{\rho}{\epsilon_0} \\<br /> \nabla \times \vec E = -\dfrac{\partial \vec B}{\partial t} \\<br /> \nabla \cdot \vec B = 0 \\<br /> \nabla \times \vec B = \mu_0\epsilon_0\dfrac{\partial \vec E}{\partial t} + \mu_0 \vec J<br /> \end{gather*}<br />
 
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
 
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.
<br /> \begin{equation}<br /> \begin{split}<br /> a &amp;= b + 1\\<br /> c &amp;= a + 10<br /> \end{split}<br /> \end{equation}<br />

Code:
\begin{equation}
\begin{split}
a &= b + 1\\
c &= a + 10
\end{split}
\end{equation}
 
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:
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}
 
There are several environments that essentially perform the same thing with subtle differences.

I personally use {align} if I want to reference every line.
 
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
 
<br /> \begin{align} d(x,z) &amp;= \mid x-z \mid _{p} \\<br /> &amp;= \mid (x-y) + (y-z) \mid _{p} \\<br /> &amp;\leqslant \mbox{ max (} \mid x-y \mid _{p} \mbox{, } \mid y-z \mid _{p} \mbox{)} \\<br /> &amp;= \mbox{ max (} d(x,y), d(y,z) \mbox{).}<br /> \end{align}<br />

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

regards,
miha
 

Similar threads

  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 11 ·
Replies
11
Views
8K
  • · Replies 2 ·
Replies
2
Views
4K