# Can a figure/box/table overflow into the margin deliberately and with wrapped text?

New to LaTeX, learning fast.

Book document.

I want to have full width pictures in text (sorted). I want to have figures/boxes in the margin (sorted, I think, with packages and commands like \marginpar or sidenotes) I want to have figures/tables that wrap text around them. (sorted, I think, with wrapfig)

Can I have a figure that has wrapped text, where the figure overflows into the margin? A search would suggest having it know which way it can/should overflow can be tricky and needs commands/packages that help with "odd page" checking.

But I cant work out if this is actually possible with wrapped text, and/or with other margin based content. I've found a lot of "post-figure whitespace" problems as well, but not sure what terms I need to solve this.

Attached images show target layouts. Includes both a left-face and right-face page. Both have the wrapped/overflowed figure at the top, but that's not essential (if anything, I'd like to be able [h] it roughly with the right text, which is another whole ball of wax) The right page even has a full width image that covers the whole text margin plus the external.

I know it's a lot to ask, but I'd really love a simple example that matches either of the attached images, and if my odd/even page problem suspicion is correct, one that can do both pages.

• That is not the strength of LaTeX. – Johannes_B Aug 29 '18 at 4:51
• Fair enough if it's not, I'm still learning the strengths/weaknesses here, was wondering if it was able to achieve this. It seemed to fit mostly within what LaTeX is good/strong at, as I'm not specifically needing to put it "THERE" it can float as much as it wants. Just trying to have it not completely own the section it's attached to, but be an aside. This book as very strict margin lines, it just appears to have TWO margins, a hard outer limit, then a soft text limit that pictures can flow through – Phil Aug 29 '18 at 5:40

You can use a mixture of wrapfig, sidenotes and the standard figure environment. Be prepared for the placement to be suboptimal and a lot of finetuning by hand.

\documentclass{article}
\usepackage{blindtext}
\usepackage{sidenotes}
\usepackage{wrapfig}

\begin{document}

\begin{wrapfigure}{r}[\dimexpr\marginparwidth+\marginparsep\relax]{10em}
\rule{10em}{5em}
\caption{A black box}
\end{wrapfigure}
\blindtext
\begin{marginfigure}
\rule{\marginparwidth}{5em}
\caption{A black box}
\end{marginfigure}
\blindtext
\begin{figure*}[h!]
\centering
\rule{\dimexpr\textwidth+\marginparwidth+\marginparsep\relax}{10em}
\caption{A black box}
\end{figure*}

\end{document}


• That looks promising. Where can I get more info on blindtext and dimexpr? How "sub optimal" are we talking? Was it very difficult for you to end up with it as shown? – Phil Aug 29 '18 at 9:30
• Playing with this a little, I think I have to manually pick left or right sides... How would I make this automatically go to "outside" edge (right on odd, left on even)? – Phil Aug 29 '18 at 10:40
• @Phil Documentation for both packages can be found on CTAN: sidenotes, wrapfig. The package blindtext is just to generate dummy text. Nothing you would use in a real document. – Henri Menke Aug 29 '18 at 12:24
• Ah okay. Blindtext makes sense. I'd read a fair bit on wrapfig and only found sidenotes in passing so far as an option to investigate. Googling after work also explained the expr commands a bit too. Thanks for the example. Am I right about the left/right on odd/even issue? – Phil Aug 30 '18 at 1:12
• @Phil You can configure your document such that sidenotes always uses the outside margin (depends on the document class). For wrapfig just pass i for inside margin and o for outside margin as the first argument. – Henri Menke Aug 30 '18 at 1:15