Latex Tutorial: Commonly Used Latex Commands

INTRODUCTION

In my previous latex post, we have seen that Latex is capable of displaying complex mathematical expressions in blogs and forums. In this post, we will discuss the very basics Latex – the most commonly used symbols in high school mathematics and how to code them.

Almost all Latex commands or codes begin with the \ symbol. For example, we want to write a fraction, we must use the \frac command. If we want to use Latex in a WordPress blog, we should enclose it with two dollar signs (see Figure 2) with the word “latex” after the first dollar sign. The dollar signs and the word “latex” is not a latex command, but it tells WordPress (or other applications) that the enclosed text is a mathematical expression and should be displayed in Latex form.  Blogs and forums have different ways of embedding Latex commands (see my previous latex blog for further explanation), so you must know how they work.  In the following discussion, we will use the WordPress format.

If we want to copy the text writtenbelow (without the drawing, of course), we can use a combination of text and Latex in writing the solution.

Figure 1 – A forum post embedded with Latex

The solution was written as follows:

Figure 2 – The Latex code of the text in Figure 1

You should notice that the only latex command above is the \rightarrow command, but the equations are all written in Latex. This is because most of the time, it is advisable to write entire mathematical expressions in Latex to make it look better in web pages.

You should also be careful about the spaces between in your latex code. No spaces before and after the dollar sign, and 1 space after the word “latex”.

BASIC COMMANDS

Below are the basic commands commonly used in high school mathematics. If you want to learn more about the other symbols, a list of symbols can be viewed here and a comprehensive list can be viewed here.

Exponents and Subscripts

In Latex, the symbol ^ is used for exponents and the symbol _ is used for subscript. The {} symbol is used for grouping.

Expression Command Notes
2^3 2^3
2^{10} 2^{10} Note how {} is used. 2^10 will yield
p_k p_k
x^{3}_1 x^{3}_1
2^{a_k} 2^{a_k}
t_{n - 1} t_{n – 1} Try omitting the {} and see what happens.
c^2 = a^2 + b^2 c^2 = a^2 + b^2

 

Fractions

The command \frac is used to type fractions in Latex. The syntax is \frac{numerator}{denominator}.

Expression Command Notes
\frac{2}{3} \frac{2}{3}
\frac{3}{x + 5} \frac{3}{x + 5}
\frac{5}{x + \frac{1}{x}} \frac{5}{x + \frac{1}{x}} Notice that enclosed by the blue  braces are the numerator and denominator of a fraction in the denominator, there is another fraction.

 

Radicals

Radicals are written using the the \sqrt{expression} command. If the index, however, is greater than 2, the syntax is \sqrt[index]{expression}. (See examples 4 and 5}

Expression Command Notes
\sqrt{5} \sqrt{5}
\sqrt{a + b} \sqrt{a + b}
\sqrt{a + \frac{1}{a}} \sqrt{a + \frac{1}{a}}
\sqrt[3]{x + 3} \sqrt[3]{x + 3} You can write the index of the radical before the radicand expression.
\sqrt[5]{(32)^2} \sqrt[5]{(32)^2}

Geometry

Expression Command Notes
\overline{AB} \bot \overline{CD} \overline{AB} \bot \overline{CD} \botis the symbol for perpendicular
\angle {ABC} \cong \angle {PQR} \angle {ABC} \cong \angle {PQR}
\Delta{PQR} \approx \Delta{XYZ} \Delta{PQR} \approx \Delta{XYZ} Delta, the fourth letter of the Greek alphabet, is the symbol for triangle

 

With the Latex commands you already know, you will be surprised that you can already code a lot of expressions. Now try coding the quadratic formula. The code form \pm (plus-minus) is \pm.

The fraction \frac{3}{x+5} above is somewhat small. If you want it to appear in its full size, just add the \displastyle command before the \frac command and do not leave any white spaces. The command

\displaystyle\frac{3}{x+5}

will display \displaystyle\frac{3}{x+5}.

GOING FURTHER

You can do a lot more things using Latex. You can create documents, articles, create cross references among your documents and so on.  In fact, many books and ebooks nowadays are coded in Latex. In creating documents, however, we will need a Latex editor and a compiler.  I am planning to make a tutorial on how to make Latex documents using a Latex editor (not very soon though), so you may want to subscribe to my blog for later updates if you are interested.

Mr. Kogler has also a latex tutorial for  for advanced users here.

Note: If you want to test some of the latex commands, feel free to use the comment box.

Related Posts Plugin for WordPress, Blogger...

20 thoughts on “Latex Tutorial: Commonly Used Latex Commands

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

  2. Pingback: How to write math equations (integrate Latex) in Blogspot/Blogger | Mathematics and Multimedia

  3. Pingback: WP LaTeX | The Open Road

  4. Pingback: This Week In OpenLab! February 26th Edition | The Open Road

  5. I was looking for how to write permutation in Latex but i did not get this in this article.Hope you will include it in your article next time.However,your blog is nice and lots of useful information’s are there.Glad to visit such kind of blog.Though i did not get the above answer but i got other useful information related to math in your blog.Keep up the good work.I also write one blog related to technology named as Tech n Techie.Hope you will also love this blog.

Leave a Reply