Tex

From NewMarsWiki
Jump to: navigation, search

TeX (Pronounce: Tech) is an open-source typesetting tool, originally written by Donald E. Knuth (BTW: This guy is totally cool, his stuff was written so well, it just never crashes, what's more he even gives rewards to people finding bugs in his code!) and widely used by the scientific community to produce arbitrary complex equations without getting a headache.

You can use the [tex].......[/tex] formatting tags in the New Mars messageboards to display mathematical and scientific formula.

For example, producing this (bogus) example: <math>{-b \pm \sqrt{b^2-4ac} \over {2a \Delta}}</math>

Is done by typing:

{-b \pm \sqrt{b^2-4ac} \over {2a \Delta}}   

(Between [tex]... ...[/tex] tags.)


As you may notice, this stuff is in essence fairly self-explanatory. The squiggly brackets, weird words like 'sqrt' and backslashes aside, this is pretty much how you would write a mathematical 'sentence' yourself, if you were to type it into a calculator.

Let's break the 'code' down to some bite-size chunks to explain -and expand upon its uses- some more...

A handy tip, maybe: if you want a formula being rendered with TeX in your posts on the 'boards, you can do this by typing in your formula, then highlighting it and clicking the "TeX" button, which will automatically put the tags at the beginning and the end.

So, on with the show... A simple breakdown of the stuff that made <math>{-b \pm \sqrt{b^2-4ac} \over {2a \Delta}}</math> look like it does:

The first thing you may notice, are the 'squiggly brackets'. These are simply used to group together stuff, sometimes hierarchically. (Nested.)

In this case, the first set of brackets make sure the whole <math>{-b \pm \sqrt{b^2-4ac}</math> kaboodle gets on top of your fraction (or, in TeX-speek: \over). The second set -nested inside the first set- is to make sure <math>{b^2-4ac}</math> gets its root pulled ;) So the brackets are simply there to tell 'sqrt' and '\over' what to include and where to put stuff that has to go at... Well you get the picture. Just like you used those brackets in college.

Now, on with the show...

to use variables, you just type them as is; b gives you <math>b</math>, {-b} gives you <math>{-b}</math>

If you want to look sophisticated, or really know what you're talking about, you might want to use scientific symbols, like some commonly used Greek symbols, as there are <math>\Pi</math> <math>\Gamma</math> <math>\Delta</math> <math>\Omega</math>, etc... you use \Pi , \Gamma , \Delta , \Omega ....


To get a square root of something, you enter sqrt{formula} , which will get you <math>sqrt{formula}</math>

To get a cube or other root, use \sqrt[power] {some stuff} , thus: <math>\sqrt[power]{some stuff}</math>

To use powers, you enter somestuff^{somepowerstuff} , which will show as <math>somestuff^{somepowerstuff}</math>

Oh, and to use indices, use something_{index} , to get <math> something_{index}</math>

To use the plus/minus sign, enter \pm, which shows as <math>\pm</math>

To use fractions, {somestuff} \over {someotherstuff} will shows as <math> {somestuff} \over {someotherstuff}</math>


So, having learned this, take another look at the complex-looking formula used to render <math>{-b\pm\sqrt{b^2-4ac} \over {2a \Delta}}</math>, and decide for yourself if it is still gibberish ;) You may have noticed too, that the TeX engine does a lot of formatting for you, big fractions, equations, ... automatically fit in 'plain' text, without you having to worry about text getting in the way. This brief introduction is only a start, you can use TeX and Latex for a lot more, in fact, most scientific papers are written in (La)TeX today.