/
file.tex
70 lines (62 loc) · 1.88 KB
/
file.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
\documentclass{article}
\usepackage{graphicx}
\usepackage{float}
\usepackage{subcaption}
\title{My first document}
\date{2020-07-01}
\author{Christopher}
\begin{document}
% orced picture to show where it is declared
% options are:
% h (here) - same location
% H (Here) - same location but stricter (requires \usepackage{float})
% t (top) - top of page
% b (bottom) - bottom of page
% p (page) - on an extra page
% ! (override) - will force the specified location (doesn't support H)
\begin{figure}[h!]
\includegraphics[width=\linewidth]{boat.png}
\caption{A boat.}
% invisible
\label{fig:boat1}
\end{figure}
% might have to be compiled twice to work
Figure \ref{fig:boat1} shows a boat.
% multiple images
\begin{figure}[h!]
\centering
% <- 40% of the page for each image (sum should always be less than 100%)
\begin{subfigure}[b]{0.4\linewidth}
\includegraphics[width=\linewidth]{boat.png}
\caption{Coffee.}
\end{subfigure}
\begin{subfigure}[b]{0.4\linewidth}
\includegraphics[width=\linewidth]{boat.png}
\caption{More coffee.}
\end{subfigure}
\caption{The same cup of coffee. Two times.}
\label{fig:coffee}
\end{figure}
% automated linebreak when the width is bigger than 100%
\begin{figure}[h!]
\centering
\begin{subfigure}[b]{0.2\linewidth}
\includegraphics[width=\linewidth]{boat.png}
\caption{Coffee.}
\end{subfigure}
\begin{subfigure}[b]{0.2\linewidth}
\includegraphics[width=\linewidth]{boat.png}
\caption{More coffee.}
\end{subfigure}
\begin{subfigure}[b]{0.2\linewidth}
\includegraphics[width=\linewidth]{boat.png}
\caption{Tasty coffee.}
\end{subfigure}
\begin{subfigure}[b]{0.5\linewidth}
\includegraphics[width=\linewidth]{boat.png}
\caption{Too much coffee.}
\end{subfigure}
\caption{The same cup of coffee. Multiple times.}
\label{fig:coffee3}
\end{figure}
\end{document}