0

I want to align a figure in the left marginpar. I found a way using marginpar{/includegraphics}. However there are two things not coded correct.

  • The figure (blackbox) is wider compared to the marginwidth, which gives a badbox. 'Overfull \hbox (60.98819pt too wide) in paragraph'
  • And since I dont succeed in combining a figure environment with the \marginpar{} the text around the figure doesnt contain with space like normally.

Below my MWE.

Does somebody know a good way to provide an environmont for the figure in a way its aligned in the left marginpar, doesnt created badbox and has some blank space around it like a normal figure?

Thanks in advance!!

    \documentclass{scrreprt}

    \usepackage[
     includemp,
     showframe,
     reversemp,
     paperwidth=20.10cm,
     paperheight=25.80cm,
     top=2.30cm,
     bottom=3.4cm,
     inner=2.7cm,
     outer=2.7cm,
     marginparwidth=1.6cm, % Fixed for now
     marginparsep=0.4cm
     ]{geometry}

     \usepackage{lipsum}
     \usepackage{graphicx}
     \usepackage{marginfix}

     \makeatletter          
     \let\Gm@vrules@mpi\Gm@vrules@mpii
     \makeatother % to set the marginpar on the left side in showframe

     \begin{document}

     \lipsum[1]

     \marginpar{
     \includegraphics[width=10cm]{blackbox}
      }

      \end{document}

enter image description here

0

Load the changepage package and use this code, which should do the trick:

\begin{adjustwidth}{-\dimexpr\marginparwidth+\marginparsep}{}
\noindent\includegraphics{my graphic file}
\end{adjustwidth}

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.