Czech version
logolink

< Back to the list of lessons

LaTeX Practically I

ostatni-sinContent of the lesson:

  • Assignment of the Problem
  • Typesetting

Assignment of the Problem

Our task is to create a one-sided document in LaTeX which will contain several mathematical symbols. The final document can be seen in the following image.

ukázka výsledného dokumentu

We will realize this task using the webpage TeXonWeb which allows us to use LaTeX without the need to install anything (you have to be able to access the Internet of course). To write our document you can use any text editor (like PSPad or NotePad, etc.).

Typesetting

The First Paragraph

Take a look at the first paragraph. There are several words of common text and several special symbols:

  • arrow above F,
  • formula F=... which consists of common characters and the symbol for multiplying,
  • the last formula which contains s-2

Create a new file matematicky-text.tex and open it using any text editor. Write the common text and stop before the first mathematical symbol. The system LaTeX offers you a set of symbols which can be used to write special mathematical symbols. These commands usually start with the character \. Try to search the string "latex symbols" using Google and you can find this page for example: http://omega.albany.edu:8008/Symbols.html of this pdf file: The Comprehensive Latex Symbol List on CTAN.

You can search the links and find that an arrow above letter (mark for vectors) can be created using the command \vec followed by braces. The text below the arrow has to be inserted inside the braces. It is important to know that mathematical text has to be marked (you can see a different font is used for mathematical symbols - why?). Mr. Knuth decided to use the symbol $ for mathematical formulas because typesetting of mathematical books was so expensive. You have to put the $ symbol before and after every mathematical text. The first sentence should look like the following example:

The first sentence in LaTeX
Z fyziky víme, že velikost síly $\vec{F}$ vypočteme vztahem $F=m\cdot a$, kde $m$ je hmotnost tělesa a $a$ je zrychlení.

Insert this line inside the marks \begin{document} and \end{document} inside the form at TeXonWeb.

Placing text inside the LaTeX document
\documentclass{article}
\usepackage{czech}
\begin{document}
Z fyziky víme, že velikost síly $\vec{F}$ vypočteme vztahem $F=m\cdot a$, kde $m$ je hmotnost tělesa a $a$ je zrychlení.
\end{document}

první vložený řádek v LaTeX souboru

Now you can click on PDF button. In case you have a PDF viewer you can open the final PDF file with the requested text.

You can finish the paragraph after finding out that a power can be written by the notation ^{-2}. In other words, the symbol ^ will convert the content of braces {} to the upper index. Letters inside the last formula are not written in italics because they do not represent variables.

Next line of text in LaTeX
Jednotkou síly je 1 N, jehož fyzikální rozměr odvodíme z předchozího vztahu: N = kg$\cdot$m$\cdot$s$^{-2}$.

The Second Paragraph

The next step is writing longer formulas. In case you want to highlight a formula and place it on a new line, you should use two dollars instead of one (typesetting of such formulas is even more expensive :)).

You will face two problems:

  • How to write the letter pi? You can find the answer in the Internet and the solution is very easy - you should use the command \pi.
  • The second problem is a fraction. You can find the command \frac{}{} using the Internet. You should place the upper part of your fraction (numerator) in the first braces and the lower part (denominator) in the second ones. In our case we use the notation \frac{4}{3}.

The final situation inside our browser:

Expanding the LaTeX document
\documentclass{article}
\usepackage{czech}
\begin{document}
Z fyziky víme, že velikost síly $\vec{F}$ vypočteme vztahem $F=m\cdot a$, kde $m$ je hmotnost tělesa a $a$ je zrychlení.
Vztahy pro povrch a objem koule jsou:
$$S=4\pi r^2, \qquad V=\frac{4}{3}\pi r^3,$$ po dosazení pro $r=5,9$ dostáváme výsledky: $S\doteq 437,435$ a $V \doteq 860,29$. \end{document}

To insert a larger space inside formulas, you can find an appropriate command (\qquad). The symbol for rounded value is also available in the Internet - \doteq.

The Third Paragraph

You have to solve two more problems here:

  • text written in italics ("goniometrická jednička") should be placed as an argument for the command \emph{} (from word emphasize),
  • to get the Greek symbol alpha you should use \alpha.

The final situation inside our browser:

Expanding the LaTeX document
\documentclass{article}
\usepackage{czech}
\begin{document}
Z fyziky víme, že velikost síly $\vec{F}$ vypočteme vztahem $F=m\cdot a$, kde $m$ je hmotnost tělesa a $a$ je zrychlení.
Vztahy pro povrch a objem koule jsou:
$$S=4\pi r^2, \qquad V=\frac{4}{3}\pi r^3,$$
po dosazení pro $r=5,9$ dostáváme výsledky: $S\doteq 437,435$ a $V \doteq 860,29$.
Takzvaná \emph{goniometrická jednička} $\sin^2\alpha + \cos^2\alpha =1$ nám pomáhá při řešení rovnic. \end{document}

You can see that special commands \sin and \cos are used to get sine and cosine symbols - these commands will use the correct (noncursive) typesetting of these functions.

The Fourth Paragraph

You have to solve the problem of limits in this paragraph.

  • command for limits is \lim_{}, you should place the text below lim to brackets and the symbol "_" will place it to its position. In other cases the symbol "_" is used for converting text to lower index.
  • the notation of n goes to infinity - the symbol of arrow can be written by the command \to and the symbol of infinity by the command \infty.
The fourth paragraph in LaTeX
Limity typu $\frac{0}{0}$ a $\frac{\infty}{\infty}$ počítáme L´Hospitalovým pravidlem, například
\begin{equation}
\lim_{n\to \infty}\frac{x^2 -4x}{2x^2 +3x -1} = \lim_{n\to \infty}\frac{2x -4}{4x +3}
\end{equation}
a odsud další derivací dostáváme
\begin{equation}
\lim_{n\to \infty}\frac{2x -4}{4x +3}=\frac{1}{2}.
\end{equation}
derivace je principiálně popsána vztahem 3.

We used the command equation for enabling an environment used to create equations. Every environment begins after the command \begin{name_of_environment} and ends before the command \end{name_of_environment}. A standard property of every equation environment is adding numbers for every equation inside. Thanks to this you will get numbers at the right side of every equation.

Typesetting of the more difficult part of text will be explained in the following lesson.

Additional Texts

Links

Questions

  1. How can you write a special (for example mathematical) symbol which can not be written by keyboard in LaTeX?
  2. How can you find help articles for LaTeX in the Internet?
  3. How can you find a way to write a concrete specific symbol?
  4. What is the meaning of $ or $$ in LaTeX?
  5. Where can you use LaTeX in the Internet in case you do not want to install any software to your computer?
webdesign, xhtml, css, php - Mgr. Michal Mikláš