handout_latex
handout_latex
Prof M. R. Senouci
September 17, 2023
1
• Bold: \textbf{Bold text} 3.5 Packages
• Italic: \textit{Italic text} LaTeX is highly extensible, and one of its strengths
lies in its vast collection of packages. Packages
• Underline: \underline{Underlined text}
are sets of macros and commands that extend La-
TeX’s functionality, allowing you to accomplish spe-
3.4 Lists cific tasks or formatting requirements.
Create ordered and unordered lists: To use a package, include it in the pream-
ble of your LaTeX document using the
\begin{itemize} % Unordered list \usepackage{package-name} command:
\item Item 1
\item Item 2 \usepackage{graphicx} % To include graphics
\end{itemize}
3.6 Tables
\begin{enumerate} % Ordered list
Design tables with LaTeX:
\item First item
\item Second item \begin{table}[ht]
\end{enumerate} \centering
You can customize labels for ordered and un- \caption{Basic Table}
ordered lists. For unordered lists, use the \begin{tabular}{|c|c|}
\item[custom-label] command: \hline
Column 1 & Column 2 \\
\begin{itemize} \hline
\item[$\star$] Item 1 Data 1 & Data 2 \\
\item[$\diamond$] Item 2 \hline
\item[$\circ$] Item 3 \end{tabular}
\end{itemize} \end{table}
For ordered lists, use the command
\begin{enumerate}[label=custom-label]: The booktabs package offers enhanced table format-
ting:
\begin{enumerate}[label=(\alph*)]
\item Item 1 \usepackage{booktabs}
\item Item 2 ...
\item Item 3 \begin{tabular}{lc}
\end{enumerate} \toprule
Header 1 & Header 2 \\
You can nest lists within other lists to create hi-
\midrule
erarchical structures. Here’s an example of a nested
Data 1 & Data 2 \\
list:
Data 3 & Data 4 \\
\begin{itemize} \bottomrule
\item Main Item \end{tabular}
\begin{itemize}
\item Subitem 1
\end{itemize}
3.7 Figures
\item Another Main Item
\end{itemize} Insert figures into your LaTeX document using the
graphicx package:
2
R∞
\begin{figure} • Integrals: 0
f (x)dx
\centering $\int_{0}^{\infty} f(x) dx$
\includegraphics[width=5cm]{figure.png}
\caption{Caption for the figure.} 1 2
• Matrices:
\label{fig:figure-label} 3 4
\end{figure}
$\begin{bmatrix}
1 & 2 \\
4 Mathematical Equations and 3 & 4 \\
\end{bmatrix}$
Symbols
LaTeX excels at typesetting mathematical content, 4.4 Subscripts and Superscripts
making it an invaluable tool for engineering and sci-
Use underscores (_) for subscripts and caret symbols
entific documents. In this section, we’ll explore how
(^) for superscripts: Temperature (T0 ) and pressure
to create and format mathematical equations and
(P ∗ ) are important variables.
symbols in your LaTeX document.
3
Here’s an example: Suppose you 5. Compile with BibTeX: Compile your LaTeX doc-
have a section labeled as follows: ument with BibTeX. This generates the bibliog-
\section{Introduction}\label{sec:intro}. raphy based on your citations.
To reference this section elsewhere in your
document: In Section~\ref{sec:intro} or 6. Compile Twice: Compile your document twice
\autoref{sec:intro}, we discuss the introduction. to ensure all references are properly updated.
This will automatically generate a link to the
Here’s an example of a BibTeX entry for a journal
labeled section, such as ”In Section 1, we discuss the
article:
introduction,” where ”Section 1” is a clickable link
to the section. You can also reference figures, tables, @article{smith2019,
equations, or any other labeled element in a similar author = {John Smith},
manner. title = {A Comprehensive Study of Civil Engineering},
As shown in Figure~\ref{fig:data-plot}, ... journal = {Journal of Civil Engineering},
year = {2019},
To ensure cross-references are correctly resolved, volume = {42},
you may need to compile your document multiple number = {3},
times. pages = {123-135},
doi = {10.1234/jce.2019.42.3.123}}
6 Bibliography Management
7 Troubleshooting
In academic and research writing, it’s essential to
cite sources properly. LaTeX simplifies this process When facing issues with LaTeX, consider common
through its built-in bibliography management sys- troubleshooting tips like checking your code for errors
tem. To manage bibliographies in LaTeX, follow and recompiling your document. Error messages dur-
these steps: ing compilation often provide helpful clues. Online
communities such as TeX Stack Exchange and LaTeX
1. Create a BibTeX File: Create a separate ‘.bib‘ Community are valuable for seeking assistance and
file that contains the bibliographic information solutions. Additionally, consult LaTeX documenta-
of your sources. Each entry should have a unique tion, and don’t hesitate to ask for help when needed
citation key. as you navigate the learning curve.