LaTeX
LaTeX is the language used in .tex files. It's mostly used to write formal documents such as
- ๐ Text documents (books, reports, resumes...)
- ๐ซ Articles/thesis (academic research...)
- ๐ Presentations (slides for programmers...)
- ...
Where to learn?
- Overleaf (โช)
Basics
A basic document looks like this. You can import packages, and you start writing inside the document block.
\documentclass{article} % book...
% import packages (preamble)
\usepackage[utf8]{inputenc}
\begin{document}
% body of the document
\end{document}
Document
\title{A title}
\author{An author}
\date{A date}
Usually before starting the document, we define some metadata. Then, inside the body, we can generate a title page with \maketitle.
Text
You can write text and use these to apply some style:
\textbf{word}: bold\underline{word}: underlined\textit{word}: italic\emph{word}: emphasis, almost like italic\vspace{NUMBERmm}: space between paragraphs
โก๏ธ To force a newline, use \\ (once or twice) or \newline.
โก๏ธ To center something, use \begin{center}something\end{center}.
Lists
\begin{itemize}
\item an item
\item an item
\end{itemize}
Use enumerate for ordered lists, and itemize for unordered lists.
Code in LaTeX
You can use the minted to write code in LaTeX.
\usepackage{minted}
You need to define a language, for instance, ocaml.
\newminted{ocaml}{breaklines}
โก๏ธ You can write a block of code using this syntax:
\begin{minted}{ocaml}...\end{minted}
โก๏ธ You can import a file using this syntax:
`\inputminted{ocaml}{file.ml}
๐ There is also a package called listings.
Math in LaTeX
Math symbols or formulas can be either inline meaning inside a text, or block-level meaning they will take up a whole line.
- ๐ฌ inline:
$latex$or\(latex\) - ๐งฎ block:
\[latex\]or\begin{equation}latex\end{equation}
๐ Use AtomURL to get the LaTeX code for most mathematical symbols and formulas.
๐ With detexify, draw a symbol and get the LaTeX code.
โก๏ธ Spaces are merged into one. Use \ to prevent it or use \quad.
โก๏ธ You can create a horizontal space with \hspace{1cm}.
โก๏ธ You can use \mathcal{H} for function names/...
โก๏ธ Use \lfloor/\rfloor and \lceil/\rceil for the rounding symbols (partie entiรจre). Use \lvert/\rvert for absolute values.
๐ Use mathjax or katex to render LaTeX formulas in a browser.
๐ป To-do ๐ป
Stuff that I found, but never read/used yet.
\verb! http://localhost:3000/!
\textbackslash{xxx}
\noindent
% https://tex.stackexchange.com/questions/450156/latex-indent-with-alphabet-list
\begin{enumerate}
\item[$a)$] XXX
\end{enumerate}
\pagestyle{empty}\pagestyle{plain}\setcounter{page}{1}
- symbols.pdf
- latexcheatsheet.pdf, latexcheatsheet.pdf (french), video.
- Wikibooks - latex
- math guide for latex
- minted
- maths or xm1math or oeis or wiki help/wiki help or quickref
\phantomsection
\section*{Introduction}
\addcontentsline{toc}{section}{Introduction}