0% found this document useful (0 votes)
999 views118 pages

LATEX Expert

This document provides instructions on how to become proficient in LaTeX. It begins with introductory information on LaTeX and TEX and how to install LaTeX. It then covers creating a basic LaTeX document including commands, packages, and document structure. Subsequent sections discuss formatting text, international language support, page layout, mathematics typesetting, and advanced LaTeX topics. The goal is to equip readers with the knowledge to expertly use LaTeX for technical writing and publishing.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
999 views118 pages

LATEX Expert

This document provides instructions on how to become proficient in LaTeX. It begins with introductory information on LaTeX and TEX and how to install LaTeX. It then covers creating a basic LaTeX document including commands, packages, and document structure. Subsequent sections discuss formatting text, international language support, page layout, mathematics typesetting, and advanced LaTeX topics. The goal is to equip readers with the knowledge to expertly use LaTeX for technical writing and publishing.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 118

How to Become a LATEXpert

Prabhav Kumar

December 23, 2021


Contents

1 A Very Brief Introduction 7

2 LATEX 101 8
2.1 TEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 LATEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.1 The Light-Bulb Analogy . . . . . . . . . . . . . . . . . . . . 8
2.2.2 Not a Word Processor . . . . . . . . . . . . . . . . . . . . . 9
2.3 Installing LATEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3 Creating your First LATEX Document 10


3.1 Before you Start: Typesetting & Troubleshooting . . . . . . . . . . . 10
3.2 \documentclass . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3 The Preamble & The Body . . . . . . . . . . . . . . . . . . . . . . 11
3.3.1 \usepackage . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3.2 \title, \author, \date, \maketitle . . . . . . . . . . . 12
3.4 The Building Blocks of LATEX: \, [ ], { }, ␣ . . . . . . . . . . . . . 12
3.4.1 Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.4.2 Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.4.3 Environments . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.4.4 Spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.4.5 Special Characters . . . . . . . . . . . . . . . . . . . . . . . 13
3.5 Basic Organization (Section) . . . . . . . . . . . . . . . . . . . . . 14
3.5.1 Sectioning Commands (Subsection) . . . . . . . . . . . . . . 14
3.5.2 Labelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.5.3 Footnotes . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.5.4 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

4 All About Text 17


4.1 Line Breaking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

1
CONTENTS

4.2 Page Breaking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17


4.3 Keeping Words Together . . . . . . . . . . . . . . . . . . . . . . . 17
4.4 Punctuation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.4.1 Apostrophes, Colons, Commas, Periods, and Semi-Colons . . 18
4.4.2 Dashes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.4.3 Ellipsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.4.4 Quotation Marks . . . . . . . . . . . . . . . . . . . . . . . 18
4.4.5 Quotations . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.5 More Special Characters . . . . . . . . . . . . . . . . . . . . . . . . 19
4.6 Aligning Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.7 Coloring Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.8 Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.8.1 Font Sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.8.2 Font Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.8.3 Font Families . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.9 More Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.9.1 Using Other Fonts Installed on your PC . . . . . . . . . . . 22
4.9.2 Using The LATEX Font Catalogue . . . . . . . . . . . . . . . 23

5 International Language Support 24


5.1 Using polyglossia . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.1.1 Languages Requiring Font Definitions . . . . . . . . . . . . . 24
5.1.2 Some Other Languages . . . . . . . . . . . . . . . . . . . . 27
5.2 Languages Requiring Other Packages . . . . . . . . . . . . . . . . . 28

6 Page Layout 29
6.1 Line Spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.2 Paragraphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
6.2.1 Paragraph Indentation . . . . . . . . . . . . . . . . . . . . . 30
6.2.2 Paragraph Spacing . . . . . . . . . . . . . . . . . . . . . . . 30
6.2.3 Paragraph Shape . . . . . . . . . . . . . . . . . . . . . . . 30
6.3 Page Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.3.1 Headers & Footers . . . . . . . . . . . . . . . . . . . . . . 31
6.3.2 Page Numbers . . . . . . . . . . . . . . . . . . . . . . . . . 32
6.4 Page Margins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

7 Mathematics 34
7.1 AMS-LATEX packages . . . . . . . . . . . . . . . . . . . . . . . . . 34
7.2 Math Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

2
CONTENTS

7.2.1 Inline (Text) . . . . . . . . . . . . . . . . . . . . . . . . . . 34


7.2.2 Display (unnumbered) . . . . . . . . . . . . . . . . . . . . . 35
7.2.3 Display (numbered) . . . . . . . . . . . . . . . . . . . . . . 36
7.2.4 Math Mode Fonts . . . . . . . . . . . . . . . . . . . . . . . 36
7.2.5 Math Mode Spacing . . . . . . . . . . . . . . . . . . . . . . 36
7.3 Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
7.3.1 Labelling Equations . . . . . . . . . . . . . . . . . . . . . . 37
7.3.2 Long Equations . . . . . . . . . . . . . . . . . . . . . . . . 37
7.3.3 Gathering Equations . . . . . . . . . . . . . . . . . . . . . 38
7.3.4 Aligning Equations . . . . . . . . . . . . . . . . . . . . . . 38
7.4 Math Environments . . . . . . . . . . . . . . . . . . . . . . . . . . 40
7.4.1 Theorems, Lemmas, Corollaries, Propositions, Definitions, Re-
marks, Examples, Exercises, Asides . . . . . . . . . . . . . . 40
7.4.2 Proofs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
7.5 Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
7.5.1 Reals (R) . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
7.5.2 Complex Numbers (C) . . . . . . . . . . . . . . . . . . . . 43
7.6 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
7.6.1 Greek & Hebrew Letters . . . . . . . . . . . . . . . . . . . . 44
7.7 Math Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
7.7.1 Basic Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . 44
7.7.2 Basic Algebra . . . . . . . . . . . . . . . . . . . . . . . . . 45
7.7.3 Comparison Symbols . . . . . . . . . . . . . . . . . . . . . 46
7.7.4 Super
b scripts . . . . . . . . . . . . . . . . . . . . . . . . . . 46
7.7.5 Fences (Delimiters) . . . . . . . . . . . . . . . . . . . . . . 47
7.7.6 Dots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
7.7.7 Arrows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
7.7.8 Decorations . . . . . . . . . . . . . . . . . . . . . . . . . . 50
7.7.9 Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . 50
7.8 Set Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
7.8.1 Number Sets . . . . . . . . . . . . . . . . . . . . . . . . . . 51
7.8.2 Set Notation . . . . . . . . . . . . . . . . . . . . . . . . . . 52
7.8.3 braket package . . . . . . . . . . . . . . . . . . . . . . . . 52
7.9 Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
7.10 Algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
7.10.1 Infinity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
7.10.2 Intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
7.10.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
7.11 Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

3
CONTENTS

7.11.1 Geometry Notation . . . . . . . . . . . . . . . . . . . . . . 55


7.11.2 Trigonometry & Hyperbolic Functions . . . . . . . . . . . . 56
7.11.3 Sums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
7.11.4 Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
7.12 Calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
7.12.1 Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
7.12.2 Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
7.12.3 Multivariable Calculus . . . . . . . . . . . . . . . . . . . . . 61
7.13 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
7.13.1 Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
7.13.2 Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
7.13.3 Infimum & Supremum . . . . . . . . . . . . . . . . . . . . . 62
7.13.4 Big O Notation . . . . . . . . . . . . . . . . . . . . . . . . 63
7.14 Abstract Algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
7.14.1 Equivalence Classes & Relations . . . . . . . . . . . . . . . 63
7.14.2 Group Theory . . . . . . . . . . . . . . . . . . . . . . . . . 64
7.14.3 Field Theory . . . . . . . . . . . . . . . . . . . . . . . . . . 64
7.15 Discrete Mathematics . . . . . . . . . . . . . . . . . . . . . . . . . 64
7.15.1 Number Theory . . . . . . . . . . . . . . . . . . . . . . . . 64
7.15.2 Continued Fractions . . . . . . . . . . . . . . . . . . . . . . 64
7.15.3 Combinatorics . . . . . . . . . . . . . . . . . . . . . . . . . 65
7.16 Stochastics (Probability & Statistics) . . . . . . . . . . . . . . . . 65
7.16.1 Probability . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
7.16.2 Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
7.17 Linear Algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
7.17.1 Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
7.17.2 Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
7.17.3 Determinants . . . . . . . . . . . . . . . . . . . . . . . . . 70
7.17.4 Matrix Norm . . . . . . . . . . . . . . . . . . . . . . . . . . 71
7.17.5 Vector Calculus . . . . . . . . . . . . . . . . . . . . . . . . 71
7.17.6 Matrix Operations . . . . . . . . . . . . . . . . . . . . . . . 72
7.17.7 Vector Spaces . . . . . . . . . . . . . . . . . . . . . . . . . 72
7.18 Overriding Default Math Styles . . . . . . . . . . . . . . . . . . . . 72
7.19 Coloring Math . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
7.20 Homework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

8 Structures 74
8.1 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
8.2 Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

4
CONTENTS

8.2.1 The table environment . . . . . . . . . . . . . . . . . . . . 75


8.2.2 The tablular environment . . . . . . . . . . . . . . . . . . 77
8.3 Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

9 Navigation 82
9.1 Table of Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
9.2 List of Tables & Figures . . . . . . . . . . . . . . . . . . . . . . . . 82
9.3 Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
9.4 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
9.5 Appendix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
9.6 Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
9.7 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
9.8 Hyperlinks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

10 Drawing 86
10.1 Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
10.2 Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
10.3 Curved Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
10.4 Shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
10.5 Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
10.6 Decorating Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
10.6.1 Arrows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
10.6.2 Line Thickness . . . . . . . . . . . . . . . . . . . . . . . . . 90
10.6.3 Line Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
10.6.4 Line Color . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
10.6.5 Grid Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
10.7 Repetition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

11 Extending LATEX 93
11.1 Physics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
11.1.1 Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
11.2 Chemistry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
11.2.1 Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
11.2.2 Reactions . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
11.2.3 Drawing Chemical Formulae . . . . . . . . . . . . . . . . . . 94
11.3 Poetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
11.4 Programming Languages . . . . . . . . . . . . . . . . . . . . . . . . 96
11.4.1 verbatim environment . . . . . . . . . . . . . . . . . . . . 96
11.4.2 listings package . . . . . . . . . . . . . . . . . . . . . . 96

5
CONTENTS

11.5 PDF Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97


11.6 Emojis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
11.6.1 Using LuaLATEX . . . . . . . . . . . . . . . . . . . . . . . . 97
11.6.2 Using XƎLATEX . . . . . . . . . . . . . . . . . . . . . . . . . 97
11.6.3 Using Images . . . . . . . . . . . . . . . . . . . . . . . . . 98
11.7 Writing a CV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
11.8 Writing a Thesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
11.9 Presentations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

12 Clever Tricks 99

13 Common Errors 100

14 More Resources 101

Index 103

6
Chapter 1

A Very Brief Introduction

This guide serves as an introduction to LATEX. I have tried to make it concise and easy
to follow. I am open to criticism (hopefully constructive).

Contact me via [email protected] or LinkedIn.

Updates to this guide can be found on GitHub.

7
Chapter 2

LATEX 101

2.1 TEX
Throughout history, mathematical symbols and equations were written on materials
such as clay and paper. With the advent of technology, humans needed a way to
write math on computers, so TEX (pronounced “Tech”) was created. It is a computer
program created by Donald E. Knuth and short for τέχνη, Greek for both “art” and
“craft”.

2.2 LATEX
LATEX (pronounced “Lah-Tech”) is built on top of TEX and is much more user-friendly.
It is created by Leslie Lamport. It is useful to think of TEX as a low-level language
and LATEX as a higher-level language.

2.2.1 The Light-Bulb Analogy


Understanding the difference between TEX and LATEX can be quite tricky, so a simple
light-bulb analogy can be used to explain the difference:

TEX and LATEX can be thought of an electrical circuit and a switch, respectively.
Both provide a similar function (lighting up a bulb), but it is much more convenient
for the user to deal with the switch than the circuit.

8
LATEX 101

2.2.2 Not a Word Processor


LATEX is not a word processor. When using Microsoft Word, the final document
automatically updates while typing on a .docx file. However, with LATEX, the final doc-
ument, which is usually a separate PDF file, only updates after typing and typesetting
or compiling a .tex file.

2.3 Installing LATEX


There are several ways to install LATEX, but this is what I did:

1. Download MikTeX (a TEX distribution) .

2. Download Texmaker (a cross-platform LATEX editor).

3. Watch this video for a guided walkthrough.

9
Chapter 3

Creating your First LATEX Document

3.1 Before you Start: Typesetting & Troubleshoot-


ing
To compile a LATEX file, the user must typeset it on Texmaker using the “Quick Build”
button (other editors have a “Typeset” or “Compile” button). If a PDF file is out-
putted, the compilation was successful. If not, then do the following:

1. Click on the ”abort” button.

2. Read the console output - it will include the line number and the command that
caused the error.

3. Fix the error.

4. Typeset the file again.

As an example, after opening a new document, type the following code:


\documentclass[10pt]{article}

\begin{document} Hello World!


Hello World!
\end{document}

As shown, the output should be Hello Word!.

10
Creating your First LATEX Document

3.2 \documentclass
\documentclass is the command that must appear at the start of a LATEX document.
The document class is specified within { }. Frequently used classes include:
• \article - for shorter documents (notes).
• \beamer - for presentation slides.
• \book - self-explanatory.
• \proc - for conference proceedings.
• \report - for longer documents (PhD thesis).

Document class options are specified within [ ]. Frequently used options include:
• xpt - main font size (default is 10pt).
• a4paper, a5paper, letterpaper, legalpaper - paper size.

3.3 The Preamble & The Body


Anything before \begin{document} is called the preamble and applies to the whole
document.

The area between \begin{document} and \end{document} is called the body. This
is where the content goes.

Text after \end{document} will be ignored.

3.3.1 \usepackage
Sometimes LATEX cannot solve a problem, so external packages are added in the pream-
ble using \usepackage. For example, dirtytalk allows users to deal with quotation
marks.
\documentclass[10pt]{article}
\usepackage{dirtytalk}

\begin{document}
“Stay positive & test negative!”
\say{Stay positive \& test negative!}
\end{document}

11
Creating your First LATEX Document

You can find package documentation by googling “CTAN *insert package name*”.

3.3.2 \title, \author, \date, \maketitle


When creating a title page, these 4 commands are used. For example, if Einstein (hy-
pothetically) wrote a LATEX document, he would type \title{General Relativity},
\author{Albert Einstein}, \date{May 7, 1915} and \maketitle in the body.

3.4 The Building Blocks of LATEX: \, [ ], { }, ␣


The backslash is central to LATEX because each LATEX command starts with \.

3.4.1 Commands
A command is a special expression that instructs LATEX to do a specific task. It is case-
sensitive, i.e. \large and \Large are different commands. Commands are sometimes
followed by declarations.

3.4.2 Declarations
A declaration is either optional [ ] or required { }. For example, in
\documentclass[10pt]{article}:

• \documentclass is the command.

• [10pt] is an optional declaration (can be omitted).

• {article} is a required declaration (something is needed within { }).

Sometimes { } provides spacing after a command:


\LaTeX ample vs. \LaTeX{} ample LATEXample vs. LATEX ample

3.4.3 Environments
An environment performs a specific action on a block of LATEX code. It must have
matching \begin and \end declarations. For example:

12
Creating your First LATEX Document

\begin{center}
Core-an is the official language at Core-an is the official language at the
the center of Earth. \\ center of Earth.
P.S. This is how you center text. P.S. This is how you center text.
\end{center}

3.4.4 Spaces
Spaces and tabs are treated as 1 space (␣). Any combination of consecutive spaces
and tabs are also treated as 1 space. An empty line marks the end of a paragraph.
Consecutive empty lines are treated as 1 empty line. For example:
1 space = 1 tab.
1 space = consecutive spaces. 1 space = 1 tab. 1 space = consecutive
spaces.
1 empty line = end of paragraph.
1 empty line = end of paragraph.
1+ empty lines = 1 empty line.
1+ empty lines = 1 empty line.

Use a tilde (~) for an unbreakable space

This is an unbreakable space. This is an unbreakable space. Really? Oh


Really? Oh Yes. \\ Yes.
This is an unbreakable space. This is an unbreakable space. Really?
Really? Oh~Yes.
Oh Yes.

3.4.5 Special Characters


Reserved Characters
The following characters (discussed elsewhere) have a special meaning in LATEX:

# $ % & { } _ ~ ^ \

In order to print them, you must escape or prefix the character with a \:
\# \$ \% \& \{ \} \_ \~{} \^{}
\textbackslash
#$%&{}_~^\

\\ means a newline so \textbackslash is used.

13
Creating your First LATEX Document

Symbols
There are over 18,000 symbols1 in LATEX. They are printed using specific commands.
For example:

$\div$ \\ ÷
\copyright \\ ©
$\clubsuit$ ♣

Sometimes the symbol must be placed between $ signs (refer to 7.2 on page 34).

Helpful Resources
1. Detexify - inputs a drawing of a symbol and outputs its LATEX command (and
the package required if needed).

2. CTAN - a comprehesive list of symbols.

3.5 Basic Organization (Section)


It is helpful to divide the LATEX document into different sections.

3.5.1 Sectioning Commands (Subsection)


Different document classes have different sectioning commands:

article class (Subsubsection)


• \section

• \subsection

• \subsubsection

• \paragraph

1
Some symbols require packages.

14
Creating your First LATEX Document

book, report class (Subsubsection)


• \part

• \chapter

• All of the article sectioning commands.

Sectioning commands automatically provide spacing (and numbering), so you do not


need to add \newline or \\ before the next sectioning command. Add a ∗ after the
sectioning command for unnumbering. (Paragraph)
\section{This will be a numbered section.}
\section*{This will not.}

3.5.2 Labelling
Section commands can be labelled with \label{labelname}. When referring to a
particular section, use \ref{labelname} (the section) or \pageref{labelname}
(page number of the section). Using an example from this guide:
\label{symbols}
% Some Code
To learn about symbols, refer to 3.4.5 on
To learn about symbols, refer to
\ref{symbols} on page page 13.
\pageref{symbols}.

3.5.3 Footnotes
\footnote prints text at the bottom of the page2 . Here is the code I used to create
the footnote:
$\ldots$ at the bottom of the
page\footnote{Footnotes are easy . . . at the bottom of the page.
with \LaTeX{}!}.

3.5.4 Comments
The % character is reserved for commenting. When used, the rest of the current line
is ignored.

2
Footnotes are easy with LATEX!

15
Creating your First LATEX Document

% This text will be ignored.


Some text % will be ignored. Some text

If multiple lines need to be commented, highlight the necessary text and use the key-
board shortcut for commenting3 .

Another way is to define a new command:


% Preamble
\newcommand{\comment}[1]{}

% Body
\comment{
You Can't See Me.

Just Like John Cena.


}

3
Keyboard shortcuts for Texmaker; Texstudio.

16
Chapter 4

All About Text

4.1 Line Breaking


As mentioned previously, \\ or \newline performs a line break. \\∗ starts a new line
without starting a new paragraph.

Text is broken here. \\* Text is broken here.


The paragraph is not broken. The paragraph is not broken.

4.2 Page Breaking


\newpage should suffice.

4.3 Keeping Words Together


\mbox keeps words together in 1 line. No line breaks are allowed in the text.

These words are not grouped, but These words are not grouped, but
\mbox{these words are}. these words are.

\fbox draws a box around the grouped words.

\fbox{These words are trapped}. These words are trapped .

17
All About Text

4.4 Punctuation
4.4.1 Apostrophes, Colons, Commas, Periods, and Semi-Colons
Simply type these punctuation marks. It is useful but not necessary to type \frenchspacing
in the preamble. This tells the document to treat spacing after commas and periods
equally.

4.4.2 Dashes
There are 4 types of dashes:

hyphen (-): Pre-Christmas vibes. \\ hyphen (-): Pre-Christmas vibes.


en-dash (--): I work from 9--5. \\ en-dash (–): I work from 9–5.
em-dash (---): Yes --- or no? \\ em-dash (—): Yes — or no?
minus sign ($-$): $-69$. minus sign (−): −69.

4.4.3 Ellipsis
As it has better spacing and line-break behavior, \ldots in between dollar signs is a
better solution than typing 3 dots.

3 dots: a b c... z \\ 3 dots: a b c... z


low dots: a b c $\ldots$ z low dots: a b c . . . z

4.4.4 Quotation Marks


The dirtytalk package is a comprehensive solution.
% Preamble
\usepackage{dirtytalk}
“I am surrounded!”
% Body
\say{I am surrounded!} \\ “Quotations can be ‘nested’ as well!”
\say{Quotations can be \say{nested}
as well!}

If you want to define the primary and secondary set of quotation marks, type the
following in the preamble:

18
All About Text

\usepackage[
left = ``,%
right = '',%
leftsub = `,%
rightsub = ',%
]{dirtytalk}

You can find a table of primary and secondary quotation marks in several languages
here.

4.4.5 Quotations
The quotation environment adds quotes to some text.

Walt Disney once said something inter-


Walt Disney once said something esting.
interesting.
\begin{quotation}
The way to get started is
The way to get started is to quit
talking and begin doing. to quit talking and begin do-
\end{quotation} ing.
It changed my life.
It changed my life.

4.5 More Special Characters


Commands for accents, diacritics, and other characters can be found on Wikibooks.
These commands may not be needed if the characters can be typed out from the
keyboard.

4.6 Aligning Text


The flushleft, center, flushright environments align text to the left, center,
and right, respectively.

19
All About Text

\begin{flushleft}
Chairman Mao
\end{flushleft}
Chairman Mao
\begin{center}
Canada Canada
\end{center}
Hitler
\begin{flushright}
Hitler
\end{flushright}

4.7 Coloring Text


Add color to the document using the xcolor package. Use \textcolor or \color
to color text.
% Preamble
\usepackage{xcolor}

% Body
Black and yellow.
\textcolor{yellow}{Black} and
{\color{black}yellow}.

If you want to highlight text, then use \colorbox.


% Preamble
\usepackage{xcolor}
Black
% Body yellow
\colorbox{yellow}{Black} \\
\colorbox{black}{\textcolor{yellow}{yellow}}

The colors provided by xcolor can be found here. If you scroll down on the webpage,
there are instructions to define more colors and set the page color.

4.8 Fonts
4.8.1 Font Sizes
LATEX commands for font sizes:

20
All About Text

tiny

{\tiny tiny} \\ scriptsize


{\scriptsize scriptsize} \\ footnotesize
{\footnotesize footnotesize} \\ small
{\small small} \\ normalsize
{\normalsize normalsize} \\
{\large large} \\
large
{\Large Large} \\ Large
{\LARGE LARGE} \\
LARGE
{\huge huge}
huge
A more thorough tutorial on font sizes can be found at latex-tutorial.com.

4.8.2 Font Styles


Text can be type-faced in different ways. Popular commands include:
Underlined text
\underline{Underlined text} \\
\emph{Emphasized text.} \\ Emphasized text.
\textbf{Bold text.} \\ Bold text.
\textit{Italicized text.} \\ Italicized text.
\textsl{Slanted text.} \\ Slanted text.
\textsc{Smallcaps text.} \\
Smallcaps text.
\uppercase{upper.} \\
\lowercase{LOWER.} UPPER.
lower.

\underline does not break properly to the next line, so use the ulem pacakge to
resolve the issue. This package also allows for underline styling and strikethroughs.

Note that although \emph, \textit, and \textsl have the same effect here, they
render different effects with other fonts.

4.8.3 Font Families


The default font on a LATEX document is Computer Modern, which is part of the serif
family. The other 2 popular font families are sans serif and monospace.

Changing the Global Font Family


To change the default font family for the whole document to monospace, type the
following in the preamble:

21
All About Text

\renewcommand{\familydefault}{\ttdefault}

Replace \ttdefault with \sfdefault for sans serif. As serif is the default font
family for a LATEX document, nothing needs to be done to use it. However, if needed,
use \rmdefault.

Temporarily Changing the Font Family


To use these font families temporarily, use the following commands:

\textrm{Serif text.} \\ Serif text.


\textsf{Sans Serif text.} \\ Sans Serif text.
\texttt{Monospace text.} Monospace text.

4.9 More Fonts


To use other fonts, employ external packages.

4.9.1 Using Other Fonts Installed on your PC


Using the font globally
To use fonts installed on a local PC (e.g.Times New Roman), type the following in
the preamble:
\usepackage{fontspec}
\setmainfont{Times New Roman}

Then, you must typeset the document using the XƎLATEX or LuaLATEX compiler. The
section between 2:52 to 3:16 of this video might help with the compilation.

Using the font temporarily


If you only need to use Times New Roman for some text, type:
\usepackage{fontspec}
\newfontfamily{\tnrm}{Times New
Roman} Times New Roman Text.
{\tnrm Times New Roman Text.}

22
All About Text

\tnrm was my choice. It can be replaced with a command of your choice (just make
sure it isn’t already defined).

The user can download fonts for their PC at dafont.com.

4.9.2 Using The LATEX Font Catalogue


More fonts and their instructions-for-use can be found on The LATEX Font Catalogue1 .
For example, if you want to use Bookman2 as the global font, type the following in
the preamble:
\usepackage{bookman}

If you want to use Bookman only for some text:


Normal Text. \\
{\fontfamily{pbk}\selectfont Bookman
Normal Text.
Text.} Bookman Text.

Notice the code pbk. You need to know this code to access the font. The codes for
the most common fonts can be found at Stack Exchange.

Sometimes the font does not appear. This is because it needs to be installed by
LATEX. For more information, read this guide.

1
If you are writing mathematical expressions, use fonts with math support.
2
Popular fonts can be found here.

23
Chapter 5

International Language Support

5.1 Using polyglossia


5.1.1 Languages Requiring Font Definitions
Arabic
Use the polyglossia package with the XƎLATEX compiler as follows:
% Preamble
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{arabic}
\newfontfamily{\arabicfont}[Script=Arabic]{Scheherazade}

\arabicfont is used to type Arabic: ‫النص هذا عكس يمكن‬

You must download the Scheherazade font on your local PC. Other fonts that support
Arabic can be found here.

Bengali
Use the polyglossia package with the XƎLATEX compiler as follows:
% Preamble
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{bengali}
\newfontfamily{\bengalifont}[Script=Bengali]{Kalpurush}

24
International Language Support

\bengalifont is used to type Bengali: আিম বাংলা বিল না।

You must download the Kalpurush font on your local PC. Other fonts that support
Bengali can be found here.

Greek
Use the polyglossia package with the XƎLATEX compiler as follows:
% Preamble
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{greek}
\newfontfamily{\greekfont}[Script=Greek]{Linux Libertine}

\greekfont is used to type Greek: Θέλω να πάω στη Μύκονο.

You must download the Linux Libertine font on your local PC. Some other Greek
fonts can be found here.

Hebrew
Use the polyglossia package with the XƎLATEX compiler as follows:
% Preamble %
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{hebrew}
\newfontfamily{\hebrewfont}[Script=Hebrew]{IBM Plex Sans Hebrew}

\hebrewfont is used to type Hebrew: ‫ אנשים אנחנו‬.‫אינטליגנטים‬

You must download the IBM Plex Sans Hebrew font on your local PC. Other fonts
that support Hebrew can be found here.

Hindi
Use the polyglossia package with the XƎLATEX compiler as follows:
% Preamble
\usepackage{polyglossia}
\setdefaultlanguage{english}

25
International Language Support

\setotherlanguage{hindi}
\newfontfamily{\hindifont}[Script=Devanagari]{Lohit Devanagari}

\hindifont is used to type Hindi: िवराट कोहली भगवान हैं।

You must download the Lohit Devanagari font on your local PC. Other fonts that
support Hindi can be found here.

Thai
Use the polyglossia package with the XƎLATEX compiler as follows:
% Preamble
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{thai}
\newfontfamily\thaifont[Script=Thai]{Prompt}

\thaifont is used to type Thai: กุมารเป็นคนไทย

You must download the Prompt font on your local PC. Other fonts that support
Thai can be found here.

Russian
Use the polyglossia package with the XƎLATEX compiler as follows:
% Preamble
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{russian}
\newfontfamily\russianfont[Script=Cyrillic]{Linux Libertine}

\russianfont is used to type Russian: Путин любит лошадей!

You must download the Linux Libertine font on your local PC. Some other Russian
fonts can be found here.

If you set the default language as Russian, you can type it without \russianfont.
However, you still need to define \russianfont using \newfontfamily in the
preamble. The same applies to the other languages in 5.1.1.

26
International Language Support

5.1.2 Some Other Languages


Spanish
Use the polyglossia package with the XƎLATEX compiler as follows:
% Preamble
\usepackage{polyglossia}
\setdefaultlanguage{spanish}
¡December 23, 2021 es mi cumpleaños!
% Body
¡\today{} es mi cumpleaños!

If you only need to use Spanish temporarily:


% Preamble
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{spanish} I speak Spanish.
23 de diciembre de 2021 es mi cumplea-
% Body ños.
I speak Spanish. \\
\textspanish{\today{} es mi
cumpleaños.}

French
If you also want to add French, make the following changes:
% Preamble
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguages{spanish, french} I speak Spanish.
23 de diciembre de 2021 es mi cumplea-
% Body ños.
I speak Spanish. \\ Je parle aussi français.
\textspanish{\today{} es mi
cumpleaños.} \\
\textfrench{Je parle aussi français.}

German
You can simply replace french with german in the code above.

Read the polyglossia documentation for a full list of supported languages.

27
International Language Support

5.2 Languages Requiring Other Packages


Chinese
The most comprehensive solution is to use the ctex package.
% Preamble
\usepackage[UTF8]{ctex}
你好
% Body
你好

It is recommended to use the XƎLATEX compiler.

Japanese
The xeCJK package1 takes care of Japanese.
% Preamble
\usepackage{xeCJK}
日本の首都は東京です
% Body
日本の首都は東京です

You must use the XƎLATEX compiler.

Helpful Resources
1. Language Fonts - a list of fonts that support different languages.

2. Wikibooks - a more comprehensive guide for typesetting different languages.

3. Overleaf - further reading.

1
This package can also be used to typeset Chinese.

28
Chapter 6

Page Layout

6.1 Line Spacing


\linespread alters the space between lines. Type it in the preamble.
% Default Line Spacing
\linespread{1}

% One and a Half Line Spacing


\linespread{1.3}

% Double Line Spacing


\linespread{1.6}

\setlength{\baselineskip}{1.6 \baselineskip} temporarily alters the line spac-


ing to double spacing:
{ A double spaced paragraph is a paragraph
\setlength{\baselineskip}{1.6
\baselineskip} with twice the space between lines. Wow,
A double spaced paragraph is a
paragraph with twice the space that’s meta!
between lines. Wow, that's meta!
\par} $\\$

This is a normal paragraph with This is a normal paragraph with normal


normal spacing. Nothing special. spacing. Nothing special.

\par ends a paragraph and is necessary1 .


1
You can also use an empty line.

29
Page Layout

6.2 Paragraphs
6.2.1 Paragraph Indentation
Temporary Indentation
Sometimes paragraphs are indented. \noindent cancels the indent. If you want to
indent a non-indented paragraph, use \indent.

Permanent Indentation
\setlength{\parindent}{4em} globally sets paragraph indentation to 4em. If you
don’t want any indentation in the document, use \setlength{\parindent}{0em}.
Place the commands in the preamble, preferably before \tableofcontents.

6.2.2 Paragraph Spacing


\setlength{\parskip}{1em} globally sets spacing between 2 paragraphs to 1em.

More information of units such as em can be found here.

6.2.3 Paragraph Shape


Load the shapepar package. You can write paragraphs with cool shapes.
This para- graph
is shaped as a heart be-
\heartpar{This paragraph is shaped as a cause LATEX is powerful. There
heart because \LaTeX{} is powerful.
There are many other shapes
are many other shapes available.
available. Just go through the Just go through the documenta-
documentation for tion for shapepar. There are cir-
\texttt{shapepar}. There are cles, squares, rectangles, and
circles, squares, rectangles, and shapes you can’t imagine.
shapes you can't imagine. This is
kind of cringe but oh well.} This is kind of cringe
but oh well.

For more information, read the shapepar documentation. For irregular shapes, read
this post.

More information on paragraph formatting can be found on Overleaf.

30
Page Layout

6.3 Page Elements


All documents classes except book (refer to 3.2 on page 11) are one-sided. In one-
sided documents, each page is identical. In two-sided documents, odd and even pages
have different margins. To create a two-sided document, use the twoside option.
% Books are two-sided documents
\documentclass{book}

% Use the two-sided option for other document classes


\documentclass[twoside]{article}

More information on one/two-sided documents can be found here.

6.3.1 Headers & Footers


Basic Customization
Use \pagestyles in the preamble.
% No Header, No Footer
\pagestyles{empty}

% No Footer, Header contains page number and some information


\pagestyles{headings}

% No Footer, Header for one-sided document


\pagestyles{myheadings}
\markright{Name \hfill Date \hfill} % Name is placed on the left, Date is
placed in the center, page number on the right

% No Footer, Header for two-sided document


\pagestyles{myheadings}
\markboth{Hi}{Hello} % 'Hi' on even pages, 'Hello' on odd pages

Advanced Customization
Load the fancyhdr package and do the following:
% Preamble
\usepackage{fancyhdr}
\pagestyle{fancy} % Sets page style to fancy
\fancyhf{} % Clears the Header and Footer for customization

For a one-sided documents, use the following commands:

31
Page Layout

% Preamble
\rhead{Right Side of Header}
\chead{Header Center}
\lchead{Left Side of Header}
\rfoot{Right Side of Footer}
\cfoot{Footer Center}
\lfoot{Left Side of Footer}

For two-sided documents:


% Preamble
\fancyhead[LE,RO]{Outer} % LE = Left Even; RO = Right Odd
\fancyhead[RE,LO]{Inner} % RE = Right Even; LO = Left Odd
\fancyfoot[CE,CO]{Center} % CE = Center Even; CO = Center Odd
\fancyfoot[LE,RO]{\thepage} % Prints the page number on the Footer center on
even and odd pages

More commands include:

Description Command
Page Number \thepage
Chapter Number \thechapter
Section Number \thesection
Chapter Name \chaptername
Current Chapter / Section Name & Number \leftmark
Current Section / Subsection Name & Number \rightmark

fancyhdr provides decorative lines for the header and footer. If you need to customize
the lines, do the following:
% Preamble
\renewcommand{\headrulewidth}{2pt} % Header Line
\renewcommand{\footrulewidth}{2pt} % Footer Line

6.3.2 Page Numbers


Use \pagenumbering.
% Preamble
\pagenumbering{arabic}

The page numbers will be Arabic numerals. If you need lowercase (uppercase) Roman
numerals, use roman (Roman) instead.

32
Page Layout

\setcounter{page} allows you to control the page counter.


\chapter{First Chapter}
\setcounter{page}{3} % 3 is assigned to the current page

More information on page numbering can be found here.

6.4 Page Margins


The geometry package allows you to change the margins.
% Preamble
\usepackage[margin=2in]{geometrty}

I have also used it to create help sheets.


% Preamble
\documentclass{article}
\usepackage[margin=1cm, landscape]{geometry}
\usepackage{multicol}

% Body
\begin{multicols}{3}
\section{Section 1}

\section{Section 2}

\section{Section 3}

\section{Section 4}
\end{multicols}

Helpful Resources
Frankly, I don’t have much experience with page margins, so I direct you to the
following resources.
1. CTAN - geometry package documentation.
2. Overleaf - an introduction to page size and margins.
3. Wikibooks - an advanced guide for page layout (page margins, page size, page
background).

33
Chapter 7

Mathematics

This is where the heart of LATEX lies.

7.1 AMS-LATEX packages


It is strongly recommended to load the packages in the AMS-LATEX bundle when
typesetting math. Copy this into the document’s preamble:
\usepackage{mathtools, amssymb, amsthm}

7.2 Math Mode


Math mode must be used when writing math. There are 2 modes: inline and display.

7.2.1 Inline (Text)


Inserts math in between text. Requires:

• an opening $ and closing $;

• or an opening \(and closing \);

• or a math environment.

34
Mathematics

$9+10=21$ is false. \\
9 + 10 = 21 is false.
\(3^2 + 4^2 = 5^2\) is true. \\
32 + 42 = 52 is true.
\begin{math}
\sin{x}=\pi \text{ has no solutions.}
\end{math}
sin x = π has no solutions.

\text inserts text in math mode. If not, this happens:


\begin{math}
\sin{x} = \pi has no solutions. sin x = πhasnosolutions.
\end{math}

7.2.2 Display (unnumbered)


Displays math in its own line and is unnumbered. Requires:

• an opening $$ and closing $$;

• or an opening \[ and closing \];

• or an equation* environment;

• or a displaymath environment.

The Pythagorean theorem:


The Pythagorean theorem:
$$a^2+b^2=c^2$$
a2 + b 2 = c 2
This is equivalent to:
\[a^2+b^2=c^2\] This is equivalent to:

Environments also work: a2 + b 2 = c 2


\begin{equation*}
a^2+b^2=c^2 Environments also work:
\end{equation*}
a2 + b 2 = c 2
Another environment:
\begin{displaymath}
a^2+b^2=c^2 Another environment:
\end{displaymath}
a2 + b 2 = c 2

35
Mathematics

7.2.3 Display (numbered)


Displays math in its own line and is automatically labelled. Requires:

• an equation environment.

A legend once said that


A legend once said that
\begin{equation}
9+10=21
\end{equation} 9 + 10 = 21 (7.1)

7.2.4 Math Mode Fonts


The text and math fonts in a LATEX document are independent. The default math
font is Computer Modern. Math fonts compatible with LATEX are rare. Refer to the
footnote in 4.9.2 for more information.

If you need to use math fonts temporarily, LATEX provides a few pre-defined com-
mands:

Description Command Output


Default ABCabc123 ABCabc123
Roman \mathrm{ABCabc123} ABCabc123
Bold \mathbf{ABCabc123} ABCabc123
Italics \mathit{ABCabc123} ABCabc123
Typewriter \mathtt{ABCabc123} ABCabc123
Fraktur \mathfrak{ABCabc123} ABCabc123
Blackboard Bold \mathbb{ABC} ABC
Caligraphic \mathcal{ABC} ABC

Note that \mathbb and \mathcal only work with capital letters.

7.2.5 Math Mode Spacing


LATEX automatically spaces content in math mode. It ignores whitespace characters.
If you want custom spacing, refer to this table. Here are a few examples:

36
Mathematics

12
$1 2 $ \\ 12
$1 \! 2 $ \\
12
$1 \, 2 $ \\
$1 \: 2 $ \\ 12
$1 \; 2 $ \\ 12
$1 \ 2 $ \\ 12
$1 \quad 2 $ \\ 1 2
$1 \qquad 2 $ \\
$1 \qquad \quad 2 $ \\
1 2
$1 \qquad \qquad 2 $ \\ 1 2
$1 \hspace*{4cm} 2 $ 1 2
1 2

\phantom acts like a whitespace character.


${}^{14}_{6}\mathrm{C}$ \\ 14
${}^{14}_{\phantom{1}6}\mathrm{C}$ 6 C
14
% 1 space reserved 6C

7.3 Equations
7.3.1 Labelling Equations
LATEX automatically labels equations. Use \tag for a custom label.
A legend once said that
A legend once said that
\begin{equation}
9+10=21 \tag{genius}
\end{equation} 9 + 10 = 21 (genius)

\label and \eqref allow you to refer to an equation.


\begin{equation}
1+1=2 \label{babymath} 1+1=2 (7.2)
\end{equation}
This refers to \eqref{babymath}. This refers to (7.2).

7.3.2 Long Equations


Sometimes equations are too long.

A long sum:
A long sum:
$$91=1+2+3+4+5+6+7+8+9+10+11+12+13$$
91 = 1+2+3+4+5+6+7+8+9+10+11+12+13

37
Mathematics

The multline environment resolves this.

A long sum: A long sum:


\begin{multline}
91=1+2+3+4+5 \\ 91 = 1 + 2 + 3 + 4 + 5
+6+7+8+9+10 \\
+11+12+13 + 6 + 7 + 8 + 9 + 10
\end{multline} + 11 + 12 + 13 (7.3)

multline* removes the equation label.

7.3.3 Gathering Equations


The multline solution looks messy, so another solution is to gather equations. The
gather environment brings equations together, centered.
Centered equations: Centered equations:
\begin{gather}
1+1=2 \\ 1+1=2 (7.4)
xyz+x+y+z=w
\end{gather} xyz + x + y + z = w (7.5)

Centered (unnumbered) equations: Centered (unnumbered) equations:


\begin{gather*}
1+1=2 \\ 1+1=2
xyz+x+y+z=w
\end{gather*} xyz + x + y + z = w

The gathered environment (within display mode) assigns 1 label to the gathered
equations.
\begin{equation}
\begin{gathered}
1+1=2 \\ 1+1=2
xyz+x+y+z=w (7.6)
xyz + x + y + z = w
\end{gathered}
\end{equation}

7.3.4 Aligning Equations


Another solution to long equations is to align equations on the relation symbol (=,
<, etc.) using the align environment.

38
Mathematics

Aligned equations: Aligned equations:


\begin{align}
1+1=2 \\ 1+1=2 (7.7)
xyz+x+y+z=w
\end{align} xyz + x + y + z = w (7.8)

Aligned (unnumbered) simplification: Aligned (unnumbered) simplification:


\begin{align*}
1+2+3+4&=1+2+7 \\ 1+2+3+4=1+2+7
&=1+9 \\
&=10 =1+9
\end{align*} = 10

Add text using && and \text.

Simplifying $1+2+3+4$: Simplifying 1 + 2 + 3 + 4:


\begin{align*}
1+2+3+4&=1+2+7 \\ 1+2+3+4=1+2+7
&=1+9 && \text{(as $2+7=9$)} \\
&= 10
=1+9 (as 2 + 7 = 9)
\end{align*} = 10

Some more equations:

Aligned (unnumbered) equations: Aligned (unnumbered) equations:


\begin{align*}
x&=y & y&=z \\ x=y y=z
z&=x & y&=x \\
z&=y & x&=z z=x y=x
\end{align*} z=y x=z

The aligned environment (within display mode) assigns 1 label to the aligned
equations.
\begin{equation}
\begin{aligned}
1+1=2 \\ 1+1=2
xyz+x+y+z=w (7.9)
xyz + x + y + z = w
\end{aligned}
\end{equation}

You can also use split instead of aligned. Read more about the differences here.

39
Mathematics

7.4 Math Environments


7.4.1 Theorems, Lemmas, Corollaries, Propositions, Definitions,
Remarks, Examples, Exercises, Asides
These environments may be helpful when writing math. Define them in the preamble.
\newtheoremstyle{dotless}{}{}{}{}{\bfseries}{}{12pt}{}
\theoremstyle{dotless}
\newtheorem{thm}{Theorem}[section] % Theorem
\newtheorem*{thm*}{Theorem} % Theorem (unnumbered)
\newtheorem{lem}[thm]{Lemma} % Lemma
\newtheorem*{lem*}{Lemma} % Lemma (unnumbered)
\newtheorem{cor}[thm]{Corollary} % Corollary
\newtheorem*{cor*}{Corollary} % Corollary (unnumbered)
\newtheorem{prop}[thm]{Proposition} % Proposition
\newtheorem*{prop*}{Proposition} % Proposition (unnumbered)
\newtheorem{defn}[thm]{Definition} % Definition
\newtheorem*{defn*}{Definition} % Definition (unnumbered)
\newtheorem{rem}[thm]{Remark} % Remark
\newtheorem*{rem*}{Remark} % Remark (unnumbered)
\newtheorem{exa}[thm]{Example} % Example
\newtheorem*{exa*}{Example} % Example (unnumbered)
\newtheorem{exe}[thm]{Exercise} % Exercise
\newtheorem*{exe*}{Exercise} % Exercise (unnumbered)
\newtheorem{aside}[thm]{Aside} % Aside
\newtheorem*{aside*}{Aside} % Aside (unnumbered)

Implementing:
% Theorem
\begin{thm}
This is a theorem.
\end{thm}

% Example
Theorem 7.4.1 This is a theorem.
\begin{exa}
$1+1=2$ Example 7.4.2 1 + 1 = 2
\end{exa}
Exercise Does 2 + 2 = 4?
% Exercise (unnumbered)
\begin{exe*}
Does $2+2=4$?
\end{exe*}

40
Mathematics

7.4.2 Proofs
The proof environment is provided by the mathtools package.
\begin{proof}
$1+1=2 \implies 1=1$ Proof. 1 + 1 = 2 =⇒ 1 = 1
\end{proof}

Changing the QED symbol:


% Preamble
\renewcommand\qedsymbol{$\blacksquare$}

% Body Proof. 1 + 1 = 2 =⇒ 1 = 1 ■
\begin{proof}
$1+1=2 \implies 1=1$
\end{proof}

Changing the QED symbol (again):


% Preamble
\renewcommand\qedsymbol{QED}

% Body Proof. 1 + 1 = 2 =⇒ 1 = 1 QED


\begin{proof}
$1+1=2 \implies 1 = 1$
\end{proof}

You can also change the style of the proof environment.


% Preamble
\renewenvironment{proof}{{\bfseries
Proof.}}{\hfill$\square$}

% Body Proof. 1 + 1 = 2 =⇒ 1 = 1 □
\begin{proof}
$1+1=2 \implies 1 = 1$
\end{proof}

Unlike the environments in 7.3, math mode must be used in the environments men-
tioned in 7.4.1 and 7.4.2.

41
Mathematics

7.5 Numbers
7.5.1 Reals (R)
Integers (Z)
Type out the integers. The font changes in math mode.
$-1, 0, 2, 4$ \\ % math mode font −1, 0, 2, 4
-1, 0, 2, 4 % text mode font -1, 0, 2, 4

Rationals (Q)
\frac is used.
1
$\frac{1}{2}$ \\ 2
1
2
+ 12
$\frac{\frac{1}{2}+\frac{1}{2}}{1+2}$ 1+2

$$\frac{7}{10}$$ 7
10

Use \dfrac for a display mode sized fraction and \tfrac for a text mode sized
fraction.
69
$\dfrac{69}{420}$
$$\tfrac{1}{1000}$$ 420
1
1000

You can also use ^{1}/_{2} to display 1 /2 .

Irrationals(I)
A few famous irrationals:
Description Command Output
Pi \pi π
Euler’s Number e, \mathrm{e} e, e
Logarithms \log_{2}{3} log2 3
Golden Ratio \phi √φ
Unit Square Diagonal \sqrt{2} 2

The area of a unit circle is $\pi$. The area of a unit circle is π.

42
Mathematics

7.5.2 Complex Numbers (C)


Imaginary Unit: $i$, $\mathrm{i}$ Imaginary Unit: i, i

Complex number: $z=2+2i$ Complex number: z = 2 + 2i

Conjugate: $z^{*}=2-2i$ Conjugate: z ∗ = 2 − 2i

Real Part: $\Re(z)=2$ or


$\mathrm{Re}(z)=2$
Real Part: <(z) = 2 or Re(z) = 2

Imaginary Part: $\Im(z)=2$ or


$\mathrm{Im}(z)=2$
Imaginary Part: =(z) = 2 or Im(z) = 2


Absolute Value: $|z|=2\sqrt{2}$ Absolute Value: |z| = 2 2

π
Argument: $\arg(z)=\frac{\pi}{2}$ Argument: arg(z) = 2

7.6 Variables
Variables are letters in math mode.
Find x vs. Find $x$ Find x vs. Find x

% Text Mode
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
% Math Mode abcdef ghijklmnopqrstuvwxyz
$abcdefghijklmnopqrstuvwxyz$

The solution to ax2 + bx + c = 0 is


The solution to $ax^2+bx+c=0$ is
$$x=\frac{-b \pm √
\sqrt{b^2-4ac}}{2a}.$$
−b ± b2 − 4ac
x= .
2a

43
Mathematics

7.6.1 Greek & Hebrew Letters

Command Output Command Output Command Output Command Output


\alpha α \mu µ \upsilon υ \Upsilon Υ
\beta β \nu ν \xi ξ \aleph ℵ
\chi χ \omega ω \zeta ζ \beth i
\delta δ \phi φ \Delta ∆ \daleth k
\epsilon  \varphi ϕ \Gamma Γ \gimel ‫ג‬
\varepsilon ε \pi π \Lambda Λ
\eta η \psi ψ \Omega Ω
\gamma γ \rho ρ \Phi Φ
\iota ι \sigma σ \Pi Ψ
\kappa κ \tau τ \Sigma Σ
\lambda λ \theta θ \Theta Θ

The cardinality of the natural The cardinality of the natural numbers is


numbers is $\aleph_0$. ℵ0 .

More Greek symbols can be found here.

7.7 Math Symbols


In this section, I will list some basic math symbols. However, if you need to find
commands for symbols that are not included here, refer to 3.4.5 on page 13.

7.7.1 Basic Arithmetic

Description Command Output


Addition + +
Subtraction - −
Multiplication (times) \times ×
Multiplication (dot) \cdot ·
Division (sign) \div ÷
Division (slash) / /
Exponentiation a^{b} ab

$3 \times ((3^{3} \div 3 × ((33 ÷ 3) + (((3 + 3)/3) + 3 − 3 + 3 +


3)+(((3+3)/3)+3-3+3+3+3+3))=69$ 3 + 3 + 3)) = 69

44
Mathematics

7.7.2 Basic Algebra

Description Command Output


Plus-Minus \pm ±
Minus-Plus \mp ∓

Square Root \sqrt{x} x

nth Root \sqrt[n]{x} n
x
Absolute Value |x| |x|
Natural Log \ln{x}, \ln(x+y) ln x, ln(x + y)
Log \log_{2}{3}, \log_{2}(3+1) log2 (3 + 1)
Factorial 5! 5!

p√
$\sqrt{\sqrt{81}}=3$ \\ √ 81 = 3
2
$\sqrt[2]{9}=3$ \\ √ 9=3
3
$\sqrt[3]{27}=3$ \\ 27 = 3
$|3|=3$ \\ |3| = 3
$\ln{3}=\log_{e}{3} $ \\
$\ln(3)=\log_{e}(3)$
ln 3 = loge 3
ln(3) = loge (3)

More operator symbols can be found here.

polynom package
You can divide and factorize polynomials with the polynom package.

x2 +1
 3 2
x+1 x +x +x+1
% Long Division − x3 − x2
$\polylongdiv{x^3+x^2+x+1}{x+1}$ x+1
−x−1
0

% Factorization
$x^5+x^4+x^3+x^2+x+1 = $ x5 + x4 + x3 + x 2 + x + 1 =
$$\polyfactorize{  
x^5+x^4+x^3+x^2+x+1 x4 + x2 + 1 x + 1
}$$

45
Mathematics

cancel package
You can cancel fractions with the cancel package.
$$\frac{3 \cdot
\cancel{2}}{\cancel{2} \cdot 4}
3 · 2 3
=
= \frac{3}{4}$$ 2 · 4 4

7.7.3 Comparison Symbols

Description Command Output


Equal to = =
Approximately Equal to \approx ≈
Not Equal to \neq 6=
Less Than < <
Less Than or Equal to \leq ≤
Less Than or Equal to (slant) \leqslant ⩽
Much Less Than \ll 
Greater Than > >
Greater Than or Equal to \geq ≥
Greater Than or Equal to (slant) \geqslant ⩾
Much Greater Than \gg 
Proportional To \propto ∝

$\pi \approx 3.14$, but $\pi \neq


π ≈ 3.14, but π 6= 3.14 and π ≥ 3.14. In
3.14$ and $\pi \geq 3.14$. In
other words, $\pi > 3.14$. other words, π > 3.14.

More Comparison symbols can be found here.

7.7.4 Super
b scripts

Description Command Output


Superscript a^{b} ab
Subscript a_{0} a0

^ and _ only impact the next character, so it’s better to group the necessary characters
with {}.

Examples with {}1 :


1
x^2^3 and x_2_3 yield errors.

46
Mathematics

$x^{2} \quad x_{2}$ \\ x2 x2


$x^{10} \quad x_{10}$ \\ x10 x10
2
$x^{y^{2}} \quad x_{y_{2}}$ \\ xy xy2
$x^{y_{2}} \quad x_{y^{2}}$ xy2 xy 2

Examples without {}:

$x^2 \quad x_2$ \\ x2 x2


$x^2z^3 \quad x_2z_3$ \\ x2 z 3 x2 z3
$x ^2 z^ 3 \quad x _2 z_ 2$ \\ x2 z 3 x2 z2
$x^10 \quad x _10$
x1 0 x1 0

Mixing things up:

$x^{420}_{69} - y \quad x_{69}^{420} 69 − y


x420 69 − y
x420
- y$ \\ 14 14
6 C 6 C
${}^{14}_{6}C \quad {}_{6}^{14}C$ \\ 1 1
1H 1H
${}^1_1H \quad {}^1{}_1H$ \\
$A_1^2 \quad A{}_1{}^2$ \\
A21 A1 2
$A{}_1^2 \quad A_1{}^2$ \\ A21 A1 2
2 2
${}^{2}B^{2} \quad {}_2A_{1}$ \\ B 2 A1
$x_1' \quad x''_2$ x′1 x′′2

7.7.5 Fences (Delimiters)

Description Command Output


Round Brackets (x) (x)
Square Brackets [x] [x]
Curly Brackets \{x\} {x}
Angled Brackets \langle x \rangle hxi
Floor \lfloor x \rfloor bxc
Ceiling \lceil x \rceil dxe
Norm \|x\| kxk
Upper Corners \ulcorner x \urcorner ⌜x⌝
Lower Corners \llcorner x \lrcorner ⌞x⌟

If the fences are too small, use \left and \right before the left and right fence,
respectively.

47
Mathematics

 n
$$n \to \infty \implies \left( 1
1+\frac{1}{n} \right)^{n} \to e$$ n → ∞ =⇒ 1+ →e
n

For bigger, custom fence sizes, use \big, \Big, \bigg, or \Bigg before both the left
and right fence.

7.7.6 Dots

Description Command Output


Comma Separated List 1, 2, \dotsc, 5 1, 2, . . . , 5
Lower Dots 1, 2, \ldots, 5 1, 2, . . . , 5
Multiplication Dots 1 \cdot 2 \cdot 3 \dotsm 5 1 · 2 · 3···5
Binary Operation Dots 1 + 2 + \dotsb + 5 1 + 2 + ··· + 5
Other Dots 1, 2, \dotso, 5 1, 2, . . . , 5
..
Vertical Dots \vdots .
..
Diagonal Dots \ddots .

48
Mathematics

7.7.7 Arrows

Description Command Output


Right Arrow \to, \rightarrow →
Long Right Arrow \longrightarrow −→
Not Right Arrow \nrightarrow 9
Thick Right Arrow \Rightarrow ⇒
Thick Long Right Arrow \Longrightarrow =⇒
Thick Not Right Arrow \nRightarrow ;
Left Arrow \leftarrow, \gets ←
Long Left Arrow \longleftarrow ←−
Not Left Arrow \nleftarrow 8
Thick Left Arrow \Leftarrow ⇐
Thick Long Left Arrow \Longleftarrow ⇐=
Thick Not Left Arrow \nLeftarrow :
Left-Right Arrow \leftrightarrow ↔
Not Left-Right Arrow \nleftrightarrow =
Thick Left-Right Arrow \iff ⇐⇒
Up Arrow \uparrow ↑
Thick Up Arrow \Uparrow ⇑
Down Arrow \downarrow ↓
Thick Down Arrow \Downarrow ⇓
Up-Down Arrow \updownarrow l
Thick Up-Down Arrow \Updownarrow m
Maps To \mapsto 7→
Maps To (Long) \longmapsto 7−→
Leads To \leadsto ⇝

49
Mathematics

7.7.8 Decorations

Description Command Output


=y+x
z }| {
Over-brace \overbrace{x+y}^{=y+x} x+y
Prime f' f′
Prime Prime f'' f ′′
Dot \dot{x} ẋ
Dot Dot \ddot{x} ẍ
Hat \hat{x} x̂
Wide Hat \widehat{x+y} x[+y
Tilde \tilde{x} x̃
Wide Tilde \widetilde{x+y} x]+y
Bar \bar{x} x̄
Under-brace \underbrace{x+y}_{=y+x} x+y
| {z }
=y+x

7.7.9 Miscellaneous

Description Command Output


Asterisk \ast ∗
Bow Tie \bowtie ./
Bullet \bullet •
Dagger \dagger †
Curly l \ell `
Star \star ?

Surd \surd
Tick \checkmark ✓
Tilde \sim ∼

7.8 Set Theory

50
Mathematics

7.8.1 Number Sets

Description Command Output


Boolean Numbers \mathbb{B} B
Prime Numbers \mathbb{P} P
Natural Numbers \mathbb{N} N
Whole Numbers \mathbb{W} W
Integers \mathbb{Z} Z
Rationals \mathbb{Q} Q
Algebraic Numbers \mathbb{A} A
Irrationals \mathbb{I} I
Reals \mathbb{R} R
Complex Numbers \mathbb{C} C
Quaternions \mathbb{H} H
Octonions \mathbb{O} O
Sedenions \mathbb{S} S
Empty Set \emptyset, \varnothing ∅, ∅
Power Set \mathcal{P} P

51
Mathematics

7.8.2 Set Notation

Description Command Output


Brackets \{3, 1, 4\} {3, 1, 4}
Cardinality \mathbf{card}(S), |S| card(S), |S|
Definition A:=B A := B
Element of \in ∈
Not an Element of \notin ∈
/
Subset of \subset ⊂
Subset of \subseteq ⊆
Subset of but Not Equal to \subsetneq (
Not a Subset of \not\subset 6⊂
Not a Subset of \nsubseteq *
Contains \supset ⊃
Contains \supseteq ⊇
Union \cup ∪
S10
Big Union \bigcup_{n=1}^{10}{A_n} n=1 An
Disjoint Union \sqcup t
Intersection \cap ∩
T10
Big Intersection \bigcap_{n=1}^{10}{A_n} n=1 An
Set Difference \setminus \
Symmetric Difference \triangle 4
Set Complement A^{mathsf{c}} Ac
Set Complement \overline{A} A
Cartesian Product \times ×

7.8.3 braket package


You can load the braket package when typesetting sets.
% Preamble
\usepackage{braket}  
1
% Body x∈R 0<x<
3
$$ \Set{x \in \mathbb{R} | 0 < x <
\frac{1}{3}}$$

52
Mathematics

7.9 Logic

Description Command Output


Not \neg, \sim ¬, ∼
And \land ∧
Or \lor ∨
Exclusive Or (XOR) \oplus ⊕
If. . . Then \implies, \Longrightarrow =⇒
Only If \Longleftarrow ⇐=
If and Only If \iff ⇐⇒
Equivalence \equiv ≡
Therefore \therefore ∴
Because \because ∵
Exists \exists ∃
Exists Uniquely \exists! ∃!
There is No \nexists @
For All \for all ∀
Top \top >
Bottom \bot ⊥

More logic symbols can be found on Wikipedia.

7.10 Algebra
7.10.1 Infinity
First, you ought to know the commands for ∞ and −∞.

Description Command Output


Infinity \infty ∞
Negative Infinity -\infty −∞

7.10.2 Intervals
There are 9 types of intervals:

53
Mathematics

Description Command Output


Finite Open (a, b) (a, b)
Finite Closed [a, b] [a, b]
Finite Half Closed - Half Open [a, b) [a, b)
Infinite Half Closed - Half Open [a, \infty) [a, ∞)
Infinite Half Open - Half Closed (-\infty, b] (−∞, b]
Infinite Open (a, \infty) (a, ∞)
Infinite Open (-\infty, b) (−∞, b)
Reals (\infty, -\infty) (∞, −∞)

7.10.3 Functions

Description Command Output


Colon \colon :
Function \to, \rightarrow →
Maps To \mapsto 7→
Injection \rightarrowtail ↣
Injection \xhookrightarrow{} ,−→
1:1
Injection \xrightarrow{\tiny 1:1} −−→
Injection \xrightarrow[\tiny 1:1]{} −−→
1:1
Surjection \twoheadrightarrow ↠
onto
Surjection \xrightarrow{\tiny \text{onto}} −−→
1:1, onto
Bijection \xrightarrow{\tiny 1:1, \text{ onto}} −−−−−→
bij
Bijection \xrightarrow{\tiny\text{bij}} −→
Composition \circ ◦
Restriction f|_{X} f |X
Inverse f^{-1} f −1
Convolution \ast ∗
Fourier Transform \hat{f} fˆ

While you could type out “:”, \colon allows for proper spacing.
% :
$f \circ g: [0, 1] \to [0, 1]$ is a
function. \\ f ◦ g : [0, 1] → [0, 1] is a function.

% \colon f ◦ g ◦ h : A → B is a function.
$f \circ g \circ h \colon A \to B$
is a function.

54
Mathematics

Use the cases environment to define a piecewise function.


$$
f(x) = 1_{\mathbb{Q}}(x) = (
\begin{cases} 1 x∈Q
1 & x \in \mathbb{Q} \\ f (x) = 1Q (x) =
0 & x \notin \mathbb{Q} 0 x∈
/Q
\end{cases}
$$

If you need to include text, then:


$$
f(x) = 1_{\mathbb{Q}}(x) = (
\begin{cases} 1 if x ∈ Q
1 & \text{if $x \in \mathbb{Q}$} \\ f (x) = 1Q (x) =
0 & \text{if $x \notin \mathbb{Q}$} 0 if x ∈
/Q
\end{cases}
$$

7.11 Geometry
7.11.1 Geometry Notation

Description Command Output


Line Segment \overline{AB} AB
−−→
Ray \overrightarrow{AB} AB
←→
Line \overleftrightarrow{AB} AB
Triangle \triangle{ABC} 4ABC
Square \square{ABC} □ABC
Angle \angle{ABC} ∠ABC
Measured Angle \measuredangle{ABC} ∡ABC
Degrees 180^{\circ} 180◦
Congruent \cong ∼
=
Not Congruent \ncong 
Similar \sim ∼
Not Similar \nsim 
Parallel \parallel k
Not Parallel \nparallel ∦
Perpendicular \perp ⊥
Not Perpendicular \not\perp 6⊥

55
Mathematics

7.11.2 Trigonometry & Hyperbolic Functions

Description Command Output


Sine \sin{\pi}, \sin(\pi) sin π, sin(π)
Cosine \cos{\pi} cos π
Tangent \tan{\pi} tan π
Cosecant \csc{\pi} csc π
Secant \sec{\pi} sec π
Cotangent \cot{\pi} cot π
Inverse Sine \arcsin{0} arcsin 0
Inverse Cosine \arccos{0} arccos 0
Inverse Tangent \arctan{0} arctan 0
Hyperbolic Sine \sinh{0} sinh 0
Hyperbolic Cosine \cosh{0} cosh 0
Hyperbolic Tangent \tanh{0} tanh 0

7.11.3 Sums
Sums are different in inline and display mode.
P∞ 1
The harmonic series n=1 n is divergent.
The harmonic series
$\sum_{n=1}^{\infty}{\frac{1}{n}}$
The harmonic series
is divergent. \\
X∞
1
The harmonic series
$$\sum_{n=1}^{\infty}{\frac{1}{n}}$$ n=1
n
is divergent.
is divergent.

While the curly braces {} are not necessary, they make the code readable.

X
b
1
$$\sum_a^b \frac{1}{n}$$
a
n

You can also typeset double sums.

$$\sum_{i=1}^{2}{\sum_{j=1}^{2}{i+j}} X
2 X
2

= 12$$
i + j = 12
i=1 j=1

56
Mathematics

Use \substack to write the limits over multiple lines.


$$\sum_{
\substack{ X
0 \leq i \leq 2 \\ i + j = 12
0 \leq j \leq 2 0≤i≤2
} 0≤j≤2
}^{}{i+j}=12$$

You can forcefully change the position of the limits for sums using \limits and
\nolimits2 .
% Inline Mode
$\sum_{n=1}^{5}{n}$
P5
% Inline Mode (placing limit n=1 n
position under sum) P
5
$\sum\limits_{n=1}^{5}{n}$ n
P5
n=1
% Inline Mode (placing limit n=1 n
position besides sum)
$\sum\nolimits_{n=1}^{5}{n}$ X
5
n
% Display Mode n=1
$$\sum_{n=1}^{5}{n}$$
X
5

% Display Mode (placing limit n


position under sum) n=1
$$\sum\limits_{n=1}^{5}{n}$$ X5
n
n=1
% Display Mode (placing limit
position besides sum)
$$\sum\nolimits_{n=1}^{5}{n}$$

7.11.4 Products
Refer to 7.11.3 on page 56 and replace sum with prod.

2
This also applies for products, integrals, and limits.

57
Mathematics

Q50
n=1 n = 50!
% Inline Mode
$\prod_{n=1}^{50}{n}=50!$ \\
The product
% Display Mode Y
50

The product $$\prod_{n=1}^{50}{n}$$ n


$=50!$ n=1

= 50!

7.12 Calculus
7.12.1 Derivatives
You can write a derivative as follows:
If f (x) = x2 , then
% Leibniz Notation
If $f(x)=x^2$, then df
$$\frac{df}{dx}=2x.$$ = 2x.
dx
% Lagrange Notation
Using other notation:
Using other notation:
$$f'(x)=2x$$
f ′ (x) = 2x

Notice the slant in df . For an upright d, type the following in the preamble:
\newcommand{\dee}{\mathrm{d}}

\dee is my choice, so you can use something else.

$$\frac{\dee f}{\dee x} = 2x$$


df
= 2x
dx

If you need to evaluate derivatives:

$$\left.\frac{\dee f}{\dee df
x}\right|_{x=2}=4$$
=4
dx x=2

Partial derivatives are typeset using \partial.

$$\frac{\partial g}{\partial x ∂g
\partial y}$$ ∂x∂y

58
Mathematics

diffcoeff package
diffcoeff with the ISO option also takes care of the upright d. It is also handy for
higher-order and partial derivatives.
% Preamble
\uspackage[ISO]{diffcoeff}

Typesetting ordinary derivatives:

df
dx
df /dx
dn f
dxn
$$\diff{f}{x}$$ d n f /dxn
$$\diff{f}/{x}$$
$$\diff[n]{f}{x}$$ d cos(sin x)
$$\diff[n]{f}/{x}$$ d(sin x)
$$\diff{\cos(\sin x)}{(\sin x)}$$
$$\diff[n]{\cos(\sin{x})}{\sin{x}}$$ dn cos(sin x)
$$\diff*{f(x)}{x}$$
d(sin x)n
$$\diff*{\diff{y}{x}}{x}$$
$$\diff[n]{f}{x}[x=0]$$ d
f (x)
dx
d dy
dx dx
 n 
d f
dxn x=0

Typesetting partial derivatives:

59
Mathematics

∂f
∂x
∂f /∂x
$$\diffp{f}{x}$$ ∂ nf
$$\diffp{f}/{x}$$ ∂xn
$$\diffp[n]{f}{x}$$
∂ n f /∂xn
$$\diffp[n]{f}/{x}$$  n 
$$\diffp[n]{f(x,y)}{x}[(0,0)]$$ ∂ f (x, y)
$$\diffp{f}{x, y, z}$$
$$\diffp[2, 3, 4, 1]{f(x, y, z,
∂xn (0,0)
w)}{x, y, z, w}$$ ∂ 3f
∂x ∂y ∂z
∂ 10 f (x, y, z, w)
∂x2 ∂y 3 ∂z 4 ∂w

More package information can be found on CTAN.

7.12.2 Integration
Refer to 7.11.3 on page 56 and replace sum with int. To include the differential, add
\,\dee x.
The integral $\int_{0}^{\infty}{e^x} R∞ x
\,\dee x$ diverges.
The integral 0
e dx diverges.

Z
$$\int_{0}^{2}{2x} \,\dee x =
2  2
\left[x^2\right]^{2}_{0} = 4$$ 2x dx = x2 0 = 4
0

For multiple integrals, use \int multiple times.

If I1 = I2 = [0, 2], then


If $I_1=I_2=[0, 2]$, then Z Z
$$\int_{I_1}{\int_{I_2}{xy \,\dee x} xy dx dy = 4
\,\dee y} = 4$$ I1 I2

Explicitly: Explicitly:
$$\int_{0}^{2}{\int_{0}^{2}{xy
\,\dee x} \,\dee y} = 4$$
Z 2 Z 2
xy dx dy = 4
0 0

60
Mathematics

Different types of integrals:


% Integral with Specified Limits Z ∞
(Besides Integral) f =0
$$\int_{-\infty}^{\infty} f = 0$$ −∞

Z∞
% Integral with Specified Limits
(Under Integral) f =0
$$\int\limits_{-\infty}^{\infty} f = −∞
0$$ ZZ
f =F
% Double / Surface Integral A
$$\iint_A f = F$$ ZZZ
% Triple / Volume Integral f =F
V
$$\iiint_V f = F$$
ZZZZ
% Quadruple Integral f =F
$$\iiiint_V f = F$$ V
Z Z
% Multiple Integral ··· f =F
$$\idotsint_V f = F$$ V
I
% Line Integral f =F
$$\oint_V f = F$$ V

7.12.3 Multivariable Calculus

Description Command Output


Gradient \nabla{f} ∇f
Divergence \nabla\cdot{F} ∇·F
Divergence \nabla\times{f} ∇×F
Laplace Operator \Delta{f} ∆f
D’Alembert Operator \square{f} □f

7.13 Analysis
7.13.1 Sequences
Use () to denote sequences.

61
Mathematics

Let $(a_{n})=(1, 2, 3, 4, 5, Let (an ) = (1, 2, 3, 4, 5, . . .) be a se-


\ldots)$ be a sequence. quence. Then
Then $$n \to \infty \implies a_{n}
\to \infty.$$ n → ∞ =⇒ an → ∞.

7.13.2 Limits
Limits can also be typeset easily.
If the limit of $f(x)$ exists at
$x=a$, then If the limit of f (x) exists at x = a, then
$(\forall\varepsilon>0) (∀ε > 0)(∃δ > 0)(0 < |x − a| < δ =⇒
(\exists\delta>0) |f (x) − f (a)| < ε).
(0<|x-a|<\delta \implies
|f(x)-f(a)|<\varepsilon)$. \\
% Inline Mode 1
limn→∞ =0
$\lim_{n \to \infty}{\frac{1}{n}} = n
0$ \\
1 1
limn→2+ n
= 2
$\lim_{n \to 2^{+}}{\frac{1}{n}} =
\frac{1}{2}$ \\
1
% Display Mode lim =0
n→∞ n
$$\lim_{n \to \infty}{\frac{1}{n}} =
0$$ f (x + h) − f (x)
f ′ (x) = lim+
$$f'(x) = \lim_{h \to h→0 h
0^{+}}{\frac{f(x+h) -
f(x)}{h}}$$ \\

\substack (refer to 7.11.3 on page 56) can also be applied to limits.

7.13.3 Infimum & Supremum


For limit inferior and superior, replace \lim with \liminf and \limsup, respectively.
% Limit Superior
$$\limsup_{n \to \infty}{x_{n}} = 1$$ lim sup xn = 1
n→∞
$$\varlimsup_{n \to \infty}{x_{n}} =
1$$ lim xn = 1
n→∞
% Limit Inferior
$$\liminf_{n \to \infty}{x_{n}} = lim inf xn = −1
-1$$ n→∞
$$\varliminf_{n \to \infty}{x_{n}} = lim xn = −1
-1$$ n→∞

62
Mathematics

Other important commands include:

Description Command Output


Minimum \min{A} min A
Maximum \max{A} max A
Infimum \inf{A} inf A
Supremum \sup{A} sup A

7.13.4 Big O Notation

Description Command Output


Small o o(g) o(g)
Big O \mathcal{O}(g) O(g)
Big Theta \Theta(g) Θ(g)
Big Omega \Omega(g) Ω(g)
Small omega \omega(g) ω(g)

7.14 Abstract Algebra


7.14.1 Equivalence Classes & Relations

Description Command Output


Equivalence Class [a] [a]
Equivalence Relation \sim ∼
Equivalence Relation \backsim ∽

63
Mathematics

7.14.2 Group Theory

Description Command Output


Group Isomorphism \simeq '
Direct Product \times ×
Semi-Direct Product \rtimes o
Wreath Product \wr o
Subgroup \leq ≤
Normal Subgroup \vartriangleleft ◁
Not a Normal Subgroup \not\vartriangleleft 6◁
Quotient Group G / H G/H
Index of a Subgroup [G : H] [G : H]
Generator \langle X \rangle hXi
Commutator [g, h] [g, h]

7.14.3 Field Theory

Description Command Output


Field Extension L : K L:K
Degree of Field Extension [L : K] [L : K]
Algebraic Closure \overline{K} K

7.15 Discrete Mathematics


7.15.1 Number Theory

Description Command Output


Divides a \mid b a|b
Does Not Divide a \nmid b a-b
Congruence With () a \equiv b \pmod{n} a ≡ b (mod n)
Congruence Without () a \equiv b \mod{n} a ≡ b mod n
Greatest Common Divisor \gcd(100, 10) gcd(100, 10)
Euler’s Totient Function \phi(n) φ(n)

7.15.2 Continued Fractions


\cfrac does the job. The options [r] or [l] determine the position of the numerator.

64
Mathematics

\begin{equation*}
x = x_{0} + \cfrac{y_{0}}{ y0
x = x0 +
x_{1} + \cfrac{y_{1}}{ y1
x_{2} + \cfrac[l]{y_{2}}{ x1 +
x_{3} + \cfrac[r]{y_{3}}{ y2
x2 +
x_{4} + \cdots}}}} y3
\end{equation*} x3 +
x4 + · · ·

7.15.3 Combinatorics

Description Command Output


Factorial n! n!
Double Factorial n!! n!!
Derangement !n !n
n
Combination \binom{n}{k} k 
n
Multinomial Coefficient \binom{n}{k_1, k_2, \ldots, k_r}
 r
k1 ,k2 ,...,k
n
Multiset \left(\binom{n}{k}\right) k
Primorial n\# n#

You can also use \dbinom for a display mode sized binomial and \tbinom for a text
mode sized binomial.

7.16 Stochastics (Probability & Statistics)


7.16.1 Probability

Description Command Output


Probability Measure P(E) P (E)
Conditional Probability P(A \mid B) P (A | B)
Expected Value E(X) E(X)
Variance \mathrm{Var}(X) Var(X)
Standard Deviation \sigma(X) σ(X)
Covariance \mathrm{Cov}(X, Y) Cov(X)
Correlation \rho(X, Y) ρ(X, Y )
Probability Distribution X \sim Y X∼Y

65
Mathematics

7.16.2 Statistics

Description Command Output


Mean \overline{x} x
Estimator \hat{p} p̂

7.17 Linear Algebra


7.17.1 Vectors
Vectors are denoted using \vec.
$\vec{a}$ ⃗a

Bold vectors require \boldsymbol. Typing this out can be cumbersome, so define a
new command in the preamble.
\newcommand{\bvec}[1]{\boldsymbol{#1}}

Using the new command:


$\bvec{a}$ a

Vectors are defined within a matrix3 , pmatrix, bmatrix, or Bmatrix environment.

Row vectors:
% Row Vector (no fences)
\begin{equation*}
\begin{matrix}
1 & 2 & 3 1 2 3
\end{matrix}
\end{equation*}

% Row Vector (round brackets)


\begin{equation*}
\begin{pmatrix} 
1 & 2 & 3 1 2 3
\end{pmatrix}
\end{equation*}
3
The array environment does the same thing but is not preferred.

66
Mathematics

% Row Vector (square brackets)


\begin{equation*}
\begin{bmatrix}  
1 & 2 & 3 1 2 3
\end{bmatrix}
\end{equation*}

% Row Vector (curly braces)


\begin{equation*}
\begin{Bmatrix} 
1 & 2 & 3 1 2 3
\end{Bmatrix}
\end{equation*}

Column vectors:
% Column Vector (no delimiters)
\begin{equation*}
\begin{matrix} 1
1 \\ 2
2 \\ ..
\vdots \\ .
3 3
\end{matrix}
\end{equation*}

% Column Vector (round brackets)


\begin{equation*}  
\begin{pmatrix} 1
1 \\ 2
 
2 \\  .. 
\vdots \\ .
3 3
\end{pmatrix}
\end{equation*}

% Column Vector (square brackets)


\begin{equation*}  
\begin{bmatrix} 1
1 \\ 2
 
2 \\  .. 
\vdots \\ .
3 3
\end{bmatrix}
\end{equation*}

67
Mathematics

% Column Vector (curly braces)


\begin{equation*}  
\begin{Bmatrix} 
 1 
1 \\ 
2 
2 \\ ..
\vdots \\ 
 .

3 
3
\end{Bmatrix}
\end{equation*}

7.17.2 Matrices
Use the exact same environments mentioned in 7.17.1.
% Matrix (no delimiters)
\begin{equation*}
\begin{matrix}
1 2 3
1 & 2 & 3 \\
4 & 5 & 6 4 5 6
\end{matrix}
\end{equation*}

% Matrix (round brackets)


\begin{equation*}  
\begin{pmatrix} a11 · · · a1n
a_{11} & \cdots & a_{1n} \\  .. .. .. 
\vdots & \ddots & \vdots \\  . . . 
a_{m1} & \cdots & a_{mn} am1 · · · amn
\end{pmatrix}
\end{equation*}

% Matrix (square brackets)


\begin{equation*}
\begin{bmatrix}  
1 2
1 & 2 \\
4 & 5 4 5
\end{bmatrix}
\end{equation*}

% Matrix (curly braces)


\begin{equation*}
\begin{Bmatrix}
 
1 2
1 & 2 \\
3 4
3 & 4 \\  
5 & 6 5 6
\end{Bmatrix}
\end{equation*}

68
Mathematics

If you need matrices with different delimiters, then you add them to a plain matrix
using \left and \right.
% Matrix (custom delimiters)
$
\left(
\begin{matrix}
1 & 2 \\
3 & 4
\end{matrix}
\right]    
1 2 1 2
$, ,
$ 3 4 3 4
\left\lceil
\begin{matrix}
1 & 2 \\
3 & 4
\end{matrix}
\right\rfloor
$

Even in inline mode, matrices are in display style. For smaller matrices, use smallmatrix,
psmallmatrix, or bsmallmatrix.
% Small Matrix (no delimiters)
$
\begin{smallmatrix}
1 & 2 \\ 1 2
3 4 is a 2 × 2 matrix.
3 & 4
\end{smallmatrix}
$ is a $2 \times 2$ matrix.

% Small Matrix (round brackets)


$
\begin{psmallmatrix}
1 & 2 \\ ( 13 24 ) is a 2 × 2 matrix.
3 & 4
\end{psmallmatrix}
$ is a $2 \times 2$ matrix.

% Small Matrix (square brackets)


$
\begin{bsmallmatrix}
1 & 2 \\ [ 13 24 ] is a 2 × 2 matrix.
3 & 4
\end{bsmallmatrix}
$ is a $2 \times 2$ matrix.

69
Mathematics

% Small Matrix (custom brackets)


$
\left(
\begin{smallmatrix}
1 & 2 \\ ( 13 24 } is a 2 × 2 matrix.
3 & 4
\end{smallmatrix}
\right\}
$ is a $2 \times 2$ matrix.

7.17.3 Determinants
Use the vmatrix environment.
\begin{equation*}
\begin{vmatrix}
1 & 2 \\
1 2
3 & 4 = 1 · 4 − 2 · 3 = −2
\end{vmatrix} 3 4
= 1 \cdot 4 - 2 \cdot 3 = -2
\end{equation*}

An alternative is:
\begin{equation*}
\left|
\begin{matrix}
1 & 2 \\
1 2
3 & 4 = 1 · 4 − 2 · 3 = −2
\end{matrix} 3 4
\right|
= 1 \cdot 4 - 2 \cdot 3 = -2
\end{equation*}

You can also use \det.


The determinant of $A$ is
\begin{equation*}
\det{\left(
\begin{pmatrix} The determinant of A is
1 & 2 \\  
3 & 4 1 2
det = 1 · 4 − 2 · 3 = −2
\end{pmatrix} 3 4
\right)}
= 1 \cdot 4 - 2 \cdot 3 = -2
\end{equation*}

70
Mathematics

7.17.4 Matrix Norm


Use the Vmatrix environment.
\begin{equation*}
\begin{Vmatrix}
1 & 2 \\ 1 2
3 & 4 3 4
\end{Vmatrix}
\end{equation*}

An alternative is:
\begin{equation*}
\left\|
\begin{matrix}
1 & 2 \\ 1 2
3 & 4 3 4
\end{matrix}
\right\|
\end{equation*}

7.17.5 Vector Calculus

Description Command Output


Dot Product v \cdot w v·w
Inner Product \langle v, w \rangle hv, wi
Cross Product v \times w v×w
Triple Product (u, v, w) (u, v, w)
Dyadic Product v \otimes w v⊗w
Unit Vector \hat{v} v̂

71
Mathematics

7.17.6 Matrix Operations

Description Command Output


Matrix Multiplication A \cdot B A·B
Hadamard Product A \circ B A◦B
Kronecker Product A \otimes B A⊗B
Matrix Transpose A^{T} AT
Conjugate Transpose A^{*} A∗
Inverse Matrix A^{-1} A−1
Trace \mathrm{tr}(A) tr(A)
Determinant \det(A) det(A)
Determinant |A| |A|
Matrix Norm \|A\| kAk
Rank \mathrm{rank}(A) rank(A)
Span \mathrm{span}(A) span(A)

7.17.7 Vector Spaces

Description Command Output


Kernel \ker{W} ker W
Dimension \dim{W} dim W
Degree \degree{P(x)} deg P (x)
Direct Sum V \oplus W V ⊕W
Direct Product V \times W V ×W
Tensor Product V \otimes W V ⊗W
Quotient Space V / W V /W
Orthogonal Complement W^{\perp} A⊥
Dual Space V^{*} V∗
Linear Hull \langle X \rangle hXi

7.18 Overriding Default Math Styles


Suppose you want a display mode style sum in between text. How do you do that?
Fortunately, LATEX provides commands to override the default style that math is type-
set.

• \textstyle - inline math style.

• \displaystyle - display math style.

72
Mathematics

• \scriptstyle - sub/superscript math style.

• \scriptscriptstyle - second order sub/superscript math style.

These commands are useful with sums, products, integral, and limits.
% Display Mode
$$\sum_{n=1}^{10}{n}$$
X
10

% Text Style in Display Mode n


$$\textstyle\sum_{n=1}^{10}{n}$$ n=1
P10
% Other Styles n=1 n
$\scriptscriptstyle\sum_{n=1}^{10}
{n}$, ∑10 P10 X
10
∑10
,
n=1 n n=1 n, n=1 n, n
$\scriptstyle\sum_{n=1}^{10}{n}$,
n=1
$\sum_{n=1}^{10}{n}$,
$\displaystyle\sum_{n=1}^{10}{n}$

7.19 Coloring Math


Coloring math is similar to coloring text (refer to 4.7 on page 20).

$$\frac{\textcolor{blue}{5}}{10}= 5 1
\frac{1}{\textcolor{red}{10}}$$ =
10 10

7.20 Homework
There are a few templates for homework assignments that I have uploaded to GitHub.
More templates can be found on Overleaf.

Helpful Resources
1. Wikibooks - a thorough guide for typesetting mathematics.

2. AMS Math Guide for LATEX - a guide to LATEX by the American Mathematical
Society.

3. The Grammar of Mathematics - how to write math.

73
Chapter 8

Structures

8.1 Lists
Different environments render different lists.

• itemize - unordered list (bullet points).

• enumerate - ordered list (numbers).

• description - description list (words).

Grocery list:
Grocery list:
\begin{itemize}
\item Pineapples
• Pineapples
\item More Pineapples
\item Even More Pineapples
• More Pineapples
\end{itemize}
• Even More Pineapples

Premier League Top 4:


Premier League Top 4:
\begin{enumerate} 1. Manchester United
\item Manchester United
\item Manchester City 2. Manchester City
\item Liverpool
\item Chelsea 3. Liverpool
\end{enumerate}
4. Chelsea

74
Structures

Bull’s Starting Line-up:


Bull's Starting Line-up:
\begin{description} PG Lonzo Ball
\item[PG] Lonzo Ball
\item[SG] Zach Lavine SG Zach Lavine
\item[SF] DeMar DeRozan
\item[PF] Javonte Green SF DeMar DeRozan
\item[C] Nikola Vučević
\end{description} PF Javonte Green

C Nikola Vučević

You can also nest lists.


Bull's Starting Line-up: Bull’s Starting Line-up:
\begin{description}
\item[PG] Lonzo Ball PG Lonzo Ball
\begin{description}
\item Bench Bench
\begin{itemize}
\item[\textbf{\#6}] Alex #6 Alex Caruso
Caruso • Coby White
\item Coby White
\end{itemize} SG Zach Lavine
\end{description}
\item[SG] Zach Lavine SF DeMar DeRozan
\item[SF] DeMar DeRozan
\item[PF] Javonte Green PF Javonte Green
\item[C] Nikola Vučević
\end{description} C Nikola Vučević

More information on lists can be found here.

8.2 Tables
The table and tabular environments are used to create tables.

8.2.1 The table environment

75
Structures

\begin{table}[c] % t = top of the


page; c = center of the page b =
bottom of the page

% Title of the table


\caption{Basic Table}
Table 8.1: Basic Table
% Centers table (table is aligned to
left by default)
\centering
\end{table}

• c specifies the position of the table within the page.

• To place table at precisely the location in the LATEX code, load the float package
and use H instead of c.

• To right align the table, place the code in a flushright environment.

To fill in the table contents, start a tabular environment.


\begin{center} % You can also use
the center environment
\begin{table}[c]
\caption{Basic Table}

% 3 columns: l = left justified


contents; c = centered column Table 8.2: Basic Table
contents; r = right justified 1 2 3
contents
4 5 6
\begin{tabular}{l c r}
1 & 2 & 3 \\
4 & 5 & 6 \\
\end{tabular}
\end{table}
\end{center}

• Column widths and spacing are automatically defined.

• & separates columns.

• \\ separates rows.

• For simple tables, you may only need the tabular environment.

76
Structures

Notice the small gap between the table contents and title. The caption package
solves this. Add the following to the preamble.
\usepackage{caption}
\captionsetup[table]{skip=10pt}

The caption package provides more customization options. Read this tutorial for
more information.

8.2.2 The tablular environment


The tablular environment was introduced in the last section. Let’s continue adding
features to it.
\centering

\begin{tabular}[c]{|| l | c | r ||}
\hline
Col 1 & Col 2 & Col 3 \\ [0.2ex] % Col 1 Col 2 Col 3
Headings 1 2 3
1 & 2 & 3 \\
\hline 4 5 6
4 & 5 & 6 \\ 7 8 9
\hline
7 & 8 & 9 \\
\hline\hline
\end{tabular}

• | adds a vertical line between columns.

• || adds a double vertical line between columns.

• \hline adds a horizontal line between rows.

• \hline\hline adds a double horizontal line between rows.

• There is no need \\ after \hline.

• Add space between rows with square brackets []

77
Structures

\centering

\begin{tabular}[c]{l c r}
\hline
Col 1 & Col 2 & Col 3 \\ [0.2ex] Col 1 Col 2 Col 3
\cline{2-2}
1 2 3
1 & 2 & 3 \\
\cline{2-3} 4 5 6
4 & 5 & 6 \\ 7 8 9
\hline
7 & 8 & 9 \\
\hline
\end{tabular}

• \cline{m-n} adds a horizontal line between columns m and n.


\centering

\begin{tabular}[c]{| l | c | r |
p{2.5cm} |} Col 1 Col 2 Col 3 Text
\hline 1 2 3 Numbers from
Col 1 & Col 2 & Col 3 & Text \\ 1-3.
[0.2ex]
1 & 2 & 3 & Numbers from 1-3. \\ 4 5 6 Numbers from
\hline 4-6.
4 & 5 & 6 & Numbers from 4-6. \\ 7 8 9 Numbers from
\hline 7-9.
7 & 8 & 9 & Numbers from 7-9. \\
\hline
\end{tabular}

• \p{2.5cm} specifies a paragraph column with text vertically aligned at the top.

More complex tables involving merging rows and columns. Use \multicolumn to
merge cells over multiple columns.

78
Structures

\centering

\begin{tabular}[c]{| l | c | r |}
\hline
Col 1 & Col 2 & Col 3 \\ [0.2ex]
\hline Col 1 Col 2 Col 3
1 & \multicolumn{2}{c}{2, 3} \\
1 2, 3
\hline
\multicolumn{3}{c}{4, 5, 6} \\ 4, 5, 6
\hline 7 8 9
\multicolumn{1}{l}{7} &
\multicolumn{1}{c}{8} &
\multicolumn{1}{r}{9} \\
\hline
\end{tabular}

• \multicolumn removes the vertical lines, so specify them.

\centering

\begin{tabular}[c]{| l | c | r |}
\hline
Col 1 & Col 2 & Col 3 \\ [0.2ex]
\hline Col 1 Col 2 Col 3
1 & \multicolumn{2}{| c |}{2, 3} \\
1 2, 3
\hline
\multicolumn{3}{| c |}{4, 5, 6} \\ 4, 5, 6
\hline 7 8 9
\multicolumn{1}{| l |}{7} &
\multicolumn{1}{| c |}{8} &
\multicolumn{1}{| r |}{9} \\
\hline
\end{tabular}

Load the multirow package and use \multirow to merge cells over multiple rows.

79
Structures

\centering

\begin{tabular}{| c | c | c |}
\hline
\multicolumn{3}{| c |}{Bulls Roster}
\\
\hline
\multirow{2}{*}{Point Guards} Bulls Roster
& PG1 & Lonzo B. \\
& PG2 & Alex C. \\ PG1 Lonzo B.
Point Guards
\hline PG2 Alex C.
\multirow{2}{*}{Shooting Guards} SG1 Zach L.
& SG1 & Zach L. \\ Shooting Guards
SG2 Ayo D.
& SG2 & Ayo D. \\
\hline
SF1 DeMar D.
Small Forwards
\multirow{2}{*}{Small Forwards} SF2 Derrick J.
& SF1 & DeMar D. \\ PF1 Patrick W.
& SF2 & Derrick J. \\ Power Forwards
PF2 Javonte G.
\hline
C1 Nikola V.
\multirow{2}{*}{Power Forwards} Centers
& PF1 & Patrick W. \\ C2 Tony B.
& PF2 & Javonte G. \\
\hline
\multirow{2}{*}{Centers}
& C1 & Nikola V. \\
& C2 & Tony B. \\
\hline
\end{tabular}

• * tells LATEX that the column width is determined by its content.

Helpful Resources
1. Table to LATEX generators - converts drawn table to LATEX.

2. Overleaf - positioning tables.

3. Wikibooks - an advanced guide for tables.

8.3 Images
1. Save the image in the folder your document is saved in (as a EPS, JPEG, PDF,
or PNG).

80
Structures

2. Load the graphicx package.

3. Use \includegraphics.

\begin{center}
\includegraphics[width=5cm,
height=3cm, angle=0,
scale=1]{ronaldo.jpeg}
\end{center}

Sometimes images and text do not work well together, so images must be placed in a
figure environment. It is similar to the table environment in some ways.

\begin{center} Figure 8.1: The SIU


\begin{figure}
\caption{The \textbf{SIU}}
\includegraphics[width=5cm,
height=3cm, angle=0,
scale=1]{ronaldo.jpeg}
\end{figure}
\end{center}

More information on inserting images can be found here.

81
Chapter 9

Navigation

9.1 Table of Contents


Use \tableofcontents in the body of the document.

9.2 List of Tables & Figures


Use \listoftables and \listoffigures in the body of the document.

9.3 Abstract
Add the following code to the document body:
\chapter*{Abstract}

% Adding Abstract to Table of Contents


\addcontentsline{toc}{chapter}{Abstract}

An alternative solution is to use the abstract environment.


\begin{abstract}
This guide serves as an introduction to \LaTeX{}. I hope new users find it
useful.
\end{abstract}

82
Navigation

9.4 Acknowledgements
Add the following code to the document body:
\chapter*{Acknowledgements}

% Adding Acknowledgements to Table of Contents


\addcontentsline{toc}{chapter}{Acknowledgements}

9.5 Appendix
Load the appendix package as follows:
% Preamble
\usepackage[toc]{appendix} % Includes appendices in Table of Contents

% Body
\begin{appendices}
\chapter{Riemann Hypothesis Proof}
Sir Michael Atiyah claims the proof for the Riemann Hypothesis is as follows...
\end{appendices}

9.6 Bibliography
Watch this video. A few things to remember:

• Run the compilers below in the order stated:

1. LATEX1
2. BibTEX
3. LATEX (×2)

• Other bibliography styles can be found here.

• When you use \bibliography, the .bib file name must be within the {}.

• When you use \cite, the name must within {} must match the name in the
.bib file.

1
You can use XƎLATEX or LuaLATEX instead.

83
Navigation

9.7 Index
Load the imakeidx package and type the following code:
% Preamble
\usepackage{imakeidx}

% Alphabetical Index
\begin{filecontents*}{\jobname.mst}
headings_flag 1
heading_prefix "\\par\\penalty-50\\textbf{"
heading_suffix "}\\\\\*\~\\\\\*"
symhead_positive "Symbols"
symhead_negative "symbols"
numhead_positive "Numbers"
numhead_negative "numbers"
delim_0 ",\~"
\end{filecontents*}

% Making the Index


\makeindex[intoc]

% Body

% Making an Index entry


This is the first index\index{first entry} entry.

% Printing the Index


\printindex

Next, run the compilers below in the order stated:

1. LATEX2

2. MakeIndex

3. LATEX (×2)

To change the style of index entries, refer to this table.

9.8 Hyperlinks
Load the href package.
2
Refer to the footnote in 9.6

84
Navigation

% Preamble
\usepackage[colorlinks, urlcolor=blue]{href}

Use \href to add a link.


This is a
\href{https://www.google.com} This is a link.
{link}.

If you just want a URL, then use \url.


\url{https://www.google.com}
https://www.google.com provides a
provides a pretty good search
engine. pretty good search engine.

You can also add your email address.


\href{mailto:[email protected]}
{Say Hi!}
Say Hi!

More information about hyperlinks can be found here.

85
Chapter 10

Drawing

TikZ is the most powerful graphics tool in LATEX. While it is quite complex, I introduce
the basics.

10.1 Lines
Load the tikz package.
% Preamble
\usepackage{tikz}

Use \tikz. . .; to draw inline. ; marks the end of the instruction and is neces-
sary.
\tikz \draw (0, 0) - - (1, 0); is a
straight line
is a straight line

Use the tikzpicture environment for larger pictures.

86
Drawing

\centering
\begin{tikzpicture}

% Drawing Grid Lines


\draw[help lines] (-1, -1) grid (1,
1);

% Drawing a Path
\draw (0, 0) - - (1, 0) -- (1, 1) --
(0, 1) -- (-1, 1) -- (-1, 0) --
(-1, -1);

\end{tikzpicture}

Drawing the same path using |:


\centering
\begin{tikzpicture}
\draw[help lines] (-1, -1) grid (1,
1);

% Drawing Same Path


\draw (0, 0) -| (1, 1) -| (-1, -1);

\end{tikzpicture}

10.2 Points
\centering
\begin{tikzpicture}

% Drawing Grid Lines


\draw[help lines] (-1, -1) grid (1,
1);

% Drawing a Path
\draw (0, 0) -| (1, 1) -| (-1, -1);

% Starting & Ending Points


\filldraw (0,0) circle (2pt);
\filldraw (-1, -1) circle (2pt);

\end{tikzpicture}

10.3 Curved Lines


87
Drawing

\centering
\begin{tikzpicture}
\draw[help lines] (-1, -1) grid (1,
1);

% Drawing a Parabola
\draw (0, 0) parabola (1, 1);

% Drawing a Curved Line


\draw (-1, -1) .. controls (-0.5, 0)
and (0.5, 0) .. (1, -1);

\end{tikzpicture}

(-1, -1) and (1, -1) are the start and end points, respectively. (-0.5, 0) and
(0.5, 0) act like magnets. Make sure there is no whitespace between the 2 periods
before and after controls.

10.4 Shapes
A circle centered at the origin of radius 1:

\centering
\begin{tikzpicture}
\draw (0, 0) circle (1);
\end{tikzpicture}

A triangle:
\centering
\begin{tikzpicture}
\draw (0, 0) -- (1, 0) -- (1, 1) --
cycle;
\end{tikzpicture}

A rectangle:

\centering
\begin{tikzpicture}
\draw (0, 0) rectangle (1, 2);
\end{tikzpicture}

A square:

88
Drawing

\centering
\begin{tikzpicture}
\draw (0, 0) rectangle (2, 2);
\end{tikzpicture}

An ellipse centered at the origin with x and y-direction radii of 1 and 0.5:
\centering
\begin{tikzpicture}
\draw (0, 0) ellipse (1 and 0.5);
\end{tikzpicture}

An arc of radius 1 from 0 to 90 degrees:


\centering
\begin{tikzpicture}
\draw (0, 0) arc (0:90:1);
\end{tikzpicture}

10.5 Scaling
Scaling a drawing by a factor of 2:

\centering
\begin{tikzpicture}[scale=2]
\draw[help lines] (-1, -1) grid (1,
1);
\draw (0, 0) circle (1);
\end{tikzpicture}

Scaling across the x-dimension:


\centering
\begin{tikzpicture}[xscale=2]
\draw[help lines] (-1, -1) grid (1,
1);
\draw (0, 0) circle (1);
\end{tikzpicture}

Scaling across the x and y-dimensions:

89
Drawing

\centering
\begin{tikzpicture}[xscale=0.5,
yscale=2]
\draw[help lines] (-1, -1) grid (1,
1);
\draw (0, 0) circle (1);
\end{tikzpicture}

10.6 Decorating Lines


10.6.1 Arrows
\centering
\begin{tikzpicture}
\draw [->] (0, 0) -- (0, 1);
\draw [<-] (1, 0) -- (1, 1);
\draw [<-|] (2, 0) -- (2, 1);
\draw [<->] (3, 0) -- (3, 1);
\end{tikzpicture}

10.6.2 Line Thickness


\centering
\begin{tikzpicture}

% Pre-defined Thickness %
\draw [ultra thick] (0, 0) -- (0, 1);
\draw [thick] (1, 0) -- (1, 1);
\draw [thin] (2, 0) -- (2, 1);
\draw [very thin] (3, 0) -- (3, 1);

% Custom Thickness %
\draw [line width=3pt] (4, 0) -- (4,
1);

\end{tikzpicture}

10.6.3 Line Styles

90
Drawing

\centering
\begin{tikzpicture}
\draw [dashed, ultra thick] (0, 0)
-- (0, 1);
\draw [dashed, thick] (1, 0) -- (1,
1);
\draw [dotted] (2, 0) -- (2, 1);
\end{tikzpicture}

10.6.4 Line Color


\centering
\begin{tikzpicture}
\draw [red, dashed, ultra thick] (0,
0) -- (0, 1);
\draw [blue, dashed, thick] (1, 0)
-- (1, 1);
\draw [magenta] (2, 0) -- (2, 1);
\end{tikzpicture}

Refer to 4.7 to use different colours.

10.6.5 Grid Lines


Custom grid lines:
\centering
\begin{tikzpicture}
\draw[step=1, blue, thin] (-1, -1)
grid (1, 1);
\end{tikzpicture}

Removing outer border:

\centering
\begin{tikzpicture}
\draw[step=1, blue, thin] (-1.9,
-1.9) grid (1.9, 1.9);
\end{tikzpicture}

91
Drawing

10.7 Repetition
If you need to reuse lines of code to draw similar things, use \foreach.
\centering
\begin{tikzpicture}

% Vertical or Horizontal Parallel


Lines?
\foreach \x in {0,...,100} {
\draw [red, dashed, ultra thin] (\x
* 0.015, 0) -- (\x * 0.015, 1);
};

\end{tikzpicture}

You don’t need to enter math mode to do math with \x.

Helpful Resources
I have only scratched the surface of TikZ, so please use these resources, especially if
you want to create art.

1. My Favorite TikZ Manual - learn TikZ visually.

2. Minimal Introduction TiKZ - a very minimal introduction to TikZ.

3. Another TikZ Manual - a comprehensive guide for TikZ.

4. Examples - learn TikZ through examples.

5. STEM-related Drawings - STEM-related TikZ drawings and their code.

92
Chapter 11

Extending LATEX

11.1 Physics
Physics has a lot of diagrams, so TikZ is important. The rest is basically math1 . Refer
to resource 5 in 10.7.

11.1.1 Circuits
My favorite physics-related package is circuitikz.

\centering
\begin{circuitikz}
\draw (0,0) to [lamp] (4,0);
\draw (4,0) to (4, -2);
\draw (4, -2) to [battery] (0, -2);
\draw (0, -2) to [fuse] (0, 0);
\end{circuitikz}

More information can be found here.

11.2 Chemistry
11.2.1 Basics
Load the mhchem package and use \ce in math mode to write formulae.

1
Open to debate.

93
Extending LATEX

$\ce{H2O}$ \\ H2 O
$\ce{Cl-}$ \\ Cl−
$\ce{CrO4^{2}-}$ \\ CrO4 2−
$\ce{(C3H4O2)2}$ (C3 H4 O2 )2

Add the amount before the formula.

$\ce{2O2}$ \\ 2 O2
3
$\ce{3/4Cl2}$
4
Cl2

Displaying isotopes:
14
$\ce{^{14}_{6}C}$ \\ 6C
$\ce{^{17}_{6}C+}$ 17 +
6C

11.2.2 Reactions

$\ce{H2 + O -> H2O}$ \\ H2 + O −−→ H2 O


heat
$\ce{H2 + O ->[\text{heat}] H2O}$ \\ H2 + O −−→ H2 O
$\ce{H2 + O <- H2O}$ \\ H2 + O ←−− H2 O
$\ce{CO2 + C <=> 2CO}$
CO2 + C −↽−−⇀− 2 CO

More information on mhchem can be found here.

11.2.3 Drawing Chemical Formulae


Load the chemfig package and use \chemfig.

Bonds

O H
$\chemfig{O - H}$ \\
$\chemfig{O = H}$ \\
O H
$\chemfig{O ~ H}$ \\ O H
$\chemfig{O > H}$ \\ O H
$\chemfig{O >: H}$ \\ O H
$\chemfig{O >| H}$ \\ O H
$\chemfig{O < H}$ \\
$\chemfig{O <: H}$ \\
O H
$\chemfig{O <| H}$ O H
O H

94
Extending LATEX

Bond Angles

Water (H2 O)
\centering
Water ($\ce{H2O}$) \vspace{.5cm} \\ O
\chemfig{H-[1] O-[7] H} \\
H H

[x] represents (x ∗ 45)◦ .

A more complex example:


H
O
\centering
\chemfig{H-C(-[2] H)(-[6] H)-C(=[1] H C C
O)-[7] H}
H
H

Rings
C
C C
\centering
\chemfig{C*6(-C=C-C=C-C=)}
C C
C

C is the first atom. *6 is the number of atoms. () contains the rest of the atoms.

More information on chemfig can be found here.

11.3 Poetry
Use the verse package.
\centering
\begin{verse}
Roses are Red, \\ Roses are Red,
Violets are Blue, \\ Violets are Blue,
This guide with help you. This guide with help you.
\end{verse}

95
Extending LATEX

More information can be found here.

11.4 Programming Languages


You may need to type out programming languages in LATEX.

11.4.1 verbatim environment


The verbatim environment outputs text or code in monospace font.
\begin{verbatim}
def add(x, y): def add(x, y):
return x + y return x + y
\end{verbatim}

To type code inline, use \verb.


\verb|add()| returns the sum of 2
numbers. add() returns the sum of 2 numbers.

There should be no space between \verb and |. Any character except a letter or *
can be used instead of | as a delimiter.

11.4.2 listings package


For more customization, use the listings package and the lstlisting environ-
ment. For example,
\begin{lstlisting}[language=Python, caption=Python Example]
def add(x, y):
return x + y
\end{lstlisting}

produces

Listing 11.1: Python Example


def add ( x , y ) :
i f x >= y :
print (x)
else :
print (y)
return x + y

96
Extending LATEX

You can also highlight code, add line numbers, and do many more things. Read this guide for more
information.

Code highlighting can also be done via the minted package. Read about it here. Warning: minted
can cause errors. However, solutions to the most common errors can be found here.

11.5 PDF Forms


Use the Form environment.

\begin{Form}[action={path/to/submit}]
\begin{tabular}{l}
\TextField{Name} \\\\
Name
\CheckBox[width=1em]{Male}
\CheckBox[width=1em]{Female}
\CheckBox[width=1em]{Other} \\\\ Male Female Other
\Submit{Submit} \quad
\Reset{Reset}\\ Submit Reset
\end{tabular}
\end{Form}

More information can be found here. A more thorough example can be found here. Warning:
making PDF forms in LATEX can be buggy, so it’s probably better to use Adobe Acrobat.

11.6 Emojis
11.6.1 Using LuaLATEX
Use \emoji provided by the emoji package with the LuaLATEXcompiler as follows:
% Preamble
\usepackage{emoji}

% Body
\emoji{flexed-biceps-medium-dark-skin-tone}

A list of emojis provided by the emoji package can be found here.

11.6.2 Using XƎLATEX


If you need to use the XƎLATEXcompiler, download the Symbola font on your local PC and do the
following:

I am {\fontspec{Symbola}\char"1F600}! I am 😀!

97
Extending LATEX

Here is a list of emoji codes.

11.6.3 Using Images


Another option is to insert emojis at images. Read this article for more details.

11.7 Writing a CV
If you want to write your CV with LATEX, choose one of the templates and edit accordingly. I have
also uploaded a template on GitHub.

11.8 Writing a Thesis


If you don’t know how to write a thesis, read this guide. If you want to write your thesis with LATEX,
choose one of the templates and edit accordingly. If you want a video walkthrough, these are the
best videos I have come across.

11.9 Presentations
beamer is the document class for presentations. I learnt beamer using Overleaf’s tutorials. You can
find examples of aesthetically pleasing presentations here. A list of beamer themes can be found
here.

98
Chapter 12

Clever Tricks

Here is a list of LATEX hacks:

1. \today - prints today’s date (December 23, 2021).


2. \TeX - prints TEX.
3. \LaTeX - prints LATEX.
4. Negations - place n or \not before a math symbol command to get its negation: \in prints
∈ and \not\in prints 6∈ (doesn’t always work).
5. One Bracket
 - use \left. (or \right.) if you only need 1 delimiter: \left.\frac{1}{2}\right)
yields 12 .

99
Chapter 13

Common Errors

1. Too few braces - \section{I am missing a closing brace!


2. Too many braces - \section{I have an extra brace}}
3. Non-matching braces - \section[My braces don't match}
4. Missing environment end - \begin{enumerate} \item Don't forget to add \end{enumerate}
5. hbox errors - read this.
6. Forgetting to use \ to escape - $ does not print $.
7. Forgetting to use math mode - a^2 + b^2 = c^2 will cause an error, but $a^2 + b^2 = c^2$
will not (remember to place mathematical symbols, expressions, and statements in math
mode).
8. \\ error - if you get a “There’s no line here to end” error, try $\\$.
9. URL error - if you can’t open a URL, try adding http:// or https://
10. Compiler error - If you use external packages and get an error, you may be using the wrong
compiler: e.g. fontspec needs XƎLATEX or LuaLATEX.
11. Footnote / Index / References / Labels / Links not showing - recompile the document
multiple times to typeset successfully.
12. Declaring packages in wrong order - declare the hyperref package last (as it causes most
of the issues). A more comprehensive list of package conflicts can be found here.

100
Chapter 14

More Resources

As LATEX is open-source, resources are infinite. Popular resources include:

1. Big Resources
• Search Engine - Google.
• CTAN - LATEX’s humble abode.
• Stack Exchange - ask questions.
• LATEX Forum - ask questions.
• LATEX Subreddit - for reddit fans.
2. Learn LATEX
• Overleaf - learn and write LATEX online (highly recommended).
• Wikibooks - a more comprehensive LATEX online guide (highly recommended).
• LATEX Playlist - learn LATEX on YouTube.
• Dr Trefor Bazett - learn LATEX from a mathematician.
• The Art of LATEX - book to learn LATEX.
• The Not So Short Introduction to LATEX - Bible of LATEX.
• LATEX Gallery - LATEX templates (highly recommended).
3. Cheat Sheets
• LATEX Cheat Sheet - 2-page cheat sheet.
• LATEX Math Cheat Sheet - Math cheat sheet.
• LATEX Quick Guide - 2-page guide.
4. Some Pretty Cool Stuff
• Mathpix Snip Notes - convert images and pdf documents to LATEX.

101
More Resources

• LATEX + Vim - writing LATEX in Vim.


• LATEX + Notion - writing LATEX in Notion.
• logicpuzzle - create puzzles (sudoku, battleship etc.) with LATEX.
• For Coffee Lovers - place coffee stains on LATEX documents.
• Even more resources - an awesome list of LATEX resources.

102
Index

Symbols \angle, 55
♣, 14 antiderivatives, 60
÷, 14 appendix, 83
\#, 65 \approx, 46
\$, 13, 34 approximately equal, 46
\%, 13, 15 Arabic, 24
©, 14 arc, 89
\\, 13, 15, 17, 76, 77, 100 arccos, 56
\\∗, 17 \arccos, 56
\{, 47, 52 arcsin, 56
\}, 47, 52 \arcsin, 56
arctan, 56
A \arctan, 56
A4 paper, 11 arithmetic, 44
A5 paper, 11 arrows, 49, 90
absolute value, 45 art, 86
abstract, 82 \article, 11
abstract algebra, 63 aside, 40
accents, 19 \ast, 50, 54
acknowledgements, 83 asterisk, 50
addition, 44 atoms, 94
\aleph, 44 \author, 12
algebra, 43, 45, 53, 63
algebraic closure, 64 B
algebraic numbers, 51 background, 33
align, 19 \backsim, 63
align center, 20 bar, 50
align equations, 38 \bar, 50
align left, 20 \baselineskip, 29
align right, 20 \beamer, 11
\alpha, 44 because, 53
American Mathematical Society, 34 \because, 53
analysis, 61 \begin, 11, 12
and, 53 Bengali, 24
angle, 56 \beta, 44

103
INDEX

\beth, 44 \checkmark, 50
BibTEX, 83 \chemfig, 94
bibliography, 83 chemical reactions, 94
\bibliography, 83 chemistry, 93
\Big, 48 \chi, 44
\big, 48 Chinese, 28
big O notation, 63 \circ, 54, 55, 72
big Omega, 63 circle, 88
big Theta, 63 circuits, 93
\bigcap, 52 \cite, 83
\bigcup, 52 \cline, 78
\Bigg, 48 closed integral, 61
\bigg, 48 closed interval, 54
bijection, 54 \clubsuit, 14
\binom, 65 coalescing words, 17
blackboard bold, 36 colon, 54
bold, 21, 36 \colon, 54
\boldsymbol, 66 color, 20, 73, 91
bonds, 94 \color, 20
\book, 11 \colorbox, 20
Bookman, 23 column vectors, 68
boolean numbers, 51 combination, 65
\bot, 53 combinatorics, 65
bottom, 53 comma separated list, 48
bow-tie, 50 commands, 12, 14
\bowtie, 50 \Bigg, 48
brackets, 47 \Big, 48
braket, 52 \Delta, 44, 61
bullet, 50 \Downarrow, 49
\bullet, 50 \Gamma, 44
\LaTeX, 99
C \Lambda, 44
calculus, 58 \Leftarrow, 49
caligraphic letters, 36 \Longleftarrow, 49, 53
\cap, 52 \Longrightarrow, 49, 53
\cdot, 44, 48, 61, 71, 72 \Omega, 44, 63
\ce, 93 \Phi, 44
ceiling, 47 \Pi, 44
center, 13, 20 \Rightarrow, 49
center text, 13 \Sigma, 44
centered dots, 48 \TeX, 99
\cfrac, 64 \Theta, 44, 63
\chapter, 15 \Uparrow, 49
chapter name, 32 \Updownarrow, 49
chapter number, 32 \Upsilon, 44
\chaptername, 32 \#, 65
characters, 13, 19 \$, 13, 34

104
INDEX

\%, 13, 15 \colon, 54


\\∗, 17 \colorbox, 20
\\, 13, 15, 17, 76, 77, 100 \color, 20
\{, 47, 52 \cong, 55
\}, 47, 52 \copyright, 14
\aleph, 44 \cosh, 56
\alpha, 44 \cos, 56
\angle, 55 \cot, 56
\approx, 46 \csc, 56
\arccos, 56 \cup, 52
\arcsin, 56 \dagger, 50
\arctan, 56 \daleth, 44
\article, 11 \date, 12
\ast, 50, 54 \dbinom, 65
\author, 12 \ddots, 48
\backsim, 63 \ddot, 50
\bar, 50 \dee, 58
\baselineskip, 29 \degree, 72
\beamer, 11 \delta, 44
\because, 53 \det, 70, 72
\begin, 11, 12 \dfrac, 42
\beta, 44 \dim, 72
\beth, 44 \displaystyle, 72
\bibliography, 83 \div, 14, 44
\bigcap, 52 \documentclass, 11, 12
\bigcup, 52 \dotsb, 48
\bigg, 48 \dotsc, 48
\big, 48 \dotsm, 48
\binom, 65 \dotso, 48
\boldsymbol, 66 \dot, 50
\book, 11 \downarrow, 49
\bot, 53 \ell, 50
\bowtie, 50 \emoji, 97
\bullet, 50 \emph, 21
\cap, 52 \emptyset, 51
\cdot, 44, 48, 61, 71, 72 \end, 11, 12
\ce, 93 \epsilon, 44
\cfrac, 64 \eqref, 37
\chaptername, 32 \equiv, 53, 64
\chapter, 15 \eta, 44
\checkmark, 50 \exists , 53
\chemfig, 94 \exists, 53
\chi, 44 \fbox, 17
\circ, 54, 55, 72 \footnotesize, 21
\cite, 83 \footnote, 15
\cline, 78 \for all, 53
\clubsuit, 14 \foreach, 92

105
INDEX

\frac, 42 \limsup, 62
\frenchspacing, 18 \lim, 62
\gamma, 44 \linespread, 29
\gcd, 64 \listoffigures, 82
\geqslant, 46 \listoftables, 82
\geq, 46 \llcorner, 47
\gets, 49 \ll, 46
\gg, 46 \ln, 45
\gimel, 44 \log, 42, 45
\hat, 50, 54, 66, 71 \longleftarrow, 49
\hline, 77 \longmapsto, 49
\href, 85 \longrightarrow, 49
\idotsint, 61 \lor, 53
\iff, 49, 53 \lowercase, 21
\iiint, 61 \lrcorner, 47
\iint, 61 \maketitle, 12
\implies, 53 \mapsto, 49, 54
\includegraphics, 81 \markboth, 31
\indent, 30 \markright, 31
\infty, 53, 54 \mathbb, 36, 51
\inf, 63 \mathbf, 36, 52
\int, 60 \mathcal, 36, 51, 63
\in, 52, 99 \mathfrak, 36
\iota, 44 \mathit, 36
\item, 100 \mathrm, 36, 72
\kappa, 44 \mathtt, 36
\ker, 72 \max, 63
\label, 15, 37 \mbox, 17
\lambda, 44 \measuredangle, 55
\land, 53 \mid, 64, 65
\langle, 47, 64, 71, 72 \min, 63
\LARGE, 21 \mod, 64
\Large, 12, 21 \mp, 45
\large, 12, 21 \multicolumn, 78, 79
\lceil, 47 \multirow, 79
\ldots, 18, 48, 65 \mu, 44
\leadsto, 49 \nLeftarrow, 49
\left., 99 \nRightarrow, 49
\leftarrow, 49 \nabla, 61
\leftmark, 32 \ncong, 55
\leftrightarrow, 49 \neg, 53
\left, 47, 65, 69 \neq, 46
\leqslant, 46 \newline, 15, 17
\leq, 46, 64 \newpage, 17
\lfloor, 47 \nexists, 53
\liminf, 62 \nleftarrow, 49
\limits, 57 \nleftrightarrow, 49

106
INDEX

\nmid, 64 \rightarrowtail, 54
\noindent, 30 \rightarrow, 49, 54
\nolimits, 57 \rightmark, 32
\normalsize, 21 \right, 47, 65, 69
\notin, 52 \rmdefault, 22
\not, 52, 55, 64, 99 \rtimes, 64
\nparallel, 55 \scriptscriptstyle, 73
\nrightarrow, 49 \scriptsize, 21
\nsim, 55 \scriptstyle, 73
\nsubseteq, 52 \section, 14
\nu, 44 \sec, 56
\oint, 61 \setcounter, 33
\omega, 44, 63 \setlength, 29, 30
\oplus, 53, 72 \setminus, 52
\otimes, 71, 72 \sfdefault, 22
\overbrace, 50 \sigma, 44, 65
\overleftrightarrow, 55 \simeq, 64
\overline, 52, 55, 64, 66 \sim, 50, 53, 55, 63, 65
\overrightarrow, 55 \sinh, 56
\pagenumbering, 32 \sin, 56
\pageref, 15 \small, 21
\pagestyles, 31 \sqcup, 52
\paragraph, 14 \sqrt, 42, 45
\parallel, 55 \square, 55, 61
\parindent, 30 \star, 50
\parskip, 30 \subsection, 14
\partial, 58 \subseteq, 52
\part, 15 \subsetneq, 52
\par, 29 \subset, 52
\perp, 55, 72 \substack, 57, 62
\phantom, 37 \subsubsection, 14
\phi, 42, 44, 64 \supseteq, 52
\pi, 42, 44 \supset, 52
\pmod, 64 \sup, 63
\pm, 45 \surd, 50
\proc, 11 \tableofcontents, 30, 82
\prod, 58 \tag, 37
\propto, 46 \tanh, 56
\psi, 44 \tan, 56
\p, 78 \tau, 44
\rangle, 47, 64, 71, 72 \tbinom, 65
\rceil, 47 \textbf, 21
\ref, 15 \textcolor, 20
\report, 11 \textit, 21
\rfloor, 47 \textrm, 22
\rho, 44, 65 \textsc, 21
\right., 99 \textsf, 22

107
INDEX

\textsl, 21 comments, 15
\textstyle, 72 commutator, 64
\texttt, 22 comparison symbols, 46
\text, 35, 39, 54 compilation, 10
\tfrac, 42 compiler, 22
\thechapter, 32 complement, 52
\thepage, 32 complex numbers, 43, 51
\therefore, 53 composition, 54
\thesection, 32 Computer Modern, 21
\theta, 44 computer science, 96
\tikz, 86 conditional probability, 65
\tilde, 50 \cong, 55
\times, 44, 52, 61, 64, 71, 72 congruence, 64
\tiny, 54 congruent, 56
\tiny, 21 conjugate transpose, 72
\title, 12 contained in, 52
\today, 99 contains, 52
\top, 53 continued fractions, 64
\to, 49, 54 \copyright, 14
\triangle, 52, 55 corners, 47
\ttdefault, 22 corollary, 40
\twoheadrightarrow, 54 correlation, 65
\ulcorner, 47 \cos, 56
\underbrace, 50 cosecant, 56
\underline, 21 cosh, 56
\uparrow, 49 \cosh, 56
\updownarrow, 49 cosine, 56
\uppercase, 21 \cot, 56
\upsilon, 44 cotangent, 56
\urcorner, 47 cross product, 71
\url, 85 CS, 96
\usepackage, 11 \csc, 56
\varepsilon, 44 cube root, 45
\varnothing, 51 \cup, 52
\varphi, 44 curl, 61
\vartriangleleft, 64 curly brackets, 47
\vdots, 48 curly l, 50
\vec, 66 curve integral, 61
\verb, 96 curved lines, 87
\widehat, 50 CV, 98
\widetilde, 50
\wr, 64 D
\xhookrightarrow{}, 54 D’Alembert operator, 61
\xi, 44 dagger, 50
\xrightarrow, 54 \dagger, 50
\zeta, 44 \daleth, 44
comment, 13 dashed lines, 90

108
INDEX

dashes, 18 \dotsc, 48
\date, 12 \dotsm, 48
\dbinom, 65 \dotso, 48
\ddot, 50 dotted lines, 90
\ddots, 48 double bars, 47
declarations, 12 double factorial, 65
decorating lines, 90 double integral, 61
decorations, 50 down arrow, 49
\dee, 58 \Downarrow, 49
definition, 40 \downarrow, 49
\degree, 72 drawing, 86
degrees, 56 dual space, 72
delimiters, 47 dyadic product, 71
\Delta, 44, 61
\delta, 44 E
derangement, 65 electricity, 93
derivative, 50 element, 52
derivatives, 58 \ell, 50
\det, 70, 72 ellipse, 89
determinant, 72 ellipsis, 18
determinants, 70 em-dash, 18
\dfrac, 42 \emoji, 97
diacritics, 19 emojis, 97
diagonal dots, 48 \emph, 21
differentials, 60 emphasize, 21
differentiation, 58 empty line, 13
\dim, 72 empty set, 51
dimension, 72 \emptyset, 51
direct product, 64, 72 en-dash, 18
direct sum, 72 \end, 11, 12
discrete mathematics, 64 environments, 12
display mode, 35, 36 abstract, 82
\displaystyle, 72 align, 38
dissertaiton, 98 aligned, 39
\div, 14, 44 Bmatrix, 66
divergence, 61 bmatrix, 66
divide, 14 bsmallmatrix, 69
divides, 64 cases, 55
division, 14, 44 center, 13, 20
document classes, 14 description, 74
\documentclass, 11, 12 displaymath, 35
dollar sign, 13, 34 document, 10
Donald E. Knuth, 8 enumerate, 74
\dot, 50 equation, 36
dot product, 71 equation*, 35
dots, 18, 48 figure, 81
\dotsb, 48 flushleft, 20

109
INDEX

flushright, 20 F
Form, 97 factorial, 45, 65
gather, 38 \fbox, 17
gathered, 38 fences, 47
itemize, 74 field, 64
lstlisting, 96 field extension, 64
math, 34 file, 9
matrix, 66 floor, 47
multline, 38 font, 11
pmatrix, 66 font catalogue, 23
font codes, 23
proof, 41
font families, 21
psmallmatrix, 69
monospace, 21
quotation, 19
sans serif, 21
smallmatrix, 69
serif, 21
split, 39 font sizes, 20
table, 75 \footnotesize, 21
tabular, 75 \LARGE, 21
tikzpicture, 86 \Large, 12, 21
verbatim, 96 \large, 12, 21
Vmatrix, 71 \normalsize, 21
\epsilon, 44 \scriptsize, 21
\eqref, 37 \small, 21
equal, 46 \tiny, 21
equation, 35, 36 font styles, 21
equations, 37 fonts, 20, 36
\equiv, 53, 64 footer, 31
equivalence, 53 \footnote, 15
equivalence classes, 63 footnotes, 15
equivalence relations, 63 \footnotesize, 21
error, 10 for all, 53
escape, 13 \for all, 53
estimator, 66 for loop, 92
\eta, 44 \foreach, 92
forms, 97
Euler’s Number, 42
\frac, 42
Euler’s totient function, 64
fractions, 42, 51
evaluate derivatives, 58
fraktur, 36
example, 40
French, 27
exclusive or, 53 \frenchspacing, 18
exercise, 40 function, 54
exists, 53 functions, 54
\exists, 53
expected value, 65 G
exponentiation, 44 \Gamma, 44
exponents, 46 \gamma, 44
external fonts, 22 gather equations, 38

110
INDEX

\gcd, 64 \iint, 61
generator, 64 images, 80
geometry, 55 imaginary numbers, 43
\geq, 46 implied by, 53
\geqslant, 46 implies, 49, 53
German, 27 \implies, 53
gets, 49 \in, 52, 99
\gets, 49 \includegraphics, 81
\gg, 46 \indent, 30
\gimel, 44 indentation, 30
global font, 21, 22 index, 64, 84
Golden Ratio, 42 \inf, 63
gradient, 61 infimum, 62, 63
graphics, 80 infinity, 53
greater than, 46 \infty, 53, 54
greatest common divisor, 64 injection, 54
Greek, 25 inline, 34
Greek Letters, 44 inner product, 71
grid lines, 91 install, 9
group, 64 \int, 60
integers, 42, 51
H integral spacing, 60
Hadamard product, 72 integration, 60
half closed - half open, 54 International Language Support, 24
half open - half closed, 54 Arabic, 24
hat, 50 Bengali, 24
\hat, 50, 54, 66, 71 Chinese, 28
header, 31 French, 27
Hebrew, 25 German, 27
Hebrew Letters, 44 Greek, 25
higher-order derivatives, 58 Hebrew, 25
highlighting, 20 Hindi, 25
Hindi, 25 Japanese, 28
\hline, 77 Resources, 28
homework, 73 Russian, 26
\href, 85 Spanish, 27
hyperbolic functions, 56 Thai, 26
hyperlinks, 84 intersection, 52
hyphens, 18 intervals, 53
inverse cosine, 56
I inverse matrix, 72
\idotsint, 61 inverse sine, 56
if and only if, 53 inverse tangent, 56
if-then, 53 \iota, 44
iff, 49 irrationals, 42, 51
\iff, 49, 53 isomorphism, 64
\iiint, 61 italicize, 21

111
INDEX

italics, 36 less than, 46


\item, 100 Letter paper, 11
\lfloor, 47
J \lim, 62
Japanese, 28 \liminf, 62
justify center, 13, 20 limit inferior, 63
justify left, 20 limit superior, 63
justify right, 20 limits, 62
\limits, 57
K \limsup, 62
\kappa, 44 line, 56
\ker, 72 line breaks, 17
kernel, 72 line color, 91
keyboard shortcuts, 16 line integral, 61
Kronecker product, 72 line spacing, 29
line styles, 90
L linear algebra, 66
\label, 15, 37 linear hull, 72
labelled equation, 36 lines, 86
labelling equations, 37 \linespread, 29
labels, 15 links, 84
\Lambda, 44 list of figures, 82
\lambda, 44 list of tables, 82
\land, 53 \listoffigures, 82
\langle, 47, 64, 71, 72 \listoftables, 82
languages, 24 lists, 74
Laplace operator, 61 little o, 63
\LARGE, 21 \ll, 46
\Large, 12, 21 \llcorner, 47
\large, 12, 21 ln, 45
\LaTeX, 99 \ln, 45
\lceil, 47 local font, 22
\ldots, 18, 48, 65 log, 45
leads, 49 \log, 42, 45
\leadsto, 49 logarithms, 42
\left, 47, 65, 69 logic, 53
left arrow, 49 long equations, 37
\left., 99 \Longleftarrow, 49, 53
\Leftarrow, 49 \longleftarrow, 49
\leftarrow, 49 \longmapsto, 49
\leftmark, 32 \Longrightarrow, 49, 53
\leftrightarrow, 49 \longrightarrow, 49
Legal paper, 11 \lor, 53
lemma, 40 lowercase, 21
\leq, 46, 64 \lowercase, 21
\leqslant, 46 \lrcorner, 47
Leslie Lamport, 8 LuaLATEX, 22

112
INDEX

M multinomial coefficient, 65
\maketitle, 12 multiple integral, 61
map, 54 multiplication, 44, 57, 72
maps, 49, 54 multiplication dots, 48
\mapsto, 49, 54 \multirow, 79
\markboth, 31 multiset, 65
\markright, 31
math environments, 40 N
math fonts, 36 \nabla, 61
math mode, 34 natural log, 45
math spacing, 36 natural numbers, 51
math symbols, 44 \ncong, 55
\mathbb, 36, 51 \neg, 53
\mathbf, 36, 52 negated arrows, 49
\mathcal, 36, 51, 63 negation, 53
\mathfrak, 36 negative infinity, 53
\mathit, 36 \neq, 46
\mathrm, 36, 72 new page, 17
\mathtt, 36 newline, 13, 17
matrices, 68 \newline, 15, 17
matrix inverse, 72 \newpage, 17
matrix multiplication, 72 \nexists, 53
matrix norm, 71, 72 \nLeftarrow, 49
matrix operations, 72 \nleftarrow, 49
\max, 63 \nleftrightarrow, 49
maximum, 63 \nmid, 64
\mbox, 17 \noindent, 30
mean, 66 \nolimits, 57
\measuredangle, 55 norm, 47, 71
member, 52 normal subgroup, 64
Microsoft Word, 9 \normalsize, 21
\mid, 64, 65 not, 53
\min, 63 \not, 52, 55, 64, 99
minimum, 63 not congruent, 56
minus, 44 not equal, 46
minus sign, 18 not parallel, 56
minus-plus, 45 not perpendicular, 56
miscellaneous symbols, 50 not similar, 56
\mod, 64 \notin, 52
modular arithmetic, 64 \nparallel, 55
modulus, 45 \nRightarrow, 49
molecules, 94 \nrightarrow, 49
monospace, 36 \nsim, 55
monospace, 21 \nsubseteq, 52
\mp, 45 nth root, 45
\mu, 44 \nu, 44
\multicolumn, 78, 79 number sets, 51

113
INDEX

numbered equation, 36 \parindent, 30


numbers, 42 \parskip, 30
\part, 15
O \partial, 58
octonions, 51 partial derivatives, 58
\oint, 61 PC fonts, 22
\Omega, 44, 63 PDF, 10
\omega, 44, 63 pdf forms, 97
only if, 53 percent sign, 13, 15
open interval, 54 permanent font, 21
\oplus, 53, 72 permanent indentation, 30
or, 53 permutation, 65
ordinary derivatives, 58 \perp, 55, 72
organization, 14 perpendicular, 56
orthogonal complement , 72 \phantom, 37
other fonts, 22 PhD, 98
other languages, 24 \Phi, 44
other letters, 44 \phi, 42, 44, 64
\otimes, 71, 72 physics, 93
over-brace, 50
Pi, 42
\overbrace, 50
\Pi, 44
\overleftrightarrow, 55
\pi, 42, 44
\overline, 52, 55, 64, 66
piecewise function, 55
\overrightarrow, 55
plus-minus, 45
P \pm, 45
\p, 78 \pmod, 64
page background, 33 poems, 95
page breaks, 17 points, 87
page elements, 31 power, 44
page margin, 33 power set, 51
page number, 32 preamble, 11
page numbers, 32 presentations, 98
page size, 33 prime, 50
\pagenumbering, 32 prime numbers, 51
\pageref, 15 primorial, 65
\pagestyles, 31 probability, 65
\par, 29 probability distribution, 65
paragraph, 13 \proc, 11
\paragraph, 14 \prod, 58
paragraph indentation, 30 product, 44, 57
paragraph shape, 30 programming languages, 96
paragraph spacing, 30 proofs, 41
paragraphs, 30 proposition, 40
parallel, 56 \propto, 46
\parallel, 55 \psi, 44
parentheses, 47 punctuation, 18

114
INDEX

Q \section, 14
quadruple integral, 61 section name, 32
quaternions, 51 section number, 32
quotation marks, 18 sectioning commands, 14
quotations, 11, 19 sections, 14
quotient space, 72 sedenions, 51
segment, 56
R semi-direct product, 64
\rangle, 47, 64, 71, 72 sequences, 61
rationals, 42, 51 serif, 21
ray, 56 set complement, 52
\rceil, 47 set difference, 52
reals, 42, 51, 54 set notation, 52
rectangle, 88 set theory, 50
\ref, 15 \setcounter, 33
references, 15, 83 \setlength, 29, 30
remark, 40 \setminus, 52
repetition, 92 sets, 51
\report, 11 \sfdefault, 22
reserved characters, 13 shapes, 88
resources, 14, 28, 33, 73, 80, 92 shaping paragraphs, 30
resume, 98 \Sigma, 44
\rfloor, 47 \sigma, 44, 65
\rho, 44, 65 \sim, 50, 53, 55, 63, 65
\right, 47, 65, 69 \simeq, 64
right arrow, 49 similar, 56
\right., 99 \sin, 56
\Rightarrow, 49 sine, 56
\rightarrow, 49, 54 sinh, 56
\rightarrowtail, 54 \sinh, 56
\rightmark, 32 size, 15, 20
rings, 95 slanted, 21
\rmdefault, 22 \small, 21
round brackets, 47 small o, 63
row vectors, 67 small omega, 63
\rtimes, 64 smallcaps, 21
Russian, 26 space, 15
spaces, 13
S spacing, 30, 36
sans serif, 21 spacing in integral, 60
scaling, 89 Spanish, 27
\scriptscriptstyle, 73 special characters, 13, 19
\scriptsize, 21 \sqcup, 52
\scriptstyle, 73 \sqrt, 42, 45
\sec, 56 square, 56, 88
secant, 56 \square, 55, 61
second derivative, 50 square brackets, 47

115
INDEX

square root, 45 temporary font, 22


square roots, 42 temporary indentation, 30
standard deviation, 65 tensor product, 72
star, 50 \TeX, 99
\star, 50 \text, 35, 39, 54
start, 10 text in math mode, 35
statistics, 65, 66 text mode, 34
stochastics, 65 text-align, 19
strikethrough, 21 text-color, 20
subgroup, 64 text-highlight, 20
subscripts, 46 \textbf, 21
\subsection, 14 \textcolor, 20
subset, 52 \textit, 21
\subset, 52 \textrm, 22
\subseteq, 52 \textsc, 21
\subsetneq, 52 \textsf, 22
\substack, 57, 62 \textsl, 21
\subsubsection, 14 \textstyle, 72
subtraction, 44 \texttt, 22
summary, 82 \tfrac, 42
sums, 56 Thai, 26
\sup, 63 thanks, 83
superscripts, 44, 46 \thechapter, 32
superset, 52 theorem, 40
supremum, 62, 63 \thepage, 32
\supset, 52 therefore, 53
\supseteq, 52 \therefore, 53
surd, 50 \thesection, 32
\surd, 50 thesis, 11, 98
surface integral, 61 \Theta, 44, 63
surjection, 54 \theta, 44
symbol, 19 thick arrows, 49
symbols, 14, 44 thickness, 90
tick, 50
T \tikz, 86
table of contents, 82 tilde, 50
table spacing, 80 \tilde, 50
\tableofcontents, 30, 82 times, 44
Tables, 75 \times, 44, 52, 61, 64, 71, 72
tabs, 13 \tiny, 21, 54
\tag, 37 \title, 12
\tan, 56 \to, 49, 54
tangent, 56 \today, 99
tanh, 56 top, 53
\tanh, 56 \top, 53
\tau, 44 totient function, 64
\tbinom, 65 trace, 72

116
INDEX

transpose, 72 \url, 85
triangle, 56, 88 \usepackage, 11
\triangle, 52, 55
trigonometry, 56 V
triple integral, 61 \varepsilon, 44
triple product, 71 variables, 43
troubleshooting, 10 variance, 65
\ttdefault, 22 \varnothing, 51
\twoheadrightarrow, 54 \varphi, 44
typeface, 21 \vartriangleleft, 64
typefaces, 21 \vdots, 48
typesetting, 10 \vec, 66
typewriter, 36 vector calculus, 61, 71
typewriter, 21 vector spaces, 72
vectors, 66
U \verb, 96
\ulcorner, 47 vertical dots, 48
unbreakable space, 13 volume integral, 61
under-brace, 50
\underbrace, 50 W
underline, 21 whole numbers, 42, 51
\underline, 21 \widehat, 50
union, 52 \widetilde, 50
unit vector, 71 word processor fonts, 22
unlabelled equation, 35 \wr, 64
unnumbered equation, 35 Wreath product, 64
up arrow, 49
\Uparrow, 49 X
\uparrow, 49 XƎLATEX, 22, 24–28
\Updownarrow, 49 \xhookrightarrow{}, 54
\updownarrow, 49 \xi, 44
uppercase, 21 xor, 53
\uppercase, 21 \xrightarrow, 54
\Upsilon, 44
\upsilon, 44 Z
\urcorner, 47 \zeta, 44

117

You might also like