2

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}

enter image description here

2 Answers 2

2

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

enter image description here

\documentclass{scrreprt}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{showframe}
\usepackage{lipsum}
\usepackage[export]{adjustbox} %for the valign=t option
\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[export]{adjustbox} %for the valign=t option
\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}
4
  • Works quite well. But why can't I use the \textwidth but have to give a specific minipage width in cm?
    – Max16hr
    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.
    – leandriis
    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! :)
    – Max16hr
    Jul 5, 2020 at 13:30
  • 1
    @Max16hr: I have added an alternative version using the measuredfigure environment from the threeparttable package. Probably you like that version better.
    – leandriis
    Jul 5, 2020 at 14:10
1

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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.