I'm trying to create something similar to marginpar but without the hassle of floats (particularly because I'm going to have a lot of these).
First issue These notes always appear at the beginning of a paragraph, and I would like to be able to take into account whether the paragraph has been indented or not (such as whether it's followed a section command). I really only need to know this so I can position the note correctly in the right hand margin. I suppose there may be so tikz trick for this. If you know of one, I'd greatly appreciate your suggestions for finding the position of the right margin of the current line. I'd also be very interested in non-tikz answers too.
Second issue I want to be able to kill the extraneous whitespace after the environment. I know I can manually add % after the environment. But I'd like not to have to do this. I thought using etoolbox I could achieve this effect with the hook \AtEndEnvironment, but that's not working.
Here's a MWE
\documentclass{article} \usepackage[driver=dvips, top=0.5in,bottom=0.5in, left=0.5in,right=3.25in, headsep=0.5\baselineskip, headheight=\baselineskip, footskip=1.5\baselineskip, ]{geometry} \pagestyle{empty} \usepackage{xcolor} \usepackage{etoolbox} \usepackage{lipsum} %%' \newsavebox{\aemarginpar} \newenvironment{mnote} {% \begin{lrbox}{\aemarginpar}\color{blue}% \begin{minipage}[t]{\dimexpr 3.25in - 2em - 0.5in\relax}%\raggedright% }{% \end{minipage}% \end{lrbox}% \rule{0pt}{0pt}% \hspace*{\linewidth}% \raisebox{0pt}[0pt][0pt]{% \makebox[0pt][l]{\hspace*{2em}\usebox{\aemarginpar}}% }% \hspace*{-\linewidth}% } \AtEndEnvironment{mnote}{\ignorespaces} \begin{document} \section{Hello} \begin{mnote} First margin note. I want to kill white space at the end of the environment, but even with \verb=etoolbox=, I can't seem to get rid of the extra white space. \end{mnote} \lipsum[1-2] \begin{mnote} My margin note is pushed too far to the left which is, of course, because the paragraph has been indented. \end{mnote} \lipsum[3-4] \end{document} And here's the result:


marginnote.