0

I use wrapfigures (without captions) to position photos on a page like this:

\begin{wrapfigure}{r}{0.5\textwidth}
  \frame{\includegraphics[width=0.5\textwidth]{photo.jpg}}
\end{wrapfigure}

How can I remove the margin below the figure, i.e. force Latex not to break the lines and instead use the space highlighted in red in the screenshot below?

enter image description here

3
  • 3
    it's not an intentional margin, it is just confused by the space around the heading,use the optional argument to specify how many lines to cut in Commented May 6, 2023 at 7:09
  • Thanks for clarifying. Which command are you referring to to add the argument to?
    – martin
    Commented May 6, 2023 at 7:48
  • 4
    \begin{wrapfigure}[20]{r}{0.5\textwidth} or whatever number looks best Commented May 6, 2023 at 7:53

3 Answers 3

2

It's not an intentional margin, it is just confused by the space around the heading.

wrapfig guesses how many lines to shorten based on the vertical size of the figure,but because of the chapter heading taking up space you need to shorten fewer lines. Use the optional argument to specify how many lines to cut in.

\begin{wrapfigure}[20]{r}{0.5\textwidth}

or whatever number looks best

1

enter image description here

You must set the value of \intextsep. Its value for default book documentclass is 12pt plus 2.0pt minus 2.0pt. The exact value you need depends on your document margins and font size

\documentclass{book}

\usepackage{geometry}
\geometry{twoside=false, showframe=true}
\usepackage{graphicx}
\usepackage{blindtext}

\usepackage{wrapfig}
\setlength{\intextsep}{0.25em plus 2pt minus 2pt}
            
\begin{document}

\begin{wrapfigure}{r}{0.50\linewidth} 
    
    \includegraphics[width=\linewidth]{example-image-a}
    
\end{wrapfigure}

\blindtext

\medskip
\the\intextsep

\end{document}
1
  • You removed the section heading here which was the cause of the issue. Commented Nov 28, 2023 at 15:17
0

I think this is a bug of wrapfigure, I'd use minipage instead since they don't have that issue.

1
  • Minipage does not have the feature requested, Commented Nov 28, 2023 at 15:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .