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.  Openwetware.org 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.

Can we Graph Inequalities in GeoGebra?

Update (Oct 2, 2010): The GeoGebra 4.0 version can now graph linear inequalities. Click here to read about it.

I wrote this because there are a lot of searches in my Blog Stat searching how to graph inequalities in GeoGebra. UNFORTUNATELY, GeoGebra is still working on this feature. I emailed Markus Hohenwarter, the creator and lead programmer of GeoGebra, two years ago requesting for this feature but he told me that he was still working on more important features.

There are, however, GeoGebra users who found a way to improvise. Some of the links are shown below.

http://www.geogebra.org/en/upload/files/english/Daniel_A_Kaufmann/Inequalities.htm

http://www.geogebra.org/en/upload/files/english/dtravis/sys_of_line_inequalities.html

http://www.geogebra.org/en/upload/files/italian/remigio/diseq/diseq.html

If you are just looking for a software that can graph inequalities, you can try  Graph Calculator 3D which has a free edition. The screen shot of graphs of systems of inequalities is shown below.

Notice, that graphing inequalities in this software is very easy. First, you just have to type the equations or inequalities (upper left of the diagram), then choose the graph attributes (middle left of the diagram). You can also choose 3-dimensional graphs.

I will have a separate tutorial post on how to use the Graph Calculator 3D  soon.

Why is the angle sum of the interior angles of a triangle 180 degrees?

We were taught that the sum of the measures of interior angles of a triangle is 180 degrees. But how come? Is it true no matter what the shape or size of the triangle?

Angle Sum of Triangles

Figure 1 – Triangles with interior angles a, b and c

Recall that an angle is the amount of rotation of a ray.  In Figure 2, the ray was rotated from A to C, and the amount of rotation is 60 degrees. We can say that the measure of angle ABC is 60 degrees.

Angle Sum of Triangles

Figure 2 – Ray containing A is rotated to to C making a 60-degree angle rotation

The rotation from A to D forms a straight line and measures 180 degrees.  Therefore, straight angle ABD measures 180 degrees.  It follows that a 180-degree rotation is a half-circle. Therefore, a complete rotation is 360 degrees.

We can verify if our question about the sum of the interior angles of a triangle by drawing a triangle on a paper, cutting the corners, meeting the corners (vertices) at one point  such that the sides coincide with no gaps and overlaps (see Figure 3). Notice that no matter what the size or shape of a triangle, as long as the previous conditions are met, the two of its sides will be collinear as shown in the Figure below.

Angle Sum of Triangle

Figure 4 – The corners of a triangle put together

However, this is not the proof. To discuss the proof, we are going to use Euclid’s fifth postulate. Euclid’s fifth postulate tells us that if a parallel line is cut by a transversal, their corresponding angles are congruent. In the diagram below, lines p and q are parallel lines and angles shown with the same letters are corresponding angles, and hence congruent.

Figure 5 – Parallel lines p and q cut by a transversal.

Now how do we connect Parallel Postulate to the angle sum of a triangle. Consider a triangle with interior angles a, b, and c. Using the fifth postulate, we use the side containing angles a and c as base of the triangle and extend it to both sides. Next, we draw a line to the base and passing thorugh the vertex not on the base.

Figure 6 – Triangle with three points on two parallel lines

Now, the sum of angles a, b and c is 180 degrees (why?). But a, b and c are also the interior angles of a polygon. Therefore, the sum of the interior angles of a triangle is 180 degrees.

You may also want to read Sum of the Interior Angles of a Polygon.

1 4 5 6 7