LaTeX and other markup!

For the discussion of math. Duh.

Moderators: gmalivuk, Moderators General, Prelates

gmalivuk
GNU Terry Pratchett
Posts: 26820
Joined: Wed Feb 28, 2007 6:02 pm UTC
Location: Here and There
Contact:

LaTeX and other markup!

As many of you already know, the fora now have LaTeX support. This, combined with the [sup] and [sub] tags which have been around for awhile, should make it far easier to type math formulae. jsMath, which is what the new math and imath tags use, only works properly in the prosilver or prosilver_left styles. Sorry, subsilver adherents, but your favorite skin is no longer supported.

Much of the syntax is pretty self-explanatory, and if nothing else you can quote an entry with math in it to see exactly what that person entered to typeset it that way. For a simple guide, you can check out Wikipedia's Help:Displaying a formula page.

What you would enter there between $and$, you would put here with square brackets. math places formulae in the center of a new line $something\ like\ this\ x^2_0$ while imath places it inline, which is only recommended for simpler (non-multiline) things, as it can get cramped otherwise. But for an example [imath]this\ is\ inline\ math\ x^2_0[/imath].

Please take advantage of this new feature, as it greatly expands the range of math that can be readably displayed on the forum.
Unless stated otherwise, I do not care whether a statement, by itself, constitutes a persuasive political argument. I care whether it's true.
---
If this post has math that doesn't work for you, use TeX the World for Firefox or Chrome

(he/him/his)

SpitValve
Not a mod.
Posts: 5130
Joined: Tue Sep 26, 2006 9:51 am UTC
Location: Lower pork village

Re: LaTeX and other markup!

How complex can it be? Lesse:

$v(r)= \left\{ \begin{array}{rl} 2618.86r-11486.7r^2+27263.8r^3-36117.9r^4+24768r^5-6819r^6\mbox{ km/s } & \mbox{ if } r<0.09 \mbox{ kpc } \\ 319.8354-194.3591r+155.30181r^2-63.00332r^3+12.142556r^4-0.869573r^5 \mbox{ km/s } & \mbox{ if } r=0.09-0.45 \mbox{ kpc } \\ -1931.3363+1768.47176r-606.461977r^2+112.102138r^3-11.9698505r^4 \mbox{ }& \\ +0.7367828r^5-0.02423453r^6+0.00032952r^7\mbox{ km/s} & \mbox{ if } r=0.45-1.6 \mbox{ kpc } \\ 264.76 \mbox{ km/s } & \mbox{ if } r>1.60 \mbox{ kpc }\\ \end{array}\right.$

ooo-oooh... fancy.

Qoppa
Posts: 694
Joined: Sat Nov 24, 2007 9:32 pm UTC
Location: Yes.

Re: LaTeX and other markup!

Before someone asks, to change the board skin from subsilver to prosilver:
User Control Panel (in the top right)
Board preferences (in the left options menu)
And then where it says 'My board style' change it to either prosilver or prosilver_left, the difference being prosilver has the avatars on the right side of the screen, and prosilver_left has them on the left (like subsilver).

Also, it's a good idea to change the size of the math to 150% so that it's easier to read and not distorted. You can do this by clicking on the little jsMath box in the bottom right corner, going options and then setting 'scale all mathematics to' to 150%. Make sure to set 'Save settings for' to '5 years' so that it actually stays like that.

Code: Select all

_=0,w=-1,(*t)(int,int);a()??<char*p="[gd\~/d~/\\b\x7F\177l*~/~djal{x}h!\005h";(++w<033)?(putchar((*t)(w??(p:>,w?_:0XD)),a()):0;%>O(x,l)??<_='['/7;{return!(x%(_-11))?x??'l:x^(1+ ++l);}??>main(){t=&O;w=a();}

Amnesiasoft
Posts: 2573
Joined: Tue May 15, 2007 4:28 am UTC
Contact:

Re: LaTeX and other markup!

gmalivuk wrote:Much of the syntax is pretty self-explanatory, and if nothing else you can quote an entry with math in it to see exactly what that person entered to typeset it that way.

You can also double click the formula to see as well.

ICDB
Posts: 198
Joined: Mon Jun 04, 2007 3:34 am UTC

Re: LaTeX and other markup!

I've heard people say this before, but the math looks much, much better on a Mac than on a PC.
Either, it's very nice!

Simon
Posts: 14
Joined: Sat Apr 14, 2007 4:12 pm UTC

Re: LaTeX and other markup!

ICDB wrote:I've heard people say this before, but the math looks much, much better on a Mac than on a PC.
Either, it's very nice!

Proper TeX fonts at the correct weighting for both Mac OS and Windows (i.e. properly adjusted for the respective different gammas) are available here; installing the right set for your machine will make the maths look just as good on any machine.

(BTW, Linux (i.e. freetype) users should use the 'Mac' weighting; the PC ones show up too heavy.)
I don't like numbers which can't be written as fractions. It's an irrational fear.

Posts: 12
Joined: Sat May 03, 2008 10:08 pm UTC
Location: Cornwall, UK

Re: LaTeX and other markup!

Hmm, does it support amsmath?

\begin{align*} \begin{bmatrix} x\\ y \end{bmatrix} &= -\frac{1}{27} \begin{bmatrix} 4 & -5\\ -7 & 2 \end{bmatrix} \begin{bmatrix} 17.1685\\ 17.7848 \end{bmatrix}\\ \begin{bmatrix} x\\ y \end{bmatrix} &= - \frac{1}{27} \begin{bmatrix} -20.25\\ -84.6099 \end{bmatrix}\\ \begin{bmatrix} x\\ y \end{bmatrix} &= \begin{bmatrix} 0.75\\ 3.1337 \end{bmatrix} \end{align*}

Wow, seems like it does! Neat.

Nimz
Posts: 580
Joined: Thu Aug 02, 2007 9:49 am UTC
Location: the origin

Re: LaTeX and other markup!

And pictures?
Spoiler:
$\begin{picture}(200,100) \put(0,0){\line(1,2){12.5}} \put(12.5,25){\line(0,1){50}} \put(0,100){\line(1,-2){12.5}} \put(50,0){\line(-1,2){12.5}} \put(37.5,25){\line(0,1){50}} \put(50,100){\line(-1,-2){12.5}} \put(75,50){\line(1,0){50}} \put(75,50){\line(1,1){6.25}} \put(75,50){\line(1,-1){6.25}} \put(125,50){\line(-1,-1){6.25}} \put(125,50){\line(-1,1){6.25}} \put(150,0){\line(1,1){37.5}} \put(150,100){\line(1,-1){37.5}} \put(187.5,37.5){\line(0,1){25}} \put(200,0){\line(-1,1){18.75}} \put(168.75,31.25){\line(-1,1){6.25}} \put(162.5,37.5){\line(0,1){25}} \put(162.5,62.5){\line(1,1){6.25}} \put(200,100){\line(-1,-1){18.75}} \put(-10,-10){a} \put(55,-10){b} \put(140,-10){c} \put(200,90){d} \put(140,40){e} \put(205,-10){f} \end{picture}$
Heheh. I guess not.
LOWA

Fafnir43
Posts: 98
Joined: Mon Apr 14, 2008 11:11 pm UTC

Re: LaTeX and other markup!

Hmm - is it just me, or has something interesting just been done to the LaTeX engine behind the scenes? Things seem to be rendered as text rather than images now, and for a brief period a few constructions (like [imath]\frac{\partial y}{\partial x}[/imath]) were borked...
This post brought to you by the language C and the number F.

ICDB
Posts: 198
Joined: Mon Jun 04, 2007 3:34 am UTC

Re: LaTeX and other markup!

Simon wrote:Proper TeX fonts at the correct weighting for both Mac OS and Windows (i.e. properly adjusted for the respective different gammas) are available here; installing the right set for your machine will make the maths look just as good on any machine.

Ah I was using an old library computer vs. a newer mac, that probably made the difference.

++\$_
Mo' Money
Posts: 2370
Joined: Thu Nov 01, 2007 4:06 am UTC

Re: LaTeX and other markup!

Any chance to add a few definitions?

In particular, an "\abs" control sequence (for vertical bars that automatically size themselves) would be nice:

\def\abs#1{{\left | #1 \right \vert}}

From my Plain TeX custom macros file on my machine, for the record.

Nimz
Posts: 580
Joined: Thu Aug 02, 2007 9:49 am UTC
Location: the origin

Re: LaTeX and other markup!

gmalivuk wrote:As many of you already know, the fora now have LaTeX support. This, combined with the [sup] and [sub] tags which have been around for awhile, should make it far easier to type math formulae. jsMath, which is what the new math and imath tags use, only works properly in the prosilver or prosilver_left styles. Sorry, subsilver adherents, but your favorite skin is no longer supported.

That said, does this excuse such things as "[imath]\{1,2\} < \{3,4\}[/imath] or [imath]\{3,4\} < \{1,2\}[/imath]" when it is simpler to write "{1,2} < {3,4} or {3,4} < {1,2}"? It renders just as well or better (e.g. unexpected failure of jsMath). And if you're assuming it's going to be a different size by putting it into [imath] tags, the font size tag is still simpler and more universal than imath, even among prosilver users.

Basically, can we have a policy of encouraging universal legibility? I don't suggest not using jsMath, as that would be mad. But I do suggest if something can be written using the typical characters on a keyboard without LaTeX, $and [imath] should be avoided. LOWA gmalivuk GNU Terry Pratchett Posts: 26820 Joined: Wed Feb 28, 2007 6:02 pm UTC Location: Here and There Contact: Re: LaTeX and other markup! Yeah, I was actually going to say that things which could already be typed inline without any special tags, should still be posted that way. No need to increase rendering time and decrease the number of people who can read it correctly, when doing so accomplishes nothing of real benefit over typing it as normal. Unless stated otherwise, I do not care whether a statement, by itself, constitutes a persuasive political argument. I care whether it's true. --- If this post has math that doesn't work for you, use TeX the World for Firefox or Chrome (he/him/his) Random832 Posts: 2525 Joined: Wed Oct 10, 2007 4:38 pm UTC Re: LaTeX and other markup! Blackboard bold (i.e. ℤ for the integers) isn't supported (\mathbb just gives ordinary bold) is there any way to add support for that? EDIT: it looks like this is what needs to be done. Also - I've noticed that in some cases, what to do isn't obvious, and people don't seem to want to sift through that huge instruction page - I've started working on a "quick start guide" to doing math markup - would that be helpful to post here as a thread? CFT Posts: 66 Joined: Mon Apr 14, 2008 11:33 am UTC Re: LaTeX and other markup! Random832 wrote:Blackboard bold (i.e. ℤ for the integers) isn't supported (\mathbb just gives ordinary bold) is there any way to add support for that? Use \unicode{x????} for such fonts. For example \unicode{x2124} is [imath]\unicode{x2124}[/imath]. A page with useful codes is here: http://en.wikipedia.org/wiki/Letterlike_Symbols . sh3l1 Posts: 11 Joined: Fri Nov 28, 2008 3:32 am UTC Re: LaTeX and other markup! [math]y=x/2$
It seems that all it does on simple equations is make it italic. Oooh, italic. I must not know how to write up LaTex.

Mathmagic
It's not as cool as that Criss Angel stuff.
Posts: 2926
Joined: Thu Nov 30, 2006 12:48 am UTC
Location: In ur fora posting in teh threads

Re: LaTeX and other markup!

sh3l1 wrote:$y=x/2$
It seems that all it does on simple equations is make it italic. Oooh, italic. I must not know how to write up LaTex.

You need to use actual TeX code, such as typing "y=\frac{x}{2}" (without the quotes, and in math tags) to get [imath]y=\frac{x}{2}[/imath]. I find myself referring to this site on a regular basis for TeX characters and the coding for them.
Axman: That, and have you played DX 10 games? It's like having your corneas swabbed with clits made out of morphine.
Pathway: cocks cocks cocks

thinglie
Posts: 54
Joined: Sat Jul 12, 2008 10:16 pm UTC

Re: LaTeX and other markup!

Is there a LilyPond parser available?

$\begin{lilypond} \relative c'' { a4 b c d } \end{lilypond}$

Clearly, there needs to be.

gmalivuk
GNU Terry Pratchett
Posts: 26820
Joined: Wed Feb 28, 2007 6:02 pm UTC
Location: Here and There
Contact:

Re: LaTeX and other markup!

To gauge actual demand for that, you could post about it in the Music forum.
Unless stated otherwise, I do not care whether a statement, by itself, constitutes a persuasive political argument. I care whether it's true.
---
If this post has math that doesn't work for you, use TeX the World for Firefox or Chrome

(he/him/his)

Konstantin
Posts: 12
Joined: Thu Oct 30, 2008 8:45 pm UTC

Re: LaTeX and other markup!

On an only tangentially related note, I need LaTeX for a class and it appears that quite literally every official mirror of it is down. Does forum code offer full LaTeX text setting support, or only the mathematics portion?

Random832
Posts: 2525
Joined: Wed Oct 10, 2007 4:38 pm UTC

Re: LaTeX and other markup!

Konstantin wrote:On an only tangentially related note, I need LaTeX for a class and it appears that quite literally every official mirror of it is down. Does forum code offer full LaTeX text setting support, or only the mathematics portion?

Only math.

If you install almost any linux distribution you can probably load it from their package repositories.

Xv8M4g3r
Posts: 18
Joined: Thu Dec 04, 2008 11:52 am UTC

Re: LaTeX and other markup!

$x_{1,2}=\frac{-b\pm\sqrt{\color{Red}b^2-4ac}}{2a}$
Whys my colour only apply to the b?
Not the whole row? (b^2+4ac)
Slowpoke says: 'GENERATION BB/9000*(A(g_64,g_64)): World first ever social experiment! Add one meme to this sig and post it in yours!'

jestingrabbit
Factoids are just Datas that haven't grown up yet
Posts: 5967
Joined: Tue Nov 28, 2006 9:50 pm UTC
Location: Sydney

Re: LaTeX and other markup!

Xv8M4g3r wrote:$x_{1,2}=\frac{-b\pm\sqrt{\color{Red}b^2-4ac}}{2a}$
Whys my colour only apply to the b?
Not the whole row? (b^2+4ac)

$x_{1,2}=\frac{-b\pm\sqrt{ \color{Red}{b^2-4ac}}}{2a}$

Who the hell knows?
ameretrifle wrote:Magic space feudalism is therefore a viable idea.

Xv8M4g3r
Posts: 18
Joined: Thu Dec 04, 2008 11:52 am UTC

Re: LaTeX and other markup!

$x_{1,2}=\frac{-b\pm\sqrt{ \color{Red}{b^2-4ac}}}{2a}$
Missed a space maybe? hmm cheers!
Slowpoke says: 'GENERATION BB/9000*(A(g_64,g_64)): World first ever social experiment! Add one meme to this sig and post it in yours!'

jestingrabbit
Factoids are just Datas that haven't grown up yet
Posts: 5967
Joined: Tue Nov 28, 2006 9:50 pm UTC
Location: Sydney

Re: LaTeX and other markup!

Xv8M4g3r wrote:Missed a space maybe? hmm cheers!

$x_{1,2}=\frac{-b\pm\sqrt{\color{Red}{b^2-4ac}}}{2a}$

Nope, that isn't the significant change that I made to your code.

$\color{Red}monkeys,\ \color{Red}{monkeys}$
ameretrifle wrote:Magic space feudalism is therefore a viable idea.

PM 2Ring
Posts: 3715
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Sydney, Australia

Re: LaTeX and other markup!

It appears that the forum software doesn't support the \binom tag. What's the preferred form for binomial coefficients here?

[imath]n \choose k[/imath] , [imath]{}^n \! \mathbf{C}_k[/imath] or [imath]{}_n \! \mathbf{C}_k[/imath] ?

I originally learned the 2nd form, though I'm quite familiar with the first form, and it's obviously the easiest to type.

I only noticed the last form quite recently, and FWIW I think it's ugly.

gmalivuk
GNU Terry Pratchett
Posts: 26820
Joined: Wed Feb 28, 2007 6:02 pm UTC
Location: Here and There
Contact:

Pretty sure the first one is what basically everyone's been using since $tags were implemented in the first place. Unless stated otherwise, I do not care whether a statement, by itself, constitutes a persuasive political argument. I care whether it's true. --- If this post has math that doesn't work for you, use TeX the World for Firefox or Chrome (he/him/his) Haeche Posts: 34 Joined: Sat May 02, 2009 9:14 pm UTC Contact: Re: LaTeX and other markup! [imath]\pi(x|y) = N\left(\mu_x + \frac{\sigma_{xy}}{\sigma_y^2}(y-\mu_y),\sigma_x^2(1-\rho_{xy}^2)\right)[/imath] Haeche Posts: 34 Joined: Sat May 02, 2009 9:14 pm UTC Contact: Re: LaTeX and other markup! very nice. well... that was my first post. hallo folks dinoian Posts: 8 Joined: Wed Jul 29, 2009 10:54 pm UTC Re: LaTeX and other markup! I'm having some trouble with the \frac command when using LaTeXiT on my mac. I'm inputting: Code: Select all g=\frac{2}{t_1+t_2} (\frac{D}{t_2} - \frac{d}{t_1}) and getting the D/t_2-d/t_1 in the denominator next to t_1+t_2 and nothing in the numerator. Talith Proved the Goldbach Conjecture Posts: 848 Joined: Sat Nov 29, 2008 1:28 am UTC Location: Manchester - UK Re: LaTeX and other markup! dinoian wrote:I'm having some trouble with the \frac command when using LaTeXiT on my mac. I'm inputting: Code: Select all g=\frac{2}{t_1+t_2} (\frac{D}{t_2} - \frac{d}{t_1}) and getting the D/t_2-d/t_1 in the denominator next to t_1+t_2 and nothing in the numerator. Your code gives: [math]g=\frac{2}{t_1+t_2} (\frac{D}{t_2} - \frac{d}{t_1})$

is that not what you wanted?

if it looks something like

$g=\frac{2}{{t_1+t_2} (\frac{D}{t_2} - \frac{d}{t_1}})$

then you've made a mistake with your bracing and need to correct that (it can get confusing with lots of nested braces).

double click on the typeset stuff above to see the LaTeX code.

dinoian
Posts: 8
Joined: Wed Jul 29, 2009 10:54 pm UTC

Re: LaTeX and other markup!

That is exactly what I wanted, but it is coming out like:
$g = 2 \frac{}{t_1+t_2 (\frac{D}{t_2}-\frac{d}{t_1})}$

jestingrabbit
Factoids are just Datas that haven't grown up yet
Posts: 5967
Joined: Tue Nov 28, 2006 9:50 pm UTC
Location: Sydney

Re: LaTeX and other markup!

There'll be some white space in the "\frac{2}{" bit somewhere. Could be a tab, could be anything. Also, put a \left in front of your left bracket, and a \right in front of your right, like so

$\left(\frac{1}{2}\right)$
ameretrifle wrote:Magic space feudalism is therefore a viable idea.

MathChief
Posts: 8
Joined: Mon Sep 28, 2009 3:18 pm UTC

Re: LaTeX and other markup!

$\int_{\Omega} \Delta u dx = \int_{\partial \Omega} \frac{\partial u}{\partial \vec{n}} dS$

some test
I am a Math/Physics/Astrodynamics/Programming geek
I am currently working on Navier-Stokes and Maxwell equations
My Gamertag for XBOX LIVE and PSN same as my username

saxasm
Posts: 4
Joined: Sat Feb 27, 2010 9:51 pm UTC

Re: LaTeX and other markup!

$t=\sqrt[3]{v+\dfrac{4}{3} \pi (6371+d)^3 \over {\dfrac{4}{3}\pi}}-6371-d$

$v=(\dfrac{4}{3} \pi (6371+t+d)^3)-(\dfrac{4}{3} \pi (6371+d)^3$

It seems to work well. I'm too lazy to figure out the third formula if you know t and v.. Also, first post. Hello.

antonfire
Posts: 1772
Joined: Thu Apr 05, 2007 7:31 pm UTC

Re: LaTeX and other markup!

Random832 wrote:Blackboard bold (i.e. ℤ for the integers) isn't supported (\mathbb just gives ordinary bold) is there any way to add support for that?
This is genuinely broken now. At the time of this writing, "\mathbb{Z}", [imath]\mathbb{Z}[/imath], gives the error "Unknown control sequence '\msbm'".

I can probably install fonts locally to make this go away (can I?), but that would hardly fix the problem of people being unable to read what I write.
Jerry Bona wrote:The Axiom of Choice is obviously true; the Well Ordering Principle is obviously false; and who can tell about Zorn's Lemma?

gmalivuk
GNU Terry Pratchett
Posts: 26820
Joined: Wed Feb 28, 2007 6:02 pm UTC
Location: Here and There
Contact:

Re: LaTeX and other markup!

In the meantime, putting ℤ in math tags gives the right character.
Unless stated otherwise, I do not care whether a statement, by itself, constitutes a persuasive political argument. I care whether it's true.
---
If this post has math that doesn't work for you, use TeX the World for Firefox or Chrome

(he/him/his)

Mavrisa
Posts: 340
Joined: Mon Dec 22, 2008 8:49 pm UTC
Location: Ontario

Re: LaTeX and other markup!

Simon wrote:Proper TeX fonts at the correct weighting for both Mac OS and Windows (i.e. properly adjusted for the respective different gammas) are available here; installing the right set for your machine will make the maths look just as good on any machine.

It looked pretty bad before I installed the fonts. After I installed the 25 font (I'm using a PC), it looked worse. 20 and 30 looked even worse. So I got rid of them altogether, and that seems to look the best... ?
"I think nature's imagination is so much greater than man's, she's never gonna let us relax."

bosecondensate
Posts: 1
Joined: Tue Apr 13, 2010 12:35 am UTC

Re: LaTeX and other markup!

Testing support for xypic
$\xymatrix{T\times V\ar[r]^p\ar[dr]_i&T\otimes V\ar[d]^h\\&W$

dotproduct
Posts: 5
Joined: Mon Feb 22, 2010 3:39 am UTC

Re: LaTeX and other markup!

It's not showing up right in preview, so I'll check if that's just the preview or if it's really not working.

<imath>\Delta^1_2</imath>