\[ \dfrac{\partial^2 U \left( x, y \right)}{\partial x^2} + \dfrac{\partial^2 U \left( x, y \right)}{\partial y^2} = \cases{ 0 & \text{Laplace's Equation} \\ -4 \pi \rho \left( \mathbf{x} \right) & \text{Poisson's Equation}} \]

However, when I used the code:

\dfrac{\partial^2 U \left( x, y \right)}{\partial x^2} + \dfrac{\partial^2 U \left( x, y \right)}{\partial y^2} = \left\{ \begin{array}{cr} 0 & \text{Laplace's Equation} \\ -4 \pi \rho \left( \mathbf{x} \right) & \text{Poisson's Equation} \end{array} \right.

MathJax would not render. So I tried the cases environment since I saw that "array" is not preferred anymore.

Avoid eqnarray! - Lars Madsen - The PracTeX Journal - http://www.tug.org/pracjourn/2006-4/madsen/

Welcome to the TeXblog by Stefan Kottwit - eqnarray vs. align - April 12th, 2008 - http://texblog.net/latex-archive/maths/eqnarray-align-environment/

LaTeX tips: Displayed Math - http://www.math.uiuc.edu/~hildebr/tex/displays.html

Which I found here: http://www.physicsforums.com/showthread.php?p=3510955eqnarray/eqnarray*andarray. Avoid these. Before the advent of amslatex, multiline displays and cases constructs had to be typeset with "eqnarray" and "array". However, the above (amslatex) environments "align/align*" and "cases" are easier too use, provide greater functionality, and generate better looking output. There is no reason whatsoever to use "eqnarray" instead of "align", and, except in very rare situations, "array" is unnecessary.

If you were using it for equations, actually "align" is recommended. With the AMS math environments (align, gather, multline, matrix, etc.) there's almost never any reason to use array or especially eqnarray anymore.The other user then asked:

What is the reasoning behind this recommendation? Since I mostly post equations on forums, I'd prefer the environment that "always works". Meaning I don't want to be dependent of (parts of) an AMS environment or another environment that may or may not be available. As far as I can tell matrix, pmatrix, array, eqnarray, align all seem to work in various environments, so they are all eligible. What I haven't yet figured out is why one would be preferable over another.In which the reply was:

Reasons why eqnarray is deprecated: http://www.tug.org/pracjourn/2006-4/madsen/, http://texblog.net/latex-archive/mat...n-environment/, http://www.math.uiuc.edu/~hildebr/tex/displays.html (and much of the same reasoning applies to array). Basically it's because of layout problems - though to be fair, those aren't as much of an issue when rendering to MathML, as MathJax does. It might even be the case that MathJax implements array and eqnarray as synonyms for matrix and align (with slightly different syntax). Still, it's pretty common knowledge throughout the LaTeX community that the AMS environments are strictly better than array and eqnarray when you're typesetting a paper, and no worse anywhere else, so you're unlikely to find any environment where they are not supported. (MathJaX supports all the AMS environments natively, and every LaTeX distribution includes the AMS packages, so I can't think of a legitimate reason you would be unable to use them. The website administrator would have had to explicitly disable them, which would be silly.)However, the cases command like this does not work either:

\dfrac{\partial^2 U \left( x, y \right)}{\partial x^2} + \dfrac{\partial^2 U \left( x, y \right)}{\partial y^2} = \begin{dcases*} 0 & Laplace's Equation \\ -4 \pi \rho \left( \mathbf{x} \right) & Poisson's Equation \end{dcases*}

(I used dcases* which can be found and described here: http://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics)

It wasn't until I stumbled upon this site did I figure out what was wrong. TEX Commands available in MathJax - Dr. Carol J.V. Fisher - http://www.onemathematicalcat.org/MathJaxDocumentation/TeXSyntax.htm#C

When uses environmetns like array or cases in MathJax you must use, well I should say it works if you use:

\array{}

and

\cases{}

I think this is because the delimiters "back-slash plus the square brace/bracket" are used, \ [ \ ]. It could work if I used \ begin{equation} maybe. I'll test and see because they are showing this in the Physics Forum thread:

\begin{array}{r} \frac {\partial}{\partial a^1} = \cdots \cdots \\ \frac {\partial}{\partial a^2} = \cdots \\ \frac {\partial}{\partial a^3} = \cdots \end{array}

and

\begin{align} \frac {\partial}{\partial a^1} &= \cdots \\ \frac {\partial}{\partial a^2} &= \cdots \\ \frac {\partial}{\partial a^3} &= \cdots \end{align}

because there isn't an \ align{} environment according to Dr. Fisher's well done site. If you go to "environments" on the site it does show \ begin{align} etc. environments.

Hmmm, maybe I need to use some of these to get it to work properly. From here: http://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics

There are also few environments that don't form a math environment by themselves and can be used as building blocks for more elaborate structures:

gathered- Allows to gather few equations to be set under each other and assigned a single equation number

split- Similar toalign*, but used inside another displayed mathematics environment

aligned- Similar toalign, to be used inside another mathematics environment.

I also like these notes from the same page:alignedat- Similar toalignat, and just as it, takes an additional argument specifying number of columns of equations to set.

eqnarrayandeqnarray*- Similar toalignandalign*; Not recommended since spacing is inconsistent

multlineandmultline*- First line left aligned, last line right aligned; Equation number aligned vertically with first line and not centered as with other other environments.

gatherandgather*- Consecutive equations without alignment

flalignandflalign*- Similar toalign, but left aligns first equation column, and right aligns last column

Anyways, I didn't like how the \ cases{}, \ begin{cases}, or any of the cases environments do not center the numbers where you can set this in array since it requires the c, l, r or whatever column justification like: \ begin{array}{lcr}.alignatandalignat*- Takes an argument specifying number of columns. Allows to control explicitly the horizontal space between equations; You can calculate the number of columns by counting & characters in a line, adding 1 and dividing the result by 2

\[ \dfrac{\partial^2 U \left( x, y \right)}{\partial x^2} + \dfrac{\partial^2 U \left( x, y \right)}{\partial y^2} = \cases{ 0 & \text{Laplace's Equation} \\ -4 \pi \rho \left( \mathbf{x} \right) & \text{Poisson's Equation}} \]

Ok, I can't figure this out since you should be able to use \ begin{array} and many other LaTeX math environments. Tired of working on it. I will look at later. This is my problem:

\begin{equation} \dfrac{\partial^2 U \left( x, y \right)}{\partial x^2} + \dfrac{\partial^2 U \left( x, y \right)}{\partial y^2} = \left\{ \begin{array}{cr} 0 & \text{Laplace's Equation}\\ -4 \pi \rho \left( \mathbf{x} \right) & \text{Poisson's Equation} \end{array} \right. \end{equation}Gives:

\begin{equation} \dfrac{\partial^2 U \left( x, y \right)}{\partial x^2} + \dfrac{\partial^2 U \left( x, y \right)}{\partial y^2} = \left\{ \begin{array}{cr} 0 & \text{Laplace's Equation}\\ -4 \pi \rho \left( \mathbf{x} \right) & \text{Poisson's Equation} \end{array} \right. \end{equation}

Ok, well it works now! I must just be an idiot. :P

## No comments:

## Post a Comment