# Composition of images

How can I fix this mess showed in the picture added below?

I mean, I'd like to place side by side both figures, with the box at the same level and the captions at the same level too.

Here is the code used (all the packages needed are used, no need to put them here). Caption only contains a brief description because the other lines at the bottom are additional explanations and shouldn't be part of the caption as the caption itself appears in the list of "figures" at the beginning of the thesis.

\begin{figure}
\hspace*{-0.9cm}
\begin{minipage}{.5\textwidth}
\centering
\caption{Importe de las pensiones vs. n\'umero de afiliados y variaci\'on}.
\textit{\small{*Datos de 2017 hasta marzo.}}%\\
\small{(Fuente: Elaboraci\'on propia a partir de datos del Min. de Empleo y S.S.)}
\end{minipage}%
\begin{minipage}{.5\textwidth}
\hspace*{1.4cm}
\fbox{\includegraphics[scale=0.22]{Cap1/evolucion3.png}}
\caption{Evoluci\'on del gasto en pensiones. Datos en millones de euros y \% total del presupuesto del Estado}%\\
\small{(Fuente:} \texttt{\footnotesize{Min. de Empleo y S. S.)}}
[![enter image description here][1]][1]\end{minipage}
\end{figure}


I was thinking to scale the pictures width and height scaling but not sure.

• \fbox{\includegraphics[scale=0.2]{Cap1/afiliados.png}} is bigger than the space you are putting it in, usually it's better to use width than scale: \fbox{\includegraphics[width=.9\linewidth]{Cap1/afiliados.png}} will make it 90% the width of your minipage – David Carlisle Jul 31 '17 at 10:53
• Could you post the graphic files or a link to them, so we can test? – Bernard Jul 31 '17 at 11:30

Just specify a height in the \includegraphics commands instead of giving a scale factor. Give the same height for the two pictures, and add a vertical alignment parameter to the minipages. Moreover, I think using several captions within a single figure environment is not a good idea. Give the subfigure or subcaption packages a try. Subfigures can be aligned in pretty much the same way as minipages and stuff: [t] seems to work. Here is an example document:

\documentclass{article}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{graphicx}
\usepackage{subcaption}

\begin{document}

\begin{figure}
\newlength{\tempheight}
\setlength{\tempheight}{15ex}
\centering%
\begin{subfigure}[t]{0.5\textwidth}
\centering%
\includegraphics[totalheight = \tempheight]{pic1}
\caption{First picture.}
\end{subfigure}%
\begin{subfigure}[t]{0.5\textwidth}
\centering%
\includegraphics[totalheight = \tempheight]{pic2}
\caption{Second picture with a longer caption that will need more lines than the one from the first picture.}
\label{fig:sub2}
\end{subfigure}
\end{figure}

\end{document}


I used LaTeX figures side by side as a starting point. Of course, you might have to adjust \tempheight's value, since I used random pictures of stuffed animals instead of your charts.

Please also note that the syntax for \small etc. is not \small{…}: these are switches that “turn a font ON” (somewhat) until the end of the scope. So usually it's more like {\small …}. The following example should show you the difference:

\huge%
{a \small{b} c}\par
{a {\small b} c}