[Tex/LaTex] `\includegraphics` side-by-side and filling text-width

graphics

Instead of the figure environment I am trying to use the \includegraphics command to add pictures to an appendix.

\begin{center}
    \includegraphics[scale=\linewidth]{../pics/results_t/props_T_i_a}
\end{center}

Idea from here for adding a picture without the float feature.

Two questions:

  1. How do I add two images side-by-side? This is something I would usually do with subfigure inside the figure environment.

  2. Instead of setting the scaling to a set number, I would like to set the text line width as is the usual method for figures. the \linewidth and \textwidth commands as shown in the code give errors, so how can I use them properly?

Best Answer

An appendix often consists of many many figures, or only figures. Having them float around will do no good. Hence, put the graphics inside the text directly.

enter image description here

\documentclass{article}
\usepackage{mwe}
\usepackage{showframe}
\begin{document}
\begin{center}
    \includegraphics[width=.5\textwidth]{example-image-a}%
    \includegraphics[width=.5\textwidth]{example-image-b}%
\end{center}
\end{document}

You can also define a new environment, possibly together with package capt-of.

steeveAppendixFigure2

\documentclass{article}
\usepackage{mwe}
\usepackage{showframe}
\usepackage{capt-of}
\newenvironment{appendixfig}{\addvspace{5ex}\noindent\begin{minipage}{\linewidth}%
}{%
\end{minipage}\par\addvspace{4ex}%
}
\begin{document}
\begin{appendixfig}
    \includegraphics[width=.5\textwidth]{example-image-a}%
    \includegraphics[width=.5\textwidth]{example-image-b}%
\end{appendixfig}
\begin{appendixfig}
    \includegraphics[width=.5\textwidth]{example-image-a}%
    \includegraphics[width=.5\textwidth]{example-image-b}%
    \captionof{figure}{Two nice figures}
\end{appendixfig}
\end{document}
Related Question