# Minipage: Align text, image and caption

I try to split my page into a text part on the left and an image on the right side. Therefore I use minipage and flushright.

There are 2 problems:

• I want to have the text and the image being top aligned. The minipage option [t] does not work unfortunately, neigther the try \vspace{0pt}.

• The image is right aligned properly, but the caption is not. It should be shifted to the right as well to be centered under the image again.

How can I achieve both? Thank you :)

MWE:

\documentclass{scrreprt}
\usepackage{caption}
\usepackage{mwe}

\begin{document}

\begin{minipage}{0.38\textwidth}
\lipsum[2]
\end{minipage}
\begin{minipage}{0.57\textwidth}
\begin{flushright}
\includegraphics[height=10cm]{example-image-9x16}
\captionof{figure}{Caption\\Long Caption}
\end{flushright}
\end{minipage}

\end{document}


Probably the following gets closer to the desired output. (Lines indicate margins):

\documentclass{scrreprt}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{showframe}
\usepackage{lipsum}
\begin{document}
\noindent
\begin{minipage}[t]{0.38\textwidth}
\lipsum[2]
\end{minipage}
\hfill
\begin{minipage}[t]{5.7cm}
\begin{flushright}
\includegraphics[height=10cm, valign=t]{example-image-9x16}
\captionof{figure}{Caption Long long Caption}
\end{flushright}
\end{minipage}

\end{document}


Here is a version using measuredfigure from threeparttable:

\documentclass{scrreprt}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{showframe}
\usepackage{lipsum}
\usepackage{threeparttable}
\begin{document}
\noindent
\begin{minipage}[t]{0.38\textwidth}
\lipsum[2]
\end{minipage}
\hfill
\begin{minipage}[t]{0.57\textwidth}
\hfill
\begin{measuredfigure}
\includegraphics[height=10cm, valign=t]{example-image-9x16}
\captionof{figure}{Caption Long long Caption}
\end{measuredfigure}
\end{minipage}

\end{document}

• Works quite well. But why can't I use the \textwidth but have to give a specific minipage width in cm? Jul 5, 2020 at 13:21
• @Max16hr: I decided to make the minipae just as wide as the image in order to get the caption centered under the image instead of being cantered with respect to the whole minipage. Jul 5, 2020 at 13:23
• Okay. I dont think, that this is the proper way to do so. But the top alignment works good, thank you! :) Jul 5, 2020 at 13:30
• @Max16hr: I have added an alternative version using the measuredfigure environment from the threeparttable package. Probably you like that version better. Jul 5, 2020 at 14:10

paracol is a good choice.

\documentclass{scrreprt}
\usepackage{caption}
\usepackage{mwe}
\usepackage{paracol}

\begin{document}
\begin{paracol}{2}
\lipsum[2]
\switchcolumn
\includegraphics[height=10cm]{example-image-9x16}
\captionof{figure}{Caption\\Long Caption}
\switchcolumn*
\lipsum[3]
\switchcolumn
\includegraphics[height=5cm]{example-image-16x10}
\captionof{figure}{Caption\\Long Caption}
\end{paracol}

\end{document}