136 lines
5.4 KiB
TeX
136 lines
5.4 KiB
TeX
|
\documentclass[12pt]{article}
|
||
|
|
||
|
% ===================================================
|
||
|
% _____ _
|
||
|
% | ____|_ ____ _ _ __ ___ _ __ | | ___
|
||
|
% | _| \ \/ / _` | '_ ` _ \| '_ \| |/ _ \
|
||
|
% | |___ > < (_| | | | | | | |_) | | __/
|
||
|
% |_____/_/\_\__,_|_| |_| |_| .__/|_|\___|
|
||
|
% |_|
|
||
|
|
||
|
% License: MIT
|
||
|
% Author: Sven Vogel
|
||
|
% Copyright: Sven Vogel (2023)
|
||
|
|
||
|
\usepackage{tikz}
|
||
|
\usepackage{wrapfig}
|
||
|
\usepackage{tikz-imagelabels}
|
||
|
\usepackage{caption}
|
||
|
|
||
|
% ===================================================
|
||
|
|
||
|
\title{Abbildungen}
|
||
|
\author{Sven Vogel}
|
||
|
\date{September 2023}
|
||
|
\begin{document}
|
||
|
\maketitle
|
||
|
|
||
|
\makeatletter
|
||
|
|
||
|
% apply this as scaling for images to make them fit available space
|
||
|
\def\ScaleIfNeeded{
|
||
|
\ifdim\Gin@nat@width>\linewidth
|
||
|
\linewidth
|
||
|
\else
|
||
|
\Gin@nat@width
|
||
|
\fi
|
||
|
}
|
||
|
|
||
|
\makeatother
|
||
|
|
||
|
% ===================================================
|
||
|
% Picture
|
||
|
|
||
|
\section{Picture}
|
||
|
|
||
|
The following picture (\ref{fig:a-field}) depicts a yellow field with a tree and spans over the entire line width:
|
||
|
|
||
|
% More information about figures: https://latex-tutorial.com/tutorials/figures/
|
||
|
\begin{figure}[h]
|
||
|
\centering
|
||
|
\noindent
|
||
|
\includegraphics[width=\linewidth]{res/image.jpg}
|
||
|
\caption{Ein wunder schönes Feld}
|
||
|
\label{fig:a-field}
|
||
|
\end{figure}
|
||
|
|
||
|
\cleardoublepage
|
||
|
|
||
|
% ===================================================
|
||
|
% Wrapfigure
|
||
|
|
||
|
\section{Wrap text around figure}
|
||
|
|
||
|
% More about warpfigure: https://www.overleaf.com/learn/latex/Wrapping_text_around_figures
|
||
|
\begin{wrapfigure}{l}{0.5\linewidth}
|
||
|
\centering
|
||
|
\noindent
|
||
|
\includegraphics[width=\ScaleIfNeeded]{res/adam.jpg}
|
||
|
\caption{Adam Cole}
|
||
|
\label{fig:some-adam}
|
||
|
\end{wrapfigure}
|
||
|
It may be noted that the width of the image included was specified relative to width of the text.
|
||
|
It is a good idea to use relative sizes to define lengths, particularly when using wrapfigure.
|
||
|
In the example above, the figure covers exactly half of the the textwidth, and the actual image uses a slightly smaller width, so that there is a pleasing small white frame between the image and the text. The image should always be smaller (less wide) than the wrap, or it will overrun the text.
|
||
|
Take care while using adding wrapfigures very near the top or bottom of a page, as this can often cause unwanted effects that are hard or near-impossible to solve. It is not advisable to try to use wrapfigures alongside equations or sectional headers. They also cannot be used in lists, such as itemize and enumerate environments.
|
||
|
|
||
|
% ===================================================
|
||
|
% Include a PDF as picture
|
||
|
|
||
|
\cleardoublepage
|
||
|
|
||
|
\section{PDF as image included}
|
||
|
\subsection{as vector graphic}
|
||
|
|
||
|
The following picture (\ref{fig:a-field}) depicts a yellow field with a tree and spans over the entire line width:
|
||
|
|
||
|
\begin{figure}[h]
|
||
|
\centering
|
||
|
\noindent
|
||
|
\includegraphics[width=0.5\linewidth]{res/document.pdf}
|
||
|
\caption{Nginx Proxy Manager}
|
||
|
\label{fig:npm}
|
||
|
\end{figure}
|
||
|
|
||
|
% with labels
|
||
|
|
||
|
\cleardoublepage
|
||
|
|
||
|
\section{Image with labels}
|
||
|
|
||
|
\begin{wrapfigure}{r}{0.5\linewidth}
|
||
|
\begin{tikzpicture}[remember picture]
|
||
|
\node[anchor=south west, inner sep=0] (image) at (0,0){\includegraphics[width=\ScaleIfNeeded]{res/adam.jpg}};
|
||
|
\foreach \i/\j/\k in {1/1/1, 4.3/6.3/2} {
|
||
|
\node[circle, draw, fill=white] at (\i,\j) {\k};
|
||
|
}
|
||
|
\end{tikzpicture}
|
||
|
\end{wrapfigure}
|
||
|
It may be noted that the width of the image included was specified relative to width of the text.
|
||
|
It is a good idea to use relative sizes to define lengths, particularly when using wrapfigure.
|
||
|
In the example above, the figure covers exactly half of the the textwidth, and the actual image uses a slightly smaller width, so that there is a pleasing small white frame between the image and the text. The image should always be smaller (less wide) than the wrap, or it will overrun the text.
|
||
|
Take care while using adding wrapfigures very near the top or bottom of a page, as this can often cause unwanted effects that are hard or near-impossible to solve. It is not advisable to try to use wrapfigures alongside equations or sectional headers. They also cannot be used in lists, such as itemize and enumerate environments.
|
||
|
|
||
|
\cleardoublepage
|
||
|
|
||
|
\section{Minipage}
|
||
|
\subsection{Two images side by side}
|
||
|
|
||
|
\begin{figure}[h]
|
||
|
\begin{minipage}[b]{0.49\linewidth}
|
||
|
\includegraphics[width=\ScaleIfNeeded]{res/image.jpg}
|
||
|
\captionof{figure}{Caption for image}
|
||
|
\end{minipage}
|
||
|
\hfill
|
||
|
\begin{minipage}[b]{0.5\linewidth}
|
||
|
\includegraphics[width=\ScaleIfNeeded]{res/image.jpg}
|
||
|
\captionof{figure}{Caption for image}
|
||
|
\end{minipage}
|
||
|
\end{figure}
|
||
|
|
||
|
It may be noted that the width of the image included was specified relative to width of the text.
|
||
|
It is a good idea to use relative sizes to define lengths, particularly when using wrapfigure.
|
||
|
In the example above, the figure covers exactly half of the the textwidth, and the actual image uses a slightly smaller width, so that there is a pleasing small white frame between the image and the text. The image should always be smaller (less wide) than the wrap, or it will overrun the text.
|
||
|
Take care while using adding wrapfigures very near the top or bottom of a page, as this can often cause unwanted effects that are hard or near-impossible to solve. It is not advisable to try to use wrapfigures alongside equations or sectional headers. They also cannot be used in lists, such as itemize and enumerate environments.
|
||
|
|
||
|
\end{document}
|