Omnimaga

General Discussion => Other Discussions => Math and Science => Topic started by: Xeda112358 on October 28, 2014, 12:24:57 pm

Title: PrettyPrinting your Math Posts
Post by: Xeda112358 on October 28, 2014, 12:24:57 pm
If you want to post math stuff, it is a fantastic idea to take advantage of the [tex] <expression> [/tex] tags. Here is an example:

##e^{\sqrt{\frac{-3x}{2}}}## versus e^(sqrt(-3x/2)).


The code used in the tags is called LaTex and you can look up the fun stuff you can do with it via Google. However, for a bit of a quick start I will give the following nonsense expression and it's code:


##\sqrt{3} \neq \frac{\pi^{2}}{6} = \sum_{k=1}^{\infty}{\frac{1}{k^{2}}} \gt \zeta \left(2+\epsilon\right), \epsilon \in \mathbb{R}, \epsilon>0##


The code is:
[tex]\sqrt{3} \neq \frac{\pi^{2}}{6} = \sum_{k=1}^{\infty}{\frac{1}{k^{2}}} \gt \zeta \left(2+\epsilon\right), \epsilon \in \mathbb{R}, \epsilon>0[/tex]


That might look scary, so let's break it down:
\sqrt{} will put a square root symbol over everything inside {}
\neq is the "not equals" sign. There are also \leq, \lt, \geq, \gt.
\frac{numerator}{denominator} makes an expression in fraction form.
\pi is the pi symbol
^{exponent} raises the expression to a power
= is the = symbol
\sum_{lower limit}^{upper limit}{expression} creates a sum from an upper to lower limit (optional arguments). As a note, _{} creates a subscript, ^{} is a super script, if that helps to figure the stuff out.
\infty is the infinity symbol.
\gt is the greater than symbol
\zeta is the lower case zeta symbol. \Zeta is uppercase. LaTeX is case sensitive.
\left( is a left parentheses. It gets sized according to what comes between it and it's matching \right).
\in makes the "element of" symbol
\mathbb{} makes a "blackboard bold" character for certain special sets (N,Z,Q,A,R,C,H,O,S)


So for fun, here are some simpler codes and their outputs:
\left( 3^{2} \right)
##\left( 3^{2} \right)##


x_{n}
##x_{n}##


\frac{1}{k}
##\frac{1}{k}##


\sum_{k=1}^{n}{\frac{1}{k}}
##\sum_{k=1}^{n}{\frac{1}{k}}##
Title: Re: PrettyPrinting your Math Posts
Post by: Juju on October 29, 2014, 10:52:35 am
The board supports TeX now? Awesome. It will be pretty useful for you math people. I remember last year when I had university math courses and I did pretty much all my homework in LaTeX it's pretty powerful.
Title: Re: PrettyPrinting your Math Posts
Post by: Sorunome on October 29, 2014, 11:08:47 am
The board supports TeX now? Awesome. It will be pretty useful for you math people. I remember last year when I had university math courses and I did pretty much all my homework in LaTeX it's pretty powerful.
It already supported that since quite some time :P
Title: Re: PrettyPrinting your Math Posts
Post by: aeTIos on October 29, 2014, 11:12:24 am
Well, if you don't tell us, we won't notice because everyone uses the quick reply box and never checks all bbtags :P
Title: Re: PrettyPrinting your Math Posts
Post by: DJ Omnimaga on October 29, 2014, 11:21:35 am
I like that board feature, although it takes a bit to render it seems. At least it makes anything math-related much easier to read and more natural, not to mention you don't have to screenshot your formulas to post them.

As long as the SMF 2.0 mod used isn't involving OS 2.55MP :P
Well, if you don't tell us, we won't notice because everyone uses the quick reply box and never checks all bbtags :P
I agree. Actually I think a lot of board features that got added during the upgrade were quietly added to see when members would finally notice. I noticed this particular feature since the beginning, though, but I didn't make much noise about it since I don't really follow math threads much anymore.
Title: Re: PrettyPrinting your Math Posts
Post by: aeTIos on October 29, 2014, 11:22:25 am
I thought I read somewhere that it used 2.71MP.
Title: Re: PrettyPrinting your Math Posts
Post by: Sorunome on October 29, 2014, 11:22:34 am
inb4 your ram clears when viewing the boards xD
Title: Re: PrettyPrinting your Math Posts
Post by: Juju on October 29, 2014, 03:45:24 pm
It uses a rather fancy javascript library (http://www.mathjax.org/) to render all the TeX. So that's it's not loading that fast, but it's still quite fast for me.
Title: Re: PrettyPrinting your Math Posts
Post by: Hayleia on October 29, 2014, 03:46:39 pm
Good idea to post this for those who didn't know the forum supported this, those who don't know how to LaTeX, or those who know but forgot :P

Something also worth noting is the difference between those codes :
\sum_{k=1}^{n}{\frac{1}{k}}: ##\sum_{k=1}^{n}{\frac{1}{k}}##
\sum\limits_{k=1}^{n}{\frac{1}{k}}: ##\sum\limits_{k=1}^{n}{\frac{1}{k}}##
One is faster to write and doesn't kill line alignement too much, the other one is more realistic.
Title: Re: PrettyPrinting your Math Posts
Post by: Adriweb on October 29, 2014, 07:50:50 pm
Hum ?
(this everywhere)

(https://i.imgur.com/UzAmcXfm.png) (https://i.imgur.com/UzAmcXf.png)

Edit : ah well, sometimes it works when refreshing, sometimes not. Weird, it's the firs time I see MathJax doing that, and believe me I've seen all kind of stuff when I integrated it on TI-Planet
Title: Re: PrettyPrinting your Math Posts
Post by: Juju on October 29, 2014, 08:03:31 pm
Welp, I just got it too, after it worked flawlessly for as long as I saw it.
Title: Re: PrettyPrinting your Math Posts
Post by: DJ Omnimaga on October 30, 2014, 02:10:12 am
Hum ?
(this everywhere)

(https://i.imgur.com/UzAmcXfm.png) (https://i.imgur.com/UzAmcXf.png)

Edit : ah well, sometimes it works when refreshing, sometimes not. Weird, it's the firs time I see MathJax doing that, and believe me I've seen all kind of stuff when I integrated it on TI-Planet
I have this happen except it always eventually appears fine for me. It seems like there's a long delay before the post changes are processed. Is that script hosted on Omnimaga or is it hosted externally?
Title: Re: PrettyPrinting your Math Posts
Post by: Xeda112358 on November 13, 2014, 12:20:44 pm
Good idea to post this for those who didn't know the forum supported this, those who don't know how to LaTeX, or those who know but forgot :P

Something also worth noting is the difference between those codes :
\sum_{k=1}^{n}{\frac{1}{k}}: ##\sum_{k=1}^{n}{\frac{1}{k}}##
\sum\limits_{k=1}^{n}{\frac{1}{k}}: ##\sum\limits_{k=1}^{n}{\frac{1}{k}}##
One is faster to write and doesn't kill line alignement too much, the other one is more realistic.
Ooh, thanks for that! I had a version on my old computer that worked the natural way without needing the \limits thingy.