5

In the memoir manual there is a snippet for making draft notes that uses the entire paper when printing drafts on pages bigger than the trimmed papers. Is it possible to get the more fancy notes of the todonotes package to use that margin space as well? I think the readability of white on magenta as in this example is much higher and I really like to have the line provided by the todonotes package as well.

If the todonotes package can't do it, is there some other alternative in order to get my dream-behavior? :)

\documentclass[svgnames,showtrims, 10pt, draft]{memoir}

\usepackage[textsize=small, linecolor=magenta, bordercolor=magenta,
            backgroundcolor=magenta]{todonotes}
\usepackage{letltxmacro}
\usepackage{lipsum}

\LetLtxMacro{\oldtodo}{\todo}
\renewcommand{\todo}[1]{{\color{white}\oldtodo{\textsf{#1}}}}

\stockaiv
\settrims{30mm}{25mm}
\trimFrame
\settrimmedsize{242mm}{165mm}{*}
\settypeblocksize{*}{25pc}{1.618}
\setlrmargins{*}{*}{1.5}
\setulmarginsandblock{5.5pc}{6pc}{*}
\setcolsepandrule{1pc}{0pt}
\setmarginnotes{12pt}{6pc}{24pt}
\setsidecaps{2pt}{6.5pc}
\sidecapmargin{outer}
\sideparmargin{outer}
\strictpagecheck
\checkandfixthelayout

%% A new command that allows you to note down ideas or annotations in
%% the margin of the draft. If you are printing on a stock that is wider
%% than the final page width, we will go to some length to utilise the
%% paper that would otherwise be trimmed away, assuming you will not be
%% trimming the draft. These notes will not be printed when we are not
%% in draft mode.
\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
\parbox[t]{\draftnotewidth}{%%%%%%%%% funny behaviour
\raggedleft\small\hspace{0pt}#1%
}}\textbf{\textit{\HUGE\ !}}%
}%
\fi
}\@esphack}
\else
\newcommand{\draftnote}[1]{\@bsphack\@esphack}
\fi
\makeatother

\begin{document}
\section*{Lorem ipsum}%
\sidepar{\textit{Lorem ipsum dolor sit amet}}
\lipsum[1]
\todo{Fix the: Nam dui ligula, fringilla}
\lipsum[2]
\draftnote{Fix the: Nulla malesuada porttitor diam}
\lipsum[3-5]
\sidepar{\textit{Lorem ipsum dolor sit amet}}
\lipsum[6]
\todo{Fix the: Nam dui ligula, fringilla}
\lipsum[7]
\draftnote{Fix the: Nulla malesuada porttitor diam}
\lipsum[8]
\end{document}

enter image description here


EDIT:

  • Added more lipsum to make it two pages
  • Added \sidepar to show that margin notes that are not draft notes should be on the trimmed page
5

You can use the textwidth option of the todonotes package to specify the size of the margin note. Usually would just increase the size of marginpars, after your page set-up for memoir, but if you don't want to change that dimension, it is possible to rewrite some of the internals from the todo package, hiding the width of the todo notes:

Sample output

\documentclass[svgnames,showtrims, 10pt, draft]{memoir}

\usepackage[textsize=small, linecolor=magenta, bordercolor=magenta,
            backgroundcolor=magenta, textwidth=5cm]{todonotes}
\usepackage{letltxmacro}
\usepackage{lipsum}

\LetLtxMacro{\oldtodo}{\todo}
\renewcommand{\todo}[1]{{\color{white}\oldtodo{\textsf{#1}}}}

\stockaiv
\settrims{30mm}{25mm}
\trimFrame
\settrimmedsize{242mm}{165mm}{*}
\settypeblocksize{*}{25pc}{1.618}
\setlrmargins{*}{*}{1.5}
\setulmarginsandblock{5.5pc}{6pc}{*}
\setcolsepandrule{1pc}{0pt}
\setmarginnotes{12pt}{6pc}{24pt}
\setsidecaps{2pt}{6.5pc}
\sidecapmargin{outer}
\sideparmargin{outer}
\strictpagecheck
\checkandfixthelayout

\makeatletter
\renewcommand{\@todonotes@drawMarginNoteWithLine}{%
\begin{tikzpicture}[remember picture, overlay, baseline=-0.75ex]%
    \node [coordinate] (inText) {};%
\end{tikzpicture}%
\marginpar[{% Draw note in left margin
    \@todonotes@drawMarginNote{r}%
    \@todonotes@drawLineToLeftMargin%
}]{% Draw note in right margin
    \@todonotes@drawMarginNote{l}%
    \@todonotes@drawLineToRightMargin%
}%
}
\renewcommand{\@todonotes@drawMarginNote}[1]{
    \makebox[\marginparwidth][#1]{\begin{tikzpicture}[remember picture,baseline=(X.base)]%
        \node(X){\vphantom{X}};%
        \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.north)%
            {\@todonotes@text};%
        \if@todonotes@authorgiven%
            \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.north)%
                {\@todonotes@sizecommand\@todonotes@author};%
            \node(Y)[below=of X]{};%
            \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.south)%
                {\@todonotes@text};%
        \else%
            \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.north)%
                {\@todonotes@text};%
        \fi%
    \end{tikzpicture}%
}}
\makeatother

\begin{document}
\section*{Lorem ipsum}
\sidepar{\textit{Lorem ipsum dolor sit amet}}
\lipsum[1]
\todo{Fix the: Nam dui ligula, fringilla}
\lipsum[2]
\todo{Fix the: Nulla malesuada porttitor diam}
\lipsum[3-5]
\sidepar{\textit{Lorem ipsum dolor sit amet}}
\lipsum[6]
\todo{Fix the: Nam dui ligula, fringilla}
\lipsum[7]
\todo{Fix the: Nulla malesuada porttitor diam}
\lipsum[8]
\end{document}
|improve this answer|||||
  • Neat, but it only works on the first page. On the next page the margin is on the left side and increasing the textwidth places the todo note on top of the other text. Updated the example code to use two pages. – jonalv Mar 13 '15 at 14:36
  • Hm that seems scary, isn't that thing used for other stuff when setting the page which will be problems for the ``not draft notes'' things? I will test.. :) – jonalv Mar 13 '15 at 14:53
  • Updated the example to reflect needed features that I didn't think of when designing it. – jonalv Mar 13 '15 at 15:03
  • I see. I have now posted a new approach that rewrites some internals of the todo package instead. – Andrew Swann Mar 13 '15 at 15:28
  • Very nice! I feel that only accepting and moving on is not thanks enough... This seems to be exactly what I was dreaming about! – jonalv Mar 13 '15 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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