4

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?

4
  • 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
    Commented Aug 29, 2011 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
    Commented Aug 30, 2011 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
    Commented Aug 30, 2011 at 22:21
  • @lockstep: Okey, that sounds promising. Only remains finding such a tailor-made command then :)
    – jonalv
    Commented Aug 31, 2011 at 8:57

1 Answer 1

2

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}
2
  • 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
    Commented Oct 24, 2011 at 13:58
  • I hope this is what you were asking for now.
    – Andy
    Commented Oct 24, 2011 at 14:39

You must log in to answer this question.

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