# Document Typeset with LaTeX and TeXstudio on Fedora – Part 2

LaTeX is a free and open-source software for typesetting documents. It is a preparation system for high-quality typesetting and the defacto for large technical documents, computer science, and mathematics documents. For example, you can use LaTeX to create math formulas, equations, cover letters, present assignments or thesis, or edit presentations, syllabi, and exams.

Leslie Lamport originally wrote LaTeX to extend the functionality of the TeX typesetting engine by Donald Knuth. Technically, LaTeX is a set of macros and commands for the programming language TEX.

This article is the second part of our LaTeX typesetting series. You can refer to Part 1 for a comprehensive introduction to LaTeX, learn about page designs, formatting, tables, lists, and how to work with graphics. Part 2 will cover how to typeset math formulas, cross-references, listing contents, and bibliographies.

## Create a math document

To make a document with LaTeX, create a file ending in the .tex file extension. When you tell LaTeX to typeset the .tex file, it creates a .pdf file and other auxiliary files. It means that if you make changes to the .tex file, you must typeset the document again for the changes to take effect in the PDF file.

It is recommended to place every LaTeX file in a unique folder to avoid cluttering your system with auxiliary files generated by the LaTeX compiler.

Open (TeXstudio) and save a new file (i.e. math.tex). LaTeX commands typically start with a backslash (\). Command parameters are enclosed in curly braces { }. First, declare the type of the documentclass (i.e. \documentclass{book}).

Then, mark the beginning and the end of the document with begin and end (i.e., \begin{document}, \end{document}). You can then write your math formulas.

Example: Math document

\documentclass[a4paper,12pt]{book}
\usepackage{blindtext}
\usepackage[english]{babel}
begin{document}
\end{document}

Note: We will use this math.tex document in the article to illustrate examples.

### 1: Math formulas

LaTeX provides many commands to write and print mathematical symbols. You can use these commands in different mathematical environments such as inline formulas, displayed formulas, and aligned formulas. The following are some of the ways TeX treats maths.

• All letters are automatically italicized to give a visual cue of a formula instead of a normal letter.
• The spacing is tighter, with no spaces between letters.
• You can use commands for math symbols such as Greek letters and fractions.
• Blank lines are not allowed.

Inline formulas are usually short and typeset formulas inside a sentence. To design an inline formula, enclose an expression in the symbol $. Example: Inline math formulas Let$x = k\cos\theta$and$y = k\sin\theta$. Then$k = \sqrt{x^3 + y^3 }$and$\theta = \arctan(y/x)$. There are thousands of math commands, and you can find symbols from several websites (i.e., detexify ) with lists of LaTeX math symbols. Example: Common inline math commands \section{Inline math} \subsection{Example II: Inline math commands}$a^ba_b\log(x)\alpha\sqrt{x}\frac{a}{b} #### Displayed Math formulas Displayed math typesets formulas on a new line with spacing before and after. Ideal for long, tall, or important equations, expressions, and large symbols such as integrals. To design a displayed formula, enclose the expression in the symbol $enter displayed math formulas$. Example: Displayed math commands \section{Displayed math} \subsection{Example III:Displayed math commands} $\int_0^1 f(x)\, dx = \lim_{n\to\infty} \sum_{i=0}^{n-1} \frac{1}{n} f\left(\frac{i}{n}\right)$ #### Aligned Math formulas Aligned math typesets several formulas, each on its line, with a symbol (i.e., =) in the same place in each line. It is used for expressions that do not fit on a single line or computations with multiple steps. To use the aligned mode, add the amsmath package (\usepackage{amsmath}) to the preamble of the document. Next, use the align* environment to enter aligned mode. You can then type equations as you would for display or inline mode, but with the following modifications: • Place & before symbols to vertically align them. • Place \\ at the end of a line to make a new line. Example: Aligned math \section{Aligned math} \subsection{\texttt{Example IV:Aligned math}} \begin{align*} (m+n)^2 &= (m+n)(m+n) \\ &= m(m+n) + n(m+n) \\ &= m^2 + mn + nm + n^2 \\ &= m^2 + 2mn + n^2. \end{align*} #### Mathematical symbols #### Subscripts and superscript Use _ for indexes or subscripts and ^ for exponents or superscript. $\ x_1^2 + y_3^2 = 1 \\$ $\ \quad 2^{3^y} = 256 \\$ #### Extraction roots A square root follows the order \sqrt[order]{value}. \subsection{\texttt{Example VI:Extraction roots}}\sqrt[256]{k} = \sqrt{\sqrt{\sqrt{\sqrt{\sqrt{k}}}}}$ #### Fractions Use / or \frac to denote fractions. \subsection{\texttt{Example VII:Fractions}} $\frac{n(n+1)}{2}, \quad \frac{\frac{\sqrt{x}+1}{3}-{\sqrt{x}+1}{3}}{y^2}$ #### Greek letters \subsection{\texttt{Example VII:Greek letters}}$\alpha -alpha\\ \lambda -lambda\\
\pi -pi\\ \omega -omega\\ \kappa -kappa\\
\epsilon -epsilon\\ \xi -xi\\ \zeta -zeta\$. #### Script letters Use \mathcal to design calligraphic shapes of upper case letters (A, B, C,…, Z.) in the alphabet. \subsection{\texttt{Example VIII:Script letters}} $\mathcal{A},\mathcal{B},\mathcal{C},\mathcal{D}, \mathcal{E}\ldots,\mathcal{X},\mathcal{Y},\mathcal{Z}$ #### Math operators and symbols You can use the standard LaTeX symbols or find additional symbols with the latexsym and amssymb packages. In addition, there are commands available for binary operators, arrows, relation, subset, superset symbols, and so on. \subsection{\texttt{Example VIX:Math operators and symbols}}$\amalg, \circ \\ \ddagger \diamond \odot \oplus \\
\approx \equiv \dashv \smile \\
\geq \neq \\
\sqsubseteq \subset \subseteq \\
\bigcap \biguplus \int \sum \oint \\
\Longleftarrow \rightarrow \Updownarrow \\
\imath \top \Im \exists \\
\aleph \clubsuit \clubsuit \\ \clubsuit \heartsuit \\
\section{Displayed math}
\subsection{\texttt{Example III:Displayed math commands}}
$\int_0^1 f(x)\, dx = \lim_{n\to\infty} \sum_{i=0}^{n-1} \frac{1}{n} f\left(\frac{i}{n}\right)$
\section{Aligned math}
\subsection{\texttt{Example IV:Aligned math}}
\begin{align*}
(m+n)^2
&= (m+n)(m+n) \\
&= m(m+n) + n(m+n) \\
&= m^2 + mn + nm + n^2 \\
&= m^2 + 2mn + n^2.
\end{align*}
\section{Mathematical symbols }
\subsection{\texttt{Example V:Subscripts and superscript}}
$\ x_1^2 + y_3^2 = 1 \\$
$\ \quad 2^{3^y} = 256 \\$
\subsection{\texttt{Example VI:Extraction roots}}
$\sqrt[256]{k} = \sqrt{\sqrt{\sqrt{\sqrt{\sqrt{k}}}}}$
\subsection{\texttt{Example VII:Fractions}}
$\frac{n(n+1)}{2}, \quad \frac{\frac{\sqrt{x}+1}{3}-{\sqrt{x}+1}{3}}{y^2}$
\subsection{\texttt{Example VII:Greek letters}}
$\alpha -alpha\\ \lambda -lambda\\ \pi -pi\\ \omega -omega\\ \kappa -kappa\\ \epsilon -epsilon\\ \xi -xi\\ \zeta -zeta\$
\subsection{\texttt{Example VIII:Script letters}}
$\mathcal{A}, \mathcal{B}, \mathcal{C}, \mathcal{D}, \mathcal{E}\ldots, \mathcal{X}, \mathcal{Y}, \mathcal{Z}$
\subsection{\texttt{Example VIX:Math operators and symbols}}
$\amalg, \circ \\ \ddagger \diamond \odot \oplus \\ \approx \equiv \dashv \smile \\ \geq \neq \\ \sqsubseteq \subset \subseteq \\ \bigcap \biguplus \int \sum \oint \\ \Longleftarrow \rightarrow \Updownarrow \\ \imath \top \Im \exists \\ \aleph \clubsuit \clubsuit \\ \clubsuit \heartsuit \\ \spadesuit \sharp \infty \triangle \$
\subsection{\texttt{Example: Math structures}}
\texttt{Arrays}
$A = \left( \begin{array}{cc} a_{11} & a_{12} \\ a_{21} & a_{22} \end{array} \right)$
\texttt{Binomial expressions}
$\binom{m}{k} = \frac{m!}{k!(m-k)!}$
\texttt{Matrices}
$A = \begin{pmatrix} a_{13} & a_{22} \\ a_{31} & a_{52} \end{pmatrix}$
\section{ Cross referencing}
\label{sec:Cross referencing}
Learn how to cross reference sections, objects in LaTeX.
\subsection{\texttt{Examples:}}
See section
\ref{sec:Cross referencing}
for an introduction to cross referencing in LaTeX.
\subsection{\texttt{Page referencing:}}
See section~\ref{sec:Cross referencing} on page~\pageref{sec:Cross referencing}
to learn about LaTeX cross referencing.
\begin{figure}
\centering
\fbox{Diagram placeholder}
\caption{\index{UML}UML overview}
\end{figure}
\begin{figure}
\centering
\fbox{Diagram placeholder}
\caption{\index{Database}Database Design}
\end{figure}
\part{Second part}
\chapter{Last chapter}
\appendix
\chapter{Glossary}
\chapter{Symbols}
\printindex
\section*{Recommended references}
To understand business communication in depth, see \cite{W.R.L.1984}. For Social networking,
see \cite{Yate.M.2014}
\begin{thebibliography}{8}
\bibitem{W.R.L.1984} Weaver II, R. L, \emph {Understanding business communica-
tion.} Englewood Cliffs, NJ: Prentice-Hall, 1984.
\bibitem{Yate.M.2014} Yate, M.\emph {Knock ’em dead: Social networking.} Avon,
\end{thebibliography}
\begin{thebibliography}{Yate.M.2014}
\bibitem[W.R.L.1984]{W.R.L.1984} Weaver II, R. L, \emph {Understanding business communica-
tion.} Englewood Cliffs, NJ: Prentice-Hall, 1984.
\bibitem[Yate.M.2014]{Yate.M.2014} Yate, M.\emph {Knock ’em dead: Social networking.} Avon,
\end{thebibliography}
\end{document}

The article is an intermediary guide to typesetting math formulas, cross-referencing, listing content, and creating bibliographies. If you would like to learn more, the following resources are available for learning and mastering LaTeX.

• The Wikibooks LaTeX page includes basic and advanced information about LaTeX.
• LaTeX-Community is a web forum with many subforums, each dealing with topics such as Math, Fonts, and so on. You may ask questions or support, other users looking for help.
• TeX Stack Exchange is a question-and-answer site about TEX, LaTeX, and friends. The users are pros and can answer any question you have.
• The Comprehensive TEX Archive Network (CTAN) houses over 4500 packages and their documentation.
• AMS-Math FAQ is a forum managed by the American Mathematical Society and contains a list of questions and answers to the amsmath and AMS classes and packages.
• TeX Catalogue offers a topical and alphabetical index to nearly 4000 TeX and LaTeX packages and tools.
• The LaTeX Font Catalogue manages a list of all fonts available for use with LaTeX with concrete code examples.

## Wrapping up

That brings us to the end of LaTeX document typesetting Part 2. The article covered typesetting math formulas, cross-referencing, listing content, creating bibliographies, bookmarks, and hyperlinks. I have used plenty of examples (math.tex) that are simple to follow and practice.

I recommend you to refer to Part 1 for an introductory to intermediary guide on mastering LaTeX document typesetting. Moreover, TeX friends are very welcoming and resourceful in whatever community website you decide to join.

22,858Fans
445Followers
16Subscribers

### Persistent Live USB vs. Full Linux install on a USB drive

Live USB is a fascinating way of testing out any Linux distro without modifying or making changes to your computer. Unknown to many, there is data persistency mode in the Live session. So you can make some changes and save the file to your Universal Serial Bus (USB) drive. The data will remain still even after powering off the live session.