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.

Page 394 of the memoir manual provides a snippet by Bastian Veelo for making margin comments out over the part of the stock paper that would be cut away. This very handy for making comments only appearing in the draft.

However if I want to comment a float like for example a figure it complains about not being in outer par mode. How can I adopt the code:

\documentclass[draft]{memoir}

\makeatletter
\ifdraftdoc
\newlength{\draftnotewidth} 
\newlength{\draftnotesignwidth} 
\newcommand{\draftnote}[1]{\@bsphack%
{%% do not interfere with settings for other marginal notes 
\strictpagecheck% 
\checkoddpage%
\setlength{\draftnotewidth}{\foremargin}% 
\addtolength{\draftnotewidth}{\trimedge}% 
\addtolength{\draftnotewidth}{-3\marginparsep}% 
\ifoddpage
\setlength{\marginparwidth}{\draftnotewidth}%
\marginpar{\flushleft\textbf{\textit{\HUGE !\ }}\small #1}% 
\else
\settowidth{\draftnotesignwidth}{\textbf{\textit{\HUGE\ !}}}% 
\addtolength{\draftnotewidth}{-\draftnotesignwidth}% 
\marginpar{\raggedleft\makebox[0pt][r]{%% hack around
}% \fi
\parbox[t]{\draftnotewidth}{%%%%%%%%% funny behaviour 
\raggedleft\small\hspace{0pt}#1%
}}\textbf{\textit{\HUGE\ !}}%
}\@esphack} \else
\newcommand{\draftnote}[1]{\@bsphack\@esphack} \fi
\makeatother

\begin{document}
\begin{figure}
\draftnote{Lorem ipsum}
\end{figure}
\end{document} 

to work also with floats?

share|improve this question
2  
\marginpars are floats, and TeX doesn't allow floats inside floats. (Thanks to egreg for the tip.) Use the marginnote package and its command of the same name to define a new \draftnote command from scratch. –  lockstep Aug 29 '11 at 14:56
2  
why? memoir has several other margin writing macros, like \sidepar and friends. Several of these are not floats and thus can be used within floats. –  daleif Aug 30 '11 at 8:05
    
@daleif: I stand corrected. I should have said: \draftnote won't work, but chances are high the memoir authors have come up with another command tailor-made for your problem. –  lockstep Aug 30 '11 at 22:21
    
@lockstep: Okey, that sounds promising. Only remains finding such a tailor-made command then :) –  jonalv Aug 31 '11 at 8:57

1 Answer 1

up vote 2 down vote accepted

You can take the \marginnote macro from the marginnote package. It produces something similar to \marginpar, but it is not a float. I made a small example. In principle you should be able to replace the two \marginpars with \marginnotes, but the upper code does not work for me, even if the \draftnote command is outside of the figure environment, so I could not try that.

enter image description here

\documentclass[draft]{memoir}
\usepackage{lipsum}
\usepackage{marginnote}

\begin{document}
\lipsum[1]
\begin{figure}[h]
\marginnote{This is a comment}
\caption{I am a caption}
\end{figure}
\lipsum[2]
\end{document}
share|improve this answer
    
I fail to see in what way this is relevant for my problem. I wanted to put a margin comment at the same height as a float found inside the textblock area. Such a comment would not be a graphic and it would not have a figure caption. Am I missing something? –  jonalv Oct 24 '11 at 13:58
    
I hope this is what you were asking for now. –  Andy Oct 24 '11 at 14:39

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.