Skip to content

Latest commit

 

History

History
102 lines (71 loc) · 2.22 KB

latex-intro.md

File metadata and controls

102 lines (71 loc) · 2.22 KB

An Introduction to LaTeX

Managing large documents

For smaller projects it is okay to keep everything in a single .tex file. For more involved projects this approach quickly becomes cumbersome. The \include command makes it possible to break your document down into smaller chunks. Working with smaller chunks is more manageable. An example structure for a thesis project could look like the following:

thesis/
|-- thesis.tex
|-- chapters/
    |-- chapter_1.tex
    |-- chapter_2.tex
    |-- chapter_3.tex
|-- internal/
    |-- preamble.tex
|-- fig/
    |-- science.png
|-- references.bib

Example thesis.tex:

\documentclass[12pt]{report}

\include{internal/preamble}

\begin{document}

\include{chapters/chapter _1}
\include{chapters/chapter _2}
\include{chapters/chapter _3}

\bibliography{references}

\end{document}

Example internal/preamble.tex:

% Preamble, packages, commands, etc .
\ usepackage{microtype}
\ usepackage{booktabs}
\ usepackage{cleveref}
\ usepackage{graphicx}

% Make it easier to include figures
\graphicspath{{fig/}}

Example chapters/chapter_1.tex:

\chapter{Literature review}
\label{cha:lit _ review}

Here's stuff others did which I don't really understand \ldots

Custom commands

Simple macros

Used to simplify repetitive and/or complex formatting. Usually specified in the preamble:

\newcommand{\name}{definition}

Macros with parameters

\newcommand{\name}[#params]{definition}

For example:

\newcommand{\bb}[1]{\mathbb{#1}}

Macros with default parameters

\newcommand{\name}[# params][default #1]{def.}

For example:

\newcommand{\plusbinomial}[3][2]{(#2 + #3)^#1}

References