Added captions and floats to images chapter

This commit is contained in:
Kenneth John Odle 2023-10-31 12:26:42 -04:00
parent 3f433f0da5
commit e6ae9ef43a

View File

@ -1435,7 +1435,43 @@ We can also use an \texttt{angle} option to rotate our images:
\includegraphics[angle=270]{seahorse}
\includegraphics[angle=360]{seahorse}
\section{Captions and Floats}
To add a caption, we need to wrap our image in a \texttt{figure} environment:
\begin{Verbatim}[]
\begin{figure}[h]
\includegraphics[scale=0.5]{birb}
\caption{Birb.}
\end{figure}
\end{Verbatim}
\begin{figure}[h]
\includegraphics[scale=0.5]{birb}
\caption{Birb.}
\end{figure}
A couple of things to note here: First, while the actual image is not very large, the \texttt{figure} environment is the width of the page, meaning that the caption does not actually align with the image. Second, we passed the \texttt{[h]} option to the \texttt{figure} environment, because it is a float, allowing \LaTeX{} to put the image where it thinks it best fits. This is not always a good thing.
\begin{longtblr}
[
caption = {\texttt{figure} Positioning Parameters},
label = {tb:figpospar}
]{
width = {\textwidth},
colspec = { X[1,l] X[6,l] },
hlines = {0.75pt,solid},
vline{1,3} = {0.75pt,solid},
rows = {5mm, m, rowsep=1.5pt}
}
h & Place the float \textbf{here}, approximately where it appears in the file. \\
t & At the top of the page \\
b & At the bottom of the page \\
p & On a special page for floats only \\
! & Override \LaTeX{}'s parameters for determining the float position
\end{longtblr}
Note that the \texttt{!} parameter can be combine with the \texttt{h} parameter. The \texttt{float} package also introduces the \texttt{[H]} parameter, which is roughly equivalent to \texttt{h!}, but can be problematic.
\chapter{Referencing}\label{ch:referencing}
@ -1609,7 +1645,7 @@ $ texhash ~/texmf
\begin{itemize}[noitemsep]
\item Notice that your footnotes are floating above the footer on some pages? Try adding \verb+\usepackage[bottom]{footmisc}+ to your preamble.
\item Need to control the gap between the header and the rest of the text? Pass the \verb|headsep| argument to the \texttt{geometry} package and set it equal to the amount of space you need (i.e., \texttt{headsep=12pt}).
\item If you want to add a degree symbol to inline text, the simplest way I've found (so far) is to just pop in and out of math mode with this: \verb|$^{\circ}$| which gives you this: $^{\circ}$
\item If you want to add a degree symbol\index{degree symbol} to inline text, the simplest way I've found (so far) is to just pop in and out of math mode with this: \verb|$^{\circ}$| which gives you this: $^{\circ}$
\end{itemize}
@ -1667,5 +1703,4 @@ In general, a good question has three parts:
\item Questions which could be very easily answered by simply reading the package documentation.
\end{itemize}
\end{document}