Fixed formatting, added example of command structure

This commit is contained in:
Bjornar Orjansen Kaarevik 2025-02-14 00:34:40 +01:00
parent 974e5033ea
commit c5ea027d17

View File

@ -2,8 +2,8 @@
## What even is \LaTeX?
- 1978: Donald Knuth gets fed up by typographical errors in his documents and creates TeX
- 1984: Leslie Lamport gets fed up with having to write bonkers TeX-commands and piles on a bunch of macros
- 1978: Donald Knuth gets fed up by typographical errors in his documents and creates \TeX
- 1984: Leslie Lamport gets fed up with having to write bonkers \TeX\ -commands and piles on a bunch of macros
- 2025: We're here, still stuck with this ancient crap
But actually, it is a pretty good **document preparation system**.
@ -83,8 +83,22 @@ Here you might stick:
- Setup for packages used in the document
- Directives for the presentation of the types of content in the document
\vspace{2em}
> Tip: Make you preamble self-contained and portable
## Basic structure of a \LaTeX\ command
```latex
\commandname[optionalarguments]{requriedarguments}
```
Examples:
- `\usepackage[paper=a4paper]{geometry}`
<!--- `\Delta` (produces the symbol: \(\Delta\) )-->
- `\emph{Hello!}`
## Part 1: Content
Since content and presentation is mostly separate:
@ -101,9 +115,9 @@ Types of environments:
Usually specified in the text with:
```latex
\begin{content-type}
\begin{contenttype}
... what you write goes here
\end{content-type}
\end{contenttype}
```
## Normal text: headings, paragraphs, lists
@ -118,7 +132,9 @@ Usually specified in the text with:
- `enumerate`: numbered list
- Can be nested
> Tip: For better version control, stick to *one sentence, one line*
\vspace{2em}
> Tip: For better version control, stick to **one sentence, one line**
## MATH
@ -128,9 +144,11 @@ Usually specified in the text with:
- `\(...\)`: inline math
- `\[...\]`: basically like `equation`
We're talking inline \(F = ma\) versus full display:
We're talking inline $F = ma$ versus full display:
\[E = mc^2\].
$$
E = mc^2.
$$
## Figures and tables
@ -163,12 +181,12 @@ We're talking inline \(F = ma\) versus full display:
## Part 2: Presentation
> I used to fight all the time with my typesetter about where
> the images should be placed. Now I use \LaTeX and have accepted
> the images should be placed. Now I use \LaTeX\ and have accepted
> that I'll never win.
. . .
The \TeX typesetting engine is really powerful and will probably make
The \TeX \ typesetting engine is really powerful and will probably make
better choices than you.
## Linebreaks and pagebreaks
@ -215,3 +233,11 @@ better choices than you.
- Here, top, bottom and "special page"
- Floats
- They *float around* and cannot be broken up
## Part 3: Custom commands
- `\newcommand`: make a new one!
- `\renewcommand`: change an existing one
Some examples: