Completed images chapter

This commit is contained in:
Kenneth John Odle 2023-10-31 13:22:46 -04:00
parent e6ae9ef43a
commit dc9ab652a5

View File

@ -13,6 +13,7 @@
\usepackage{lipsum}
\usepackage{nicefrac}
\usepackage{quoting}
\usepackage{wrapfig}
\raggedbottom
@ -1473,6 +1474,80 @@ p & On a special page for floats only \\
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.
\section{Wrapping Text Around Figures}
If you have a small figure, it's often better to wrap text around it by placing it in a \texttt{wrapfigure} environment.
\begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=\fbox{Wrapping Text Around an Image}]
\begin{wrapfigure}[9]{r}{0.25\textwidth}
\centering
\includegraphics[scale=0.5]{birb}
\caption{Birb.}
\label{img:birb3}
\end{wrapfigure}
\end{Verbatim}
\begin{wrapfigure}[9]{r}{0.25\textwidth}
\centering
\includegraphics[scale=0.5]{birb}
\caption{The same birb.}
\label{img:birb3}
\end{wrapfigure}
The \texttt{wrapfigure} environment requires the \texttt{wrapfig} package to be loaded in the preamble. It has two required options: a position parameter that tells it where to place the image relative to the text, and a width parameter than tells it how wide to make container that will hold your image. If your image is larger than the width of the \texttt{wrapfigure} environment, it will simply skip to the next available space, which means it probably won't fit where you want it. Be sure to scale your images appropriately. (The options for the \texttt{position} parameter is shown in table \ref{tb:wrapfigpospar} on page \pageref{tb:wrapfigpospar}.)
\begin{wrapfigure}[6]{l}[5mm]{0.25\textwidth}
\centering
\includegraphics[scale=0.5]{birb}
\caption{Birb with overhang.}
\label{img:birb4}
\end{wrapfigure}
We've also used the \Verb+\centering+ command to center the image over the caption. In this case, you should avoid using a \texttt{centering} environment, because that will introduce additional space above and below the figure.
It also has an optional \texttt{lineheight} parameter, for those instances where you need to eliminate some extra space from beneath the figure. I've used \texttt{[9]} in the example above to eliminate some extra white space underneath Figure \ref{img:birb3}. There is an additional optional \texttt{overhang} parameter which can be used to push an image out into the margin. Notice that the bird on the left has an overhang of 5 millimeters.
The options are this order (and be sure to note the alternating use of curly brackets and square brackets):
\begin{Verbatim}[]
\begin{wrapfigure}[<lineheight>]{<placement>}[<overhang>]{<width>}
\end{wrapfigure}
\end{Verbatim}
The complete code for image \ref{img:birb4} looks like:
\begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=\fbox{\texttt{wrapfigure} Example with all Parameters}]
\begin{wrapfigure}[6]{l}[5mm]{0.25\textwidth}
\centering
\includegraphics[scale=0.5]{birb}
\caption{Birb with overhang.}
\label{img:birb4}
\end{wrapfigure}
\end{Verbatim}
Note that I've changed the \texttt{lineheight} parameter from 9 to 6 lines to avoid having the image overflowing onto the new page. (You can see that the caption actually sits below the last line of text, which was causing the first line of text on this page to be pushed to the right the width of the image. This can be a fiddly process, especially with images at the bottom of a page.)
If the \texttt{wrapfigure} package is not working for you, there is also the much older \texttt{picins} package.
\begin{longtblr}
[
caption = {\texttt{wrapfig} Position Parameters},
label = {tb:wrapfigpospar}
]{
width = {\textwidth},
colspec = { X[1,c] X[1,c] X[7,l] },
hlines = {0.75pt,solid},
vline{1,3,4} = {0.75pt,solid},
rows = {5mm, m, rowsep=1.5pt}
}
r & R & Right side of text \\
l & L & Left side of text \\
i & I & Inside edge of a \texttt{twoside} document \\
o & O & Outside edge of a \texttt{twoside} document
\end{longtblr}
\noindent{}Use the lowercase version of the parameter when you want to place the figure at the same point in your document that it is in your file. Use the uppercase version when you want to let it float.
\chapter{Referencing}\label{ch:referencing}
@ -1642,6 +1717,7 @@ $ texhash ~/texmf
\chapter{Miscellaneous}
\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}).