Fixed newline disagreement between linux and windows

This commit is contained in:
Bjornar Orjansen Kaarevik 2025-02-14 21:39:46 +01:00
parent 4066c8ba0d
commit ad37f50c33
4 changed files with 590 additions and 590 deletions

606
.gitignore vendored

@ -1,303 +1,303 @@
# ---> TeX
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
*.cb
*.cb2
.*.lb
## Intermediate documents:
*.dvi
*.xdv
*-converted-to.*
# these rules might exclude image files for figures etc.
# *.ps
# *.eps
# *.pdf
## Generated if empty string is given at "Please type another file name for output:"
.pdf
## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
*-blx.aux
*-blx.bib
*.run.xml
## Build tool auxiliary files:
*.fdb_latexmk
*.synctex
*.synctex(busy)
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync
## Build tool directories for auxiliary files
# latexrun
latex.out/
## Auxiliary and intermediate files from other packages:
# algorithms
*.alg
*.loa
# achemso
acs-*.bib
# amsthm
*.thm
# beamer
*.nav
*.pre
*.snm
*.vrb
# changes
*.soc
# comment
*.cut
# cprotect
*.cpt
# elsarticle (documentclass of Elsevier journals)
*.spl
# endnotes
*.ent
# fixme
*.lox
# feynmf/feynmp
*.mf
*.mp
*.t[1-9]
*.t[1-9][0-9]
*.tfm
#(r)(e)ledmac/(r)(e)ledpar
*.end
*.?end
*.[1-9]
*.[1-9][0-9]
*.[1-9][0-9][0-9]
*.[1-9]R
*.[1-9][0-9]R
*.[1-9][0-9][0-9]R
*.eledsec[1-9]
*.eledsec[1-9]R
*.eledsec[1-9][0-9]
*.eledsec[1-9][0-9]R
*.eledsec[1-9][0-9][0-9]
*.eledsec[1-9][0-9][0-9]R
# glossaries
*.acn
*.acr
*.glg
*.glo
*.gls
*.glsdefs
*.lzo
*.lzs
*.slg
*.slo
*.sls
# uncomment this for glossaries-extra (will ignore makeindex's style files!)
# *.ist
# gnuplot
*.gnuplot
*.table
# gnuplottex
*-gnuplottex-*
# gregoriotex
*.gaux
*.glog
*.gtex
# htlatex
*.4ct
*.4tc
*.idv
*.lg
*.trc
*.xref
# hyperref
*.brf
# knitr
*-concordance.tex
# TODO Uncomment the next line if you use knitr and want to ignore its generated tikz files
# *.tikz
*-tikzDictionary
# listings
*.lol
# luatexja-ruby
*.ltjruby
# makeidx
*.idx
*.ilg
*.ind
# minitoc
*.maf
*.mlf
*.mlt
*.mtc[0-9]*
*.slf[0-9]*
*.slt[0-9]*
*.stc[0-9]*
# minted
_minted*
*.pyg
# morewrites
*.mw
# newpax
*.newpax
# nomencl
*.nlg
*.nlo
*.nls
# pax
*.pax
# pdfpcnotes
*.pdfpc
# sagetex
*.sagetex.sage
*.sagetex.py
*.sagetex.scmd
# scrwfile
*.wrt
# svg
svg-inkscape/
# sympy
*.sout
*.sympy
sympy-plots-for-*.tex/
# pdfcomment
*.upa
*.upb
# pythontex
*.pytxcode
pythontex-files-*/
# tcolorbox
*.listing
# thmtools
*.loe
# TikZ & PGF
*.dpth
*.md5
*.auxlock
# titletoc
*.ptc
# todonotes
*.tdo
# vhistory
*.hst
*.ver
# easy-todo
*.lod
# xcolor
*.xcp
# xmpincl
*.xmpi
# xindy
*.xdy
# xypic precompiled matrices and outlines
*.xyc
*.xyd
# endfloat
*.ttt
*.fff
# Latexian
TSWLatexianTemp*
## Editors:
# WinEdt
*.bak
*.sav
# Texpad
.texpadtmp
# LyX
*.lyx~
# Kile
*.backup
# gummi
.*.swp
# KBibTeX
*~[0-9]*
# TeXnicCenter
*.tps
# auto folder when using emacs and auctex
./auto/*
*.el
# expex forward references with \gathertags
*-tags.tex
# standalone packages
*.sta
# Makeindex log files
*.lpz
# xwatermark package
*.xwm
# REVTeX puts footnotes in the bibliography by default, unless the nofootinbib
# option is specified. Footnotes are the stored in a file with suffix Notes.bib.
# Uncomment the next line to have this generated file ignored.
#*Notes.bib
# ---> TeX
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
*.cb
*.cb2
.*.lb
## Intermediate documents:
*.dvi
*.xdv
*-converted-to.*
# these rules might exclude image files for figures etc.
# *.ps
# *.eps
# *.pdf
## Generated if empty string is given at "Please type another file name for output:"
.pdf
## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
*-blx.aux
*-blx.bib
*.run.xml
## Build tool auxiliary files:
*.fdb_latexmk
*.synctex
*.synctex(busy)
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync
## Build tool directories for auxiliary files
# latexrun
latex.out/
## Auxiliary and intermediate files from other packages:
# algorithms
*.alg
*.loa
# achemso
acs-*.bib
# amsthm
*.thm
# beamer
*.nav
*.pre
*.snm
*.vrb
# changes
*.soc
# comment
*.cut
# cprotect
*.cpt
# elsarticle (documentclass of Elsevier journals)
*.spl
# endnotes
*.ent
# fixme
*.lox
# feynmf/feynmp
*.mf
*.mp
*.t[1-9]
*.t[1-9][0-9]
*.tfm
#(r)(e)ledmac/(r)(e)ledpar
*.end
*.?end
*.[1-9]
*.[1-9][0-9]
*.[1-9][0-9][0-9]
*.[1-9]R
*.[1-9][0-9]R
*.[1-9][0-9][0-9]R
*.eledsec[1-9]
*.eledsec[1-9]R
*.eledsec[1-9][0-9]
*.eledsec[1-9][0-9]R
*.eledsec[1-9][0-9][0-9]
*.eledsec[1-9][0-9][0-9]R
# glossaries
*.acn
*.acr
*.glg
*.glo
*.gls
*.glsdefs
*.lzo
*.lzs
*.slg
*.slo
*.sls
# uncomment this for glossaries-extra (will ignore makeindex's style files!)
# *.ist
# gnuplot
*.gnuplot
*.table
# gnuplottex
*-gnuplottex-*
# gregoriotex
*.gaux
*.glog
*.gtex
# htlatex
*.4ct
*.4tc
*.idv
*.lg
*.trc
*.xref
# hyperref
*.brf
# knitr
*-concordance.tex
# TODO Uncomment the next line if you use knitr and want to ignore its generated tikz files
# *.tikz
*-tikzDictionary
# listings
*.lol
# luatexja-ruby
*.ltjruby
# makeidx
*.idx
*.ilg
*.ind
# minitoc
*.maf
*.mlf
*.mlt
*.mtc[0-9]*
*.slf[0-9]*
*.slt[0-9]*
*.stc[0-9]*
# minted
_minted*
*.pyg
# morewrites
*.mw
# newpax
*.newpax
# nomencl
*.nlg
*.nlo
*.nls
# pax
*.pax
# pdfpcnotes
*.pdfpc
# sagetex
*.sagetex.sage
*.sagetex.py
*.sagetex.scmd
# scrwfile
*.wrt
# svg
svg-inkscape/
# sympy
*.sout
*.sympy
sympy-plots-for-*.tex/
# pdfcomment
*.upa
*.upb
# pythontex
*.pytxcode
pythontex-files-*/
# tcolorbox
*.listing
# thmtools
*.loe
# TikZ & PGF
*.dpth
*.md5
*.auxlock
# titletoc
*.ptc
# todonotes
*.tdo
# vhistory
*.hst
*.ver
# easy-todo
*.lod
# xcolor
*.xcp
# xmpincl
*.xmpi
# xindy
*.xdy
# xypic precompiled matrices and outlines
*.xyc
*.xyd
# endfloat
*.ttt
*.fff
# Latexian
TSWLatexianTemp*
## Editors:
# WinEdt
*.bak
*.sav
# Texpad
.texpadtmp
# LyX
*.lyx~
# Kile
*.backup
# gummi
.*.swp
# KBibTeX
*~[0-9]*
# TeXnicCenter
*.tps
# auto folder when using emacs and auctex
./auto/*
*.el
# expex forward references with \gathertags
*-tags.tex
# standalone packages
*.sta
# Makeindex log files
*.lpz
# xwatermark package
*.xwm
# REVTeX puts footnotes in the bibliography by default, unless the nofootinbib
# option is specified. Footnotes are the stored in a file with suffix Notes.bib.
# Uncomment the next line to have this generated file ignored.
#*Notes.bib

18
LICENSE

@ -1,9 +1,9 @@
MIT License
Copyright (c) 2025 bjornoka
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
MIT License
Copyright (c) 2025 bjornoka
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -1,19 +1,19 @@
# latex-course
Presentation and content for the latex course I have held and maybe will hold for PVV.
## Compiling example document
Document found in `example-document/main.tex` can be compiled with the command:
```bash
latexmk -xelatex main.tex
```
## Compiling presentation
The presentation found in `presentation/presentation.md` can be compiled with the command:
```bash
pandoc --to beamer presentation.md -o presentation.pdf --slide-level 2
# latex-course
Presentation and content for the latex course I have held and maybe will hold for PVV.
## Compiling example document
Document found in `example-document/main.tex` can be compiled with the command:
```bash
latexmk -xelatex main.tex
```
## Compiling presentation
The presentation found in `presentation/presentation.md` can be compiled with the command:
```bash
pandoc --to beamer presentation.md -o presentation.pdf --slide-level 2
```

@ -1,260 +1,260 @@
# Introductory Course to \LaTeX
## 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
- 2025: We're here, still stuck with this ancient crap
But actually, it is a pretty good **document preparation system**.
(a modern alternative is *Typst*)
## What even is a document preparation system?
It is a system that prepares your documents!
Crucial elements:
- What are the contents of the document?
- Where should all the words and sentences go?
- What do we do about equations, figures and tables?
- We need references and appendices and other things, right?!?
## First Principle of \LaTeX
> Separate content and presentation.
- General classes/types of content
- Styling applies to the entire document
- Just write, and deal with making it pretty later
- The publisher will mangle your document anyways
## Second Principle of \LaTeX
> Let *the system* handle book keeping.
- Don't manually update captions and figure numbers
- Don't manually update captions and table numbers
- Don't manually write/update/sort your list of references
## Now, how do we use it?
Types of content
- Frontmatter
- Sections, subsections, paragraphs
- Math: both inline and standalone
- Figures and tables
- References (bibliography)
- Appendices
## Document structure
- Preamble
- Frontmatter - title, table of content, list of figures/tables
- (The actual) Document
- Sections/Chapters
- Text
- Math
- Figures
- Tables
- Bibliography
- Appendices
## Document setup
- Type of document: `\documentclass`
- Preamble with `\input`
- Document body with `\begin{document}`
- This is an **environment**
- Frontmatter with `\maketitle`
- Sections with `\input`
- Bibliography with `\bibliography`
- Appendices with `\appendix`
## Part 0: Preamble
Here you might stick:
- `\usepackage`-directives
- Custom commands
- For instance those defined with `\newcommand`
- 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:
- Content type must be specified in the "raw content"
- Presentation will be defined "elsewhere"
## Environments and displays define what you write means
Types of environments:
- Document, math, figure, table, list, quote, bold, italics
Usually specified in the text with:
```latex
\begin{contenttype}
... what you write goes here
\end{contenttype}
```
## Normal text: headings, paragraphs, lists
- Headings
- `\section`, `\subsection`, `\subsubsection`
- Paragraphs
- Just add some line-breaks!
- An empty line signifies the boundary between paragraphs
- Lists
- `itemize`: bullet points
- `enumerate`: numbered list
- Can be nested
\vspace{2em}
> Tip: For better version control, stick to **one sentence, one line**
## MATH
- `equation`: a single line of math
- `gather`: multiple lines of math
- `align`: multiple lines that can be *lined up*
- `\(...\)`: inline math
- `\[...\]`: basically like `equation`
We're talking inline $F = ma$ versus full display:
$$
E = mc^2.
$$
## Figures and tables
- `\begin{figure}`: figure environment
- `\includegraphics`: the graphics to be shown
- `\caption`: text under/over the figure, with number
- `\label`: name to remember the figure by in the raw latex
- `\begin{table}`: table environment
- `\begin{tabular}`: environment for tabulated data
- `\caption`: text over/under table, with number
- `\label`: allows you to refer to the table in the document
## Referencing
- `\usepackage{biblatex}`
- Reference list styling
- Many other options
- Needs a file containing available sources
- Put `\addbibresource` in the preamble
- `\printbibliography`
- Options are available for this one as well
## Appendices
- `\usepackage{appendix}`
- `\appendix`: changes context of the document to "appendices"
- Each `\section` now defines an appendix, not a "chapter"
- Should probably have been an environment, but alas
## 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
> that I'll never win.
. . .
The \TeX \ typesetting engine is really powerful and will probably make
better choices than you.
## Linebreaks and pagebreaks
- Empty line: separates paragraphs
- Depending on settings, this may not produce empty lines in the compiled document
- `\\`: forces linebreak
- Used in tables, matrices and multiline math
- Can *force air* between paragraphs, but be careful
- `\newpage`: forces the rest of the page to be empty
- `\mbox`: forces words to "stay together", no hyphenation
- `~`: non-breaking space
## vspace and hspace
- `\vspace`: vertical spacing
- `\hspace`: horizontal spacing
- Valid lengths are:
- `cm, mm, em, ex, pt, mu, sp`
- ... and some more
- Lengths may be **negative**
## Default/documentwide lengths and widths
- `\parskip`: space when skipping to next paragraph
- `\parindent`: indent space on the first line of a paragraph
- `\baselinestretch`: how tall is a line?
- `\setstretch` and `\itemsep`: line height in itemize/enumerate environments
## MATH - but displaystyle this time
- `\textstyle`: inline math, when using `\(...\)`
- `\displaystyle`: math in *it's own box*
- With `equation`, `gather`, `align` and `\[...\]`
- `\scriptstyle`: when showing in sub/superscript
- `\scriptscriptstyle`: when sub/superscript is nested!
## Figures and tables
- Width, height and angle:
- `[width=\textwidth, height=100mm, angle=45]`
- `[!htbp]`
- 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:
```latex
\newcommand{\R}{\mathbb{R}}
\newcommand{\bb}[1]{\mathbb{#1}}
\newcommand{\un}[1]{\ensuremath{\, \mathrm{#1}}}
```
## Further reading
- Everything on Overleaf.com
- Documentation for packages on CTAN
- StackExchange
\vspace{2em}
> Tip: Keep it simple, stupid!
More packages $\neq$ better document
# Introductory Course to \LaTeX
## 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
- 2025: We're here, still stuck with this ancient crap
But actually, it is a pretty good **document preparation system**.
(a modern alternative is *Typst*)
## What even is a document preparation system?
It is a system that prepares your documents!
Crucial elements:
- What are the contents of the document?
- Where should all the words and sentences go?
- What do we do about equations, figures and tables?
- We need references and appendices and other things, right?!?
## First Principle of \LaTeX
> Separate content and presentation.
- General classes/types of content
- Styling applies to the entire document
- Just write, and deal with making it pretty later
- The publisher will mangle your document anyways
## Second Principle of \LaTeX
> Let *the system* handle book keeping.
- Don't manually update captions and figure numbers
- Don't manually update captions and table numbers
- Don't manually write/update/sort your list of references
## Now, how do we use it?
Types of content
- Frontmatter
- Sections, subsections, paragraphs
- Math: both inline and standalone
- Figures and tables
- References (bibliography)
- Appendices
## Document structure
- Preamble
- Frontmatter - title, table of content, list of figures/tables
- (The actual) Document
- Sections/Chapters
- Text
- Math
- Figures
- Tables
- Bibliography
- Appendices
## Document setup
- Type of document: `\documentclass`
- Preamble with `\input`
- Document body with `\begin{document}`
- This is an **environment**
- Frontmatter with `\maketitle`
- Sections with `\input`
- Bibliography with `\bibliography`
- Appendices with `\appendix`
## Part 0: Preamble
Here you might stick:
- `\usepackage`-directives
- Custom commands
- For instance those defined with `\newcommand`
- 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:
- Content type must be specified in the "raw content"
- Presentation will be defined "elsewhere"
## Environments and displays define what you write means
Types of environments:
- Document, math, figure, table, list, quote, bold, italics
Usually specified in the text with:
```latex
\begin{contenttype}
... what you write goes here
\end{contenttype}
```
## Normal text: headings, paragraphs, lists
- Headings
- `\section`, `\subsection`, `\subsubsection`
- Paragraphs
- Just add some line-breaks!
- An empty line signifies the boundary between paragraphs
- Lists
- `itemize`: bullet points
- `enumerate`: numbered list
- Can be nested
\vspace{2em}
> Tip: For better version control, stick to **one sentence, one line**
## MATH
- `equation`: a single line of math
- `gather`: multiple lines of math
- `align`: multiple lines that can be *lined up*
- `\(...\)`: inline math
- `\[...\]`: basically like `equation`
We're talking inline $F = ma$ versus full display:
$$
E = mc^2.
$$
## Figures and tables
- `\begin{figure}`: figure environment
- `\includegraphics`: the graphics to be shown
- `\caption`: text under/over the figure, with number
- `\label`: name to remember the figure by in the raw latex
- `\begin{table}`: table environment
- `\begin{tabular}`: environment for tabulated data
- `\caption`: text over/under table, with number
- `\label`: allows you to refer to the table in the document
## Referencing
- `\usepackage{biblatex}`
- Reference list styling
- Many other options
- Needs a file containing available sources
- Put `\addbibresource` in the preamble
- `\printbibliography`
- Options are available for this one as well
## Appendices
- `\usepackage{appendix}`
- `\appendix`: changes context of the document to "appendices"
- Each `\section` now defines an appendix, not a "chapter"
- Should probably have been an environment, but alas
## 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
> that I'll never win.
. . .
The \TeX \ typesetting engine is really powerful and will probably make
better choices than you.
## Linebreaks and pagebreaks
- Empty line: separates paragraphs
- Depending on settings, this may not produce empty lines in the compiled document
- `\\`: forces linebreak
- Used in tables, matrices and multiline math
- Can *force air* between paragraphs, but be careful
- `\newpage`: forces the rest of the page to be empty
- `\mbox`: forces words to "stay together", no hyphenation
- `~`: non-breaking space
## vspace and hspace
- `\vspace`: vertical spacing
- `\hspace`: horizontal spacing
- Valid lengths are:
- `cm, mm, em, ex, pt, mu, sp`
- ... and some more
- Lengths may be **negative**
## Default/documentwide lengths and widths
- `\parskip`: space when skipping to next paragraph
- `\parindent`: indent space on the first line of a paragraph
- `\baselinestretch`: how tall is a line?
- `\setstretch` and `\itemsep`: line height in itemize/enumerate environments
## MATH - but displaystyle this time
- `\textstyle`: inline math, when using `\(...\)`
- `\displaystyle`: math in *it's own box*
- With `equation`, `gather`, `align` and `\[...\]`
- `\scriptstyle`: when showing in sub/superscript
- `\scriptscriptstyle`: when sub/superscript is nested!
## Figures and tables
- Width, height and angle:
- `[width=\textwidth, height=100mm, angle=45]`
- `[!htbp]`
- 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:
```latex
\newcommand{\R}{\mathbb{R}}
\newcommand{\bb}[1]{\mathbb{#1}}
\newcommand{\un}[1]{\ensuremath{\, \mathrm{#1}}}
```
## Further reading
- Everything on Overleaf.com
- Documentation for packages on CTAN
- StackExchange
\vspace{2em}
> Tip: Keep it simple, stupid!
More packages $\neq$ better document