2.0 KiB
2.0 KiB
@slide(layout=chapter-slide)
@number 9
@title Graphics
@slide(layout=content-only)
@title Including graphics 🖼️
@content
To display graphics, we need the graphicx package.
\begin{figure}
\includegraphics{<file path>}
\caption[<short caption (table of
figures)>]{<full caption>}
\end{figure}
Specifying the size:
\includegraphics[width=0.5\textwidth,
height=5cm]{<file path>}
@slide(layout=content-only)
@title Layout on the page
@content
\begin{figure}[<position code>]
LaTeX places graphics automatically. With position codes, we can express our preferences (they can be combined as well).
| code | position |
|---|---|
| h | here, if you don’t mind |
| t | top of the page |
| b | bottom of the page |
| p | on its own page |
| H | Here, for God’s sake! (`float` package required) |
@slide(layout=content-only)
@title Centred alignment
@content
\begin{figure}[<position>]
\begin{center}
\includegraphics{<path-to-file>}
\end{center}
\end{figure}
Alternatively:
\begin{figure}[<position>]
\centering
\includegraphics{<path-to-file>}
\end{figure}
@slide(layout=task)
@task-number 9
@title Inserting graphics
@content
- In the directory
exercises/graphicsyou can find an image file namedlatex-logo.png. - Include the figure in
exercises/graphics/graphics.texand place it exactly where you include it. - The image shall be centered.
- Additionally, add a caption for the figure.
- Adapt the width of the image to the width of the text (
\textwidth).