Welcome to our community

Be a part of something great, join today!

MathJax How to use LaTeX on this site.

  • Thread starter
  • Moderator
  • #1

Chris L T521

Well-known member
Staff member
Jan 26, 2012
995
East Lansing, MI
We are using a new LaTeX rendering program on our site -- MathJax.

MathJax is compatible with all modern web browsers; the only catch is that you must have JavaScript enabled.

The delimiters necessary to render the LaTeX codes are what you would typically expect when writing LaTeX documents; take note that ${command}$ is disabled. However, "$$" and "\[" are used for centering equations, and "\(" is used for inline equations.

To see the LaTeX source code, right click the rendered image and select the "Show Math As" option in the drop down menu, followed by "TeX Commands".

Here are some examples:

Using the "$$" delimiter:

$$\oint_C fdx+gdy = \iint\limits_R\left(\frac{\partial g}{\partial x}-\frac{\partial f}{\partial y}\right)\,dA$$

$$\int_{\partial M} \omega = \int_M d\omega$$

$$e^x = \sum_{n=0}^{\infty}\frac{x^n}{n!}$$

Using the "\[" delimiter:

\[\begin{aligned}\int_0^1 x^2\,dx &= \left.\frac{1}{3}x^3\right|_0^1\\ &= \frac{1}{3}\end{aligned}\]

\[\begin{array}{c|c|c|c|c} 1 & 2 & 3 & 4 & 5\\\hline 6 & 7 & 8 & 9 & 10\end{array}\]

Using the "\(" delimiter:

If \(x\in S^{\prime}\), then \(x\in\text{cl}\,S\).

For any \(a,b,c\in\mathbb{R}\), if \(a<b\) and \(c>0\), then \(a+c<b+c\).

The solution to the differential equation \(\dfrac{dy}{dx}+y=x\) is \(y(x) = x-1+Ce^{-x}\).


To me, the only delimiter that we will need to get used to is "\(". I don't think this will be much of a problem later down the road.

Happy LaTeXing!! (Smile)
 

ThePerfectHacker

Well-known member
Jan 26, 2012
236
I would suggest to use this LaTeX program together with standard commands. The one I use to write pdf files in I use a double-dollar to center an equation and a single-dollar to make the equation appear smaller and part of the line without skipping, do you know what I am sayin' ? If it is possible to change the default settings then maybe this is a better command because it is consistent with the standard commands.
 

The Chaz

Member
Jan 26, 2012
24
I would suggest to use this LaTeX program together with standard commands. The one I use to write pdf files in ...
On a related note, which software do you (all) suggest for a Mac user? I had downloaded "Texit" (or something like that)... it was a 2gig file that I could never get working.

I would love to be able to communicate math via LaTex in .pdf files, so any suggestions along those lines would be greatly appreciated!
 
  • Thread starter
  • Moderator
  • #4

Chris L T521

Well-known member
Staff member
Jan 26, 2012
995
East Lansing, MI
I would suggest to use this LaTeX program together with standard commands. The one I use to write pdf files in I use a double-dollar to center an equation and a single-dollar to make the equation appear smaller and part of the line without skipping, do you know what I am sayin' ? If it is possible to change the default settings then maybe this is a better command because it is consistent with the standard commands.
The double dollar sign is available as I mentioned above (I personally use \[ for centering things in my TeX documents), but there's a reason why MathJax disables (by default) the use of the single dollar sign. Suppose that someone who doesn't know how to use TeX asks the following question:

"Suppose that Jack makes $8.50 an hour and Jill makes $8.25 an hour. How much money will they have total if Jack works 8 hours and Jill works 10 hours?"

Then what will happen is "8.50 an hour and Jill makes" will be TeXified and will confuse the newbie.

If you really want me too, I can add "$" to the list of inline delimiters (it will require me to read the documentation to see how to do it, but it is possible), but whenever they want to use monetary values in their question, they'd have to type $\$8.50$ instead of $8.50.

EDIT: I decided to enable the single dollar sign for inline TeX rendering. I hope you're happy now! (Tongueout)
 
Last edited:

ThePerfectHacker

Well-known member
Jan 26, 2012
236
The double dollar sign is available as I mentioned above (I personally use \[ for centering things in my TeX documents), but there's a reason why MathJax disables (by default) the use of the single dollar sign. Suppose that someone who doesn't know how to use TeX asks the following question:

"Suppose that Jack makes $8.50 an hour and Jill makes $8.25 an hour. How much money will they have total if Jack works 8 hours and Jill works 10 hours?"

Then what will happen is "8.50 an hour and Jill makes" will be TeXified and will confuse the newbie.

If you really want me too, I can add "$" to the list of inline delimiters (it will require me to read the documentation to see how to do it, but it is possible), but whenever they want to use monetary values in their question, they'd have to type $\$8.50$ instead of $8.50.
Yes you are correct. The current one must stay. However, if it is possible, can you personalize LaTeX commands for members? If you know how to easily do this then I would appreciate. But if it is too much work then ignore my request.
 

CaptainBlack

Well-known member
Jan 26, 2012
890
Yes you are correct. The current one must stay. However, if it is possible, can you personalize LaTeX commands for members? If you know how to easily do this then I would appreciate. But if it is too much work then ignore my request.
My experience with MathJax is that customised tags for LaTeX are flakey, I have had [tex] [/tex] work when reading the page with chrome, but not with IE8 of Opera.

CB
 

Alexmahone

Active member
Jan 26, 2012
268
On a related note, which software do you (all) suggest for a Mac user? I had downloaded "Texit" (or something like that)... it was a 2gig file that I could never get working.

I would love to be able to communicate math via LaTex in .pdf files, so any suggestions along those lines would be greatly appreciated!
I purchased MathType a few weeks ago to use LaTeX in Microsoft Word, and it's really good. They have a Mac version too; you should probably check it out.
 

Jameson

Administrator
Staff member
Jan 26, 2012
3,966
Great job with the install, Chris! We are working on the site almost around the clock between the two of us because right now I'm in Moscow, Russia and he is in the US. We have a twelve hour time difference between us so more or less one of us is doing something all the time. Credit is also due to Ackbach, who helped me research and discuss our potential choices for Latex software. Long story short, until we have a dedicated server we won't be able to run Latex the same way MHF did and for now, mathjax seems like the best option all things considered.
 

Ackbach

Indicium Physicus
Staff member
Jan 26, 2012
4,173
Rochester, MN
Great job with the install, Chris! We are working on the site almost around the clock between the two of us because right now I'm in Moscow, Russia and he is in the US. We have a twelve hour time difference between us so more or less one of us is doing something all the time. Credit is also due to Ackbach, who helped me research and discuss our potential choices for Latex software. Long story short, until we have a dedicated server we won't be able to run Latex the same way MHF did and for now, mathjax seems like the best option all things considered.
Can I just say that the LaTeX on this site looks better than MHF LaTeX ever did? The font sizes are correct, and the baselines are aligned. Great job!
 

Swlabr

New member
Feb 21, 2012
27
On a related note, which software do you (all) suggest for a Mac user? I had downloaded "Texit" (or something like that)... it was a 2gig file that I could never get working.

I would love to be able to communicate math via LaTex in .pdf files, so any suggestions along those lines would be greatly appreciated!
I use TeXshop. It seems to be free.

Unfortunately, I cannot post a link (I only have one post!). However, the page is http ://pages.uoregon.edu/koch/texshop/.
 

afwings

New member
Mar 7, 2012
9
Austin TX USA
In MathType, there's also a MathJax-LaTeX "translator". In both Windows & Mac versions, you can go to the Preferences menu and click on Cut and Copy Preferences (if your Preferences menu says "Translators" instead of "Cut and Copy Preferences", it's too old), choose MathJax-LaTeX from the list at the bottom, and it will produce the correct code to display on MHB. Just remember to either set or un-set the "Inline Equation" flag in the Format menu. Create the equation/expression in MathType, then copy & paste into MHB. There you have it.

So, with that in mind, I'll leave you with this expression, given to me by a mathematician who's also a chemist: \[ + \sum {{{\left( {{{\rm{F}}^ - }} \right)}^t}2\frac{{d\phi }}{{dk}}} \]



(Add sum floride to the t'th to d-phi d-k.)
 
Last edited:

Amer

Active member
Mar 1, 2012
275
Jordan
\[ \int \sin x \; dx = \cos x + c \]
dose not work how i can enable java ??
sorry it worked
 

CaptainBlack

Well-known member
Jan 26, 2012
890
\[ \int \sin x \; dx = \cos x + c \]
dose not work how i can enable java ??
sorry it worked
You will find that sometimes mathJax is a bit slow, and when using the advanced editor to preview you may need to reload to get the LaTeX to compile (in fact you may find yourself having to reload when posting anyway).

The upside is that MathJax aligns the inline LaTeX material with the rest of the text better than the alternatives.

CB
 

Amer

Active member
Mar 1, 2012
275
Jordan
latex is it not shown.
i tried to refresh( reload the page ) several times nothing appeared :(
 

Jameson

Administrator
Staff member
Jan 26, 2012
3,966
Fixed. Thank you for pointing this out.
 

afwings

New member
Mar 7, 2012
9
Austin TX USA
Can I just say that the LaTeX on this site looks better than MHF LaTeX ever did? The font sizes are correct, and the baselines are aligned.
If I may add an opinion here -- please stay with MathJax! The reason it looks so much better than MHF's LaTeX is because MHF's LaTeX was converted into images for rendering. MathJax uses fonts. Ackbach mentioned one advantage of MathJax -- baselined equations. Another is that the math looks great at any zoom level. Zoom a page with math (I use ctrl+scrollwheel, then ctrl+0 to zoom back to normal) and notice that it looks great at any size. Images won't do that. They'll zoom, but they'll lose quality.

There are downsides to fonts, but not many. As CaptainBlack already mentioned, sometimes MathJax renders differently in one browser than in another. Sometimes this is due to how the browser handles specific fonts, and at the moment IE seems to be the worst. (Why is anyone still using IE anyway?)

For anyone wanting to keep up with MathJax's latest glitches and tweaks, their website does a good job of keeping us informed, as does their Google Group.