Displaying equations using Tex

Pete

It's not rocket surgery
Registered Senior Member
Good news, everyone!
Plazma has told me that we can now use [tex] tags.

Example:
[tex]\frac{-b\pm\sqrt{b^2-4ac}}{2a}[/tex]
Displays as:
$$\frac{-b\pm\sqrt{b^2-4ac}}{2a}$$

I wonder if someone who is good at LaTex could write a short tutorial of the basics, with some common SciForums examples? I'll write one up myself, but I'm a complete beginner at LaTex so it will take a little while.

In the meantime, here's an external tutorial site: LaTex Math Tutorial for mimeTeX

Pete
 
Last edited by a moderator:
Wow! This is a great idea. Thanks, Plazma!

Ok, basics of LaTeX, very briefly:

Grouping, where necessary, is done by enclosing expressions in curly brackets: {}

Superscripts and subscripts:

a^2 gives a superscript:
$$a^2$$
a_2 gives a subscript:
$$a_2$$
a^b_c does both:
$$a^b_c$$
Sometimes, grouping is necessary, as in a^{b+c}:
$$a^{b+c}$$

LaTeX functions are indicated by a backslash followed by the function name. For example \sin \int \pi gives:
$$\sin \qquad \int \qquad \pi$$

Greek letters are produced with a backslash and the letter name:
\alpha, \beta, \gamma, \phi
$$\alpha, \beta, \gamma, \phi$$

Fractions use the \frac function, with the numerator and denominator enclosed in curly brackets:
\frac{mc^2}{a + b + c^3}
$$\frac{mc^2}{a + b + c^3}$$

Sums and integrals can be produced as follows:
\int \limits_a^b 4x^2~dx
\sum \limits_{n=1}^4 n = 10
$$\int \limits_a^b 4x^2~dx$$
$$\sum \limits_{n=1}^4 n = 10$$

Note that a space is inserted in the integral above using a tilde (~).
 
Last edited:
Tex is short for LaTeX?

FREAKIN' SWEET! Now I just have to learn how to use it :)
 
Nice, but what's up with the automatic "x = " at the starting of every tex input?

$$\frac{\partial}{\partial z} \int_{a(z)}^{b(z)} f(x,z) \, dx = \int_{a(z)}^{b(z)} \frac{\partial f}{\partial z} \, dx + f(b(z),z) \frac{\partial b}{\partial z} - f(a(z),z) \frac{\partial a}{\partial z}$$
 
TeX and LaTeX are not the same. TeX is a macro language designed by Donald Knuth back in the 1960s for writing technical papers with lots of math. LaTeX is a macro package for TeX and was written by Leslie Lamport back in the 1980s. Writing in plain TeX is a bear, plain and simple. LaTex makes writing a math paper a breeze.
 
Last edited:
Nice, but what's up with the automatic "x = " at the starting of every tex input?

Looks like a problem with the parsing of the $$ tag.
The mimetex.cgi renderer is working, but "x=" is added to the front of the $$ element content before being sent to the renderer.

Plazma is notified!

Pete$$$$
 
$$\gamma = \lim_{n \rightarrow \infty } \left( \left( \sum_{k=1}^n \frac{1}{k} \right) - \ln (n) \right)=\int_1^\infty\left({1\over\lfloor x\rfloor}-{1\over x}\right)\,dx$$

:)

My favorite constant.
 
Ok, looks like the problem is fixed now.

I'm excited, people! Ooh, maths. It makes me go all gooey inside. ;)
 
Hrm. Does the TeX display incorrectly for IE or is it just this machine I am on (computer at school)? Some of the commands don't show right here (like in my Gamma constant equation, I see 1/[\overx?] instead of 1/x in Tex.
 
The space is important after the \over command.
It should be

1 \over x

which comes out as:

$$1 \over x$$

Or, you can use \frac:

\frac{1}{x}

is displayed as

$$\frac{1}{x}$$
 
Thanks to Plazma for having the bug corrected.

Should we leave this thread stickied, or just link to it in the FAQ?
 
The space is important after the \over command.
It should be

1 \over x

which comes out as:

$$1 \over x$$

Or, you can use \frac:

\frac{1}{x}

is displayed as

$$\frac{1}{x}$$

Well, the code produces the correct equations from my computer. However, it does not output everything from my school's computer. Maybe they are just too old.
 
I haven't returned to sciforums in ages - I'm glad to see that James and Pete are still about and more glad to see that someone has made an equation editor for bb code.

Absane, could you explain that constant? I can't grasp it! Surely as x approaches inf. then ln(x) also approaches something high too?

$$\int{\frac{2x}{x^2}} = ln(x^2)$$

Welcome addition!
 
Absane, could you explain that constant? I can't grasp it! Surely as x approaches inf. then ln(x) also approaches something high too?

Yes, but infinity minus infinity can be finite.
 
$$\gamma = \lim_{n \rightarrow \infty } \left( \left( \sum_{k=1}^n \frac{1}{k} \right) - \ln (n) \right)=\int_1^\infty\left({1\over\lfloor x\rfloor}-{1\over x}\right)\,dx$$

Absane, could you explain that constant? I can't grasp it! Surely as x approaches inf. then ln(x) also approaches something high too?

I don't have a proof that the series converges, but I am sure that it is not too hard.

It goes something like this:

1 - ln(1) = 1
1 + 1/2 - ln(2) = 0.806852819
1 + 1/2 + 1/3 - ln(3) = 0.734721045

1 + 1/2 + 1/3 + ... + 1/100 - ln(100) = 0.582207331651

The series converges to 0.5772156649...

No one knows if this number is irrational. According to Mathworld, "The famous English mathematician G. H. Hardy is alleged to have offered to give up his Savilian Chair at Oxford to anyone who proved gamma to be irrational"

http://mathworld.wolfram.com/Euler-MascheroniConstant.html

But this series is a perfect example as to why we cannot assume infinity - infinity = 0 or any other number for that matter.
 
Back
Top