2

I am creating a document that contains several text-boxes to serve as info-boxes for further information. I use the boxedminipage & wrapfig packages to achieve this: boxedminipage for a box with outline and the ability to change the style inside the box, and wrapfig to float the box either left or right of the main text. This all works as intended.

However, I am unhappy with the result when I include a textbox right at the start of a section or subsection. I would be very happy if I could move the box all the way up on the same level of the section title, but I expect the box to at least start on the same line as the main text, which it doesn't. See the screenshot below.

MWE:

\documentclass[12pt]{article}
\usepackage{wrapfig,boxedminipage,lipsum}
\begin{document}    
    \section{FOO}
    \subsection{Foo Bar Bas}    
    \begin{wrapfigure}{r}{0.5\textwidth}
        \begin{boxedminipage}{0.5\textwidth}
            \fontsize{10}{10}
            \textbf{Lipsum lorem lippilip}\\\lipsum[66]
        \end{boxedminipage}
    \end{wrapfigure}
    \lipsum[75]
\end{document}

Result:

floating wrong

Desired result:

floating right

Note: changing the wrapfig option to R or r doesn't affect the outcome.

2

I added a negative \vspace*.

\documentclass[12pt]{article}
\usepackage{wrapfig,boxedminipage,lipsum}
\begin{document}    
    \section{FOO}
    \subsection{Foo Bar Bas}    
    \begin{wrapfigure}{r}{0.5\textwidth}\vspace*{-2.5\baselineskip}
        \begin{boxedminipage}{0.5\textwidth}
            \fontsize{10}{10}
            \textbf{Lipsum lorem lippilip}\\\lipsum[66]
        \end{boxedminipage}
    \end{wrapfigure}
    \lipsum[75]
\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.