Simulating a figure-environment
Try this
\documentclass[draft]{article}
\usepackage{graphicx,caption}
\usepackage[latin]{babel}
\def\lorem{\raggedright Fusce adipiscing justo. Nullam in enim.
Pellentesque felis orci. }
\begin{document}
\begingroup
\parindent0pt
\fboxsep1pt\fboxrule0.4pt
\hsize=3cm\footnotesize
\hfil\fbox{\vbox to 5cm{\vfill
\includegraphics[width=\hsize]{./images/amato}
\vfill
}}
\hfil\fbox{\vbox to 5cm{\vfill\lorem\lorem\lorem\par\vfill}}%
\hfil\fbox{\vbox to 5cm{\vfill\includegraphics[width=\hsize]{./images/amato}\vfill}}\hfill
\endgroup
\captionof{figure}{Output to demonstrate the use of vboxes.}
\end{document}
You can automate this by measuring the height of the boxes and programming everything in a macro. This is a quick and dirty solution.
Adjust the centering using the \hfil
or \hfill
(see second example below)
\documentclass[draft]{article}
\usepackage{graphicx,caption}
\usepackage[latin]{babel}
\def\lorem{\raggedright Fusce adipiscing justo. Nullam in enim.
Pellentesque felis orci. }
\begin{document}
\begingroup
\parindent0pt
\fboxsep1pt\fboxrule0.4pt
\hsize=3cm\footnotesize
\fbox{\vbox to 5cm{\vfill
\includegraphics[width=\hsize]{./images/amato}
\vfill
}}
\hfill\fbox{\vbox to 5cm{\vfill\lorem\lorem\lorem\par\vfill}}%
\hfill\fbox{\vbox to 5cm{\vfill\includegraphics[width=\hsize]{./images/amato}\vfill}}
\endgroup
\captionof{figure}{Output to demonstrate the use of vboxes.}
\lorem\lorem\lorem\lorem\lorem\lorem
\end{document}
Without any special package, you can use 1 figure
float with 3 minipages
. If you want simulate that are two different figures, simply add two captions inside the minipages of the images (see MWE). If you want the images numbered as subfigures, take a look to the subfig
and subcaption
packages.
\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage[margin=2cm]{geometry}
\usepackage{kantlipsum} % for dummy text
\begin{document}
\kant[1] %dummy text
\begin{figure}[htb]
\begin{minipage}{.25\linewidth}
\includegraphics[width=\linewidth]{example-image-9x16}
\caption{One nice left figure.}
\end{minipage}\hfill%
\begin{minipage}{.35\linewidth}
\kant[2]
\end{minipage}\hfill%
\begin{minipage}{.25\linewidth}
\includegraphics[width=\linewidth]{example-image-9x16}
\caption{Another nice on the right.}
\end{minipage}
\end{figure}
\kant[3] % dummy text
\end{document}
You only need a single floating environment to manage the construction. Apart from that you can use almost anything to construct the inner parts. I've used tabularx
to make a tabular
that fits within the text block width:
\documentclass{article}
\usepackage{lipsum,tabularx,capt-of}
\usepackage[export]{adjustbox}
\usepackage[margin=2cm]{geometry}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}
\begin{document}
\lipsum[1]
\begin{figure}[htb]
\begin{tabularx}{\linewidth}{
@{\hspace{0pt}}% Space between left margin and left figure
L% Alignment of left figure
@{\hspace{\tabcolsep}}% Space between left figure and middle text
C% Alignment of middle text
@{\hspace{\tabcolsep}}% Space between middle text and right figure
R% Alignment of middle text
@{\hspace{0pt}}}% Space between right figure and right margin
\includegraphics[width=\linewidth,valign=t]{example-image-9x16}
\captionof{figure}{One nice left figure.}
&
\lipsum[2]
&
\includegraphics[width=\linewidth,valign=t]{example-image-9x16}
\captionof{figure}{Another nice on the right.}
\end{tabularx}
\end{figure}
\lipsum[3]
\end{document}
Adjustments can be made in terms of the alignment (vertically and/or horizontally) for each of the three cells. I've placed them in a column of type L
, C
and R
, which currently is L
eft (\raggedright
), C
entre (\centering
) and R
ight (\raggedleft
) aligned.
Space between columns and margins can also be adjusted with the above setup (clearly indicated).