Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm interested in putting marginal notes that seems like a post-it in the margin of a document.

No problem at all if they are simply made with \marginpar and playing with margin width and separation.

But my question is: how can I make the marginal note wider and make it invade the main body of the document? how will it wrap the body text? Let me clarify with a sample:

|   asdfasdfasdfasdfasfs        |
|   sadfasdfasdfasdfasas        |
|   asdfajhdfasfd               |
|   jhfasdjfasdfj +----------+  |
|   asdfasdfasdfa | asdasdfa |  |
|   jkasdfjasdfas | sdfadfas |  |
|   jhfasdjfasdfj +----------+  |
|   asdfajhdfasfd               |
|   asdfasdfasdfasdfasfs        |
|   sadfasdfasdfasdfasas        |

I'd be interested in some solution, also considering some aspect I don't know about the wrapfig package.

And... what about double sided documents (book class)?

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

One way is to use the wrapgifure environment:

\documentclass[twoside]{article}
\usepackage{lipsum}
\usepackage{wrapfig}
\setlength{\wrapoverhang}{\marginparwidth}
\addtolength{\wrapoverhang}{\marginparsep}
\usepackage[left=1in,right=2.5in,top=1in,bottom=1in]{geometry}
\begin{document}
\lipsum[1]
\begin{wrapfigure}[11]{O}{6.3cm}
\vspace{-10pt} %% If needed
This is a margin note getting wrapped with the text and going into margin as well.
In \verb!\begin{wrapfigure}[8]{O}[2cm]{6cm}!, \texttt{[8]} denotes the number of line space in the margin note, \texttt{{O}} is the alignment, \texttt{[2cm]} is amount by which the note goes in to the margin (called over hang) and \texttt{{6cm}} is the width.
\vspace{10pt} %% If needed
\end{wrapfigure}
\lipsum[2-3]
\clearpage
\lipsum[3]
\begin{wrapfigure}[11]{O}{6.3cm}
% \vspace{-10pt} %% If needed
This is a margin note getting wrapped with the text and going into margin as well.
In \verb!\begin{wrapfigure}[8]{O}[2cm]{6cm}!, \texttt{[8]} denotes the number of line space in the margin note, \texttt{{O}} is the alignment, \texttt{[2cm]} is amount by which the note goes in to the margin (called over hang) and \texttt{{6cm}} is the width.
% \vspace{10pt} %% If needed
\end{wrapfigure}
\lipsum[4-5]

\end{document}

enter image description here

share|improve this answer
1  
It would be better to use \raggedright for the text inside wrapfigure to prevent ugly inter-word spacing. –  Gonzalo Medina May 21 '12 at 0:56
    
@GonzaloMedina: That is true if one has unbreakable wordings like this one. Generally your suggestion is better. –  Harish Kumar May 21 '12 at 1:21
    
i'd line to thank you for your detailed explanation. Works like a charm! –  Fèlix Galindo Allué May 21 '12 at 8:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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