LaTeX 101 Documentation

website·Indexed 30 days ago

https://latex101.ddns.net

A beginner's guide to LaTeX covering installation across platforms, creating documents with basic structures and document classes, and a quick reference cheat sheet for commands and functions.

Tokens
1.2K
Snippets
7
Records
14
Agent score
49%

What's inside LaTeX

  1. Understand the LaTeX document preparation paradigm

    LaTeX differs from standard word processors (like MS Word) by using a WYMIWYG (What You Mean Is What You Get) approach rather than WYSIWYG (What You See Is What You Get). Documents are authored as plain text files containing markup instructions for layout and content, which are then processed (compiled) to produce an output file, typically a PDF.
  2. Install LaTeX on Windows

    The standard LaTeX distribution for Windows is MikTeX. After installing the distribution, it is recommended to use a LaTeX editor such as Texmaker or TeXstudio to manage documents.
  3. Use LyX as a beginner-friendly LaTeX editor

    LyX is a cross-platform editor that provides a word-processor-like interface (WYSIWYM). Because LyX is an editor and not a distribution, a LaTeX distribution (such as MikTeX, MacTeX, or TeX Live) must be installed on the system before using LyX.
  4. Quick start LaTeX setup for Linux

    For users on Debian or RedHat derived Linux systems, a minimal LaTeX document can be created and compiled using the pdflatex command. Create a plain text file with a .tex extension, define the document class and environment, and run the compiler.
    # 1. Create a file named test.tex
    nano test.tex
    
    # 2. Add the following content to the file:
    \documentclass[a4paper,12pt]{article}
    
    \begin{document}
    Hello world from \LaTeX.
    \end{document}
    
    # 3. Compile the document to PDF
    pdflatex test.tex
  5. Install LaTeX on Linux

    TeX Live is the standard distribution for Linux. On Debian or Red Hat derived systems, it can be installed via the terminal. For editing, users can use standard editors like Vim or Emacs, or LaTeX-specific editors such as Texmaker, TeXstudio, or Gummi.
  6. Create a basic LaTeX document structure

    All LaTeX documents follow a standard structure consisting of a Document Class, an optional Preamble, and the Document Contents. The document body must be enclosed between \begin{document} and \end{document}.
    \documentclass{article}
    
    \begin{document}
    Hello, world
    \end{document}
  7. Install LaTeX on macOS

    The standard installation for macOS is MacTeX. MacTeX is a bundle that includes the LaTeX distribution, the TeXShop editor, and additional utilities in a single installer.
  8. Use LaTeX online via Overleaf

    Overleaf is a cloud-based LaTeX service that removes the need for local installation. It offers a free tier, while collaborative features are reserved for the paid service.
  9. Configure the LaTeX preamble

    The preamble is the section of the document before \begin{document}. It is used for global configuration, such as loading external packages with \usepackage{} or defining custom macros/commands with \newcommand{}.
    % Load the amsmath package for advanced math typesetting
    \usepackage{amsmath}
    
    % Define a new command \foo that outputs the text 'bar'
    \newcommand{\foo}{bar}
  10. Write basic mathematical functions in LaTeX

    Use standard mathematical notation within dollar signs for inline math. Common patterns include fractions using \frac{num}{den}, square roots using \sqrt{}, subscripts with _, and superscripts with ^.
    $a = b + c − d$
    $\sqrt{\frac{\pi}{2}}$
    $y = a x_1^2 + b x_2 + c$
  11. Use mathematical symbols and operators in LaTeX

    Use the following commands for common mathematical symbols, including logic, set theory, and calculus operators.
    % General Symbols
    \partial (∂), \infty (∞), \nabla (∇), \varnothing (∅), \angle (∠), \measuredangle (∡), \surd (√), \forall (∀), \exists (∃), \nexists (∄)
    
    % Relational Symbols
    \hookrightarrow (↪), \Rightarrow (⇒), \rightarrow (→), \Leftrightarrow (⇔), \nrightarrow (↛), \mapsto (↦), \geq (≥), \leq (≤), \equiv (≡), \sim (∼), \gg (≫), \ll (≪), \subset (⊂), \subseteq (⊆), \in (∈), \notin (∉), \mid (∣), \propto (∝), \perp (⊥), \parallel (∥), \vartriangle (△)
    
    % Binary Operators
    \wedge (∧), \vee (∨), \neg or \not (¬)
    
    % Cumulative Operators
    \int (∫), \iint (∬), \iiint (∭), \sum (∑), \prod (∏), \bigcap (⋂), \bigcup (⋃)
  12. Insert Greek letters in LaTeX

    LaTeX provides commands for both uppercase and lowercase Greek letters. Most are accessed by prefixing the letter name with a backslash.
    % Capital
    \Gamma, \Delta, \Lambda, \Phi, \Pi, \Psi, \Sigma, \Theta, \Upsilon, \Xi, \Omega
    
    % Lowercase
    \alpha, \beta, \gamma, \delta, \epsilon, \zeta, \eta, \theta, \iota, \kappa, \lambda, \mu, \nu, \xi, \pi, \rho, \sigma, \tau, \upsilon, \phi, \chi, \psi, \omega
    
    % Variants/Other
    \digamma, \varepsilon, \varkappa, \varphi, \varpi, \varrho, \varsigma, \vartheta, \eth, \hbar