Latex Tutorial: How to embed Latex in blogs and forums

What is Latex really?

Latex is a typesetting program which is now considered as a standard in mathematical writing.  It works just like MathType and Equation Editor, but has a lot more functionalities.  Equation Editor is just part of a word processor, but Latex is capable of creating an entire document, and mostly in pdf, dvi or postscript format. The other advantages of Latex are discussed by Robert Talbert in his blog Five reasons you should use latex and five tips for teaching it. also discusses the advantages of Latex over Microsoft Word.

Latex, however, is quite different because you have to code the  mathematical expressions and equations instead of writing them.

If you can see web pages with complicated equations or expressions, then it has to be Latex because most web pages do not support writing of mathematical expressions like word processors.

With Latex, equations like

x = \displaystyle\frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

can be easily written in web pages and blogs. In fact, the quadratic formula  you see above is coded with Latex. To see the code, place the mouse pointer on the code and let it rest for about two seconds.

If you are familiar with HTML, it works just like it: its code is different from its output. If you want to write a fraction, for instance, the source code you have to type is \frac{a}{b} where a is the numerator and b is the denominator. This means, that if you want to write \frac{1}{2}, then you have to write \frac{1}{2}. Several examples of Latex source codes and their outputs are shown below. Do not be intimidated with the codes because in the next tutorial, I am going to discuss them slowly and step-by-step.

Latex Source Code Output
\sqrt{x} = 5 \sqrt{x} = 5
A = \frac{(b_1 + b_2)h}{2} A =\displaystyle \frac{(b_1 + b_2)h}{2}
c^2 = a^2 + b^2 c^2 = a^2 + b^2
d = \sqrt{(y_2 – y_1)^2 + (x_2-x_1)^2} d = \sqrt{(y_2 - y_1)^2 + (x_2-x_1)^2}
x = \frac{-b \pm \sqrt{b^2 – 4ac}}{2a} x =\displaystyle\frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
1 + 2 + 3 + \ldots + n = \sum_{i=1}^{n} i = \frac{n(n+1)}{2} 1 + 2 + 3 + \ldots + n = \sum_{i=1}^{n} i = \displaystyle\frac{n(n+1)}{2}
Embedding Latex in Blogs, Forums and Web Pages

Latex  can be embedded in web pages, forums and blogs.  Note that not all forums or blogs are capable of embedding Latex, so you have to know if your service provider is compatible with Latex.   For instance, the Art of Problem Solving forum supports Latex while Ask Dr. Math does not.

Most forums or blogs let you embed Latex by placing dollar signs on both sides of the Latex code as shown below.  Suppose you want to write the following sentence:

For any triangle with side lengths a,b and hypotenuse c, then c^2 = a^2 + b^2.

If you are in Art of Problem Solving Forum, then you have to write it in the following format:

For any right triangle with side $a, b$ and hypotenuse $c$, then $c^2 = a^2 + b^2$.

Red-colored texts shown above are Latex codes.

Also, not all blogs or forums follow the same format. WordPress, for example, places the word latex after the first dollar sign before typing the code, and Moodle places two dollar signs at each side of the latex code. Notice below that the format of embedding changes depending on the service provider or website, but the latex code is always the same.

WordPress Code

For any right triangle with side $latex a, b$ and hypotenuse , then $latex c^2 = a^2 + b^2$.

Moodle Code

For any right triangle with side $$a, b$$ and hypotenuse $$c$$, then $$c^2 = a^2 + b^2$$.

In my next Latex blog, we will learn the basics of coding Latex.

Related Posts Plugin for WordPress, Blogger...

17 thoughts on “Latex Tutorial: How to embed Latex in blogs and forums

  1. Guillermo,

    Thanks for laying out the basics of Latex. My web-based mathematical writing has just improved from reading this post.

    Thanks for the information.

    Mr. Pi

  2. Pingback: The Best Free Math Tutorial Website « Mathematics and Multimedia

  3. Great site and nice introduction to Latex have appreciated your tutorials on GeoGebra and am working my way through your them. Have been trying to set up Latex capabilities using a variety of wordpress plugins for a teacher on staff. I am assuming that provides the latex engine do you know if code such as this works on Appreciate any help you may be able to give me.

    \text{For the following polynomial, answer these questions: Find each: }\underset{x\rightarrow -\infty }{\lim }\text{f(x) and }\underset{x\rightarrow +\infty }{\lim }\text{f(x). [Answer is +$\infty $, -$\infty $, or neither]. h(x) = }-20.79 (x-9) (x-1)^2 (x+6)^3 (x+7)^4\underset{x\rightarrow -\infty }{\lim }\text{f(x) = }\underset{x\rightarrow +\infty }{\lim }\text{f(x) = }

  4. Pingback: How write math equations (integrate Latex) in Blogspot/Blogger « Mathematics and Multimedia

Leave a Reply