Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- makeatletter
- documentclass[draft]{article}
- usepackage{marginnote}
- usepackage{ifdraft}
- usepackage{lipsum}
- newifif@use@leavevmode@hack
- newcounter{commentnote}
- newcommand{commentnote}[2][0pt]{%
- newifif@cnmark
- unlessifvmode
- unskip
- @cnmarktrue
- stepcounter{commentnote}%
- else
- if@use@leavevmode@hack
- leavevmode
- fi
- fi
- ifdraft{%
- if@cnmarktextsuperscript{thecommentnote}fi
- marginnote{if@cnmarktextsuperscript{thecommentnote},fi#2}[#1]%
- }{}%
- }
- begin{document}
- section{Without textbackslash leavevmode}
- sloppy
- commentnote{Note (1)}
- This text should not be indented.
- The verb|unlessifvmodeunskip|
- was introduced to allow
- commentnote{Note(2)}
- typesetting notes on separate lines without adding
- % characters at the end of each preceding line,
- and in order to use verb|commentnote|
- in vertical mode to create unmarked comments.
- commentnote{Note(3)}
- commentnote[baselineskip]{Note (4)}
- commentnote[2baselineskip]{Note (5)}
- It is acceptable to use multiple notes before a paragraph.
- Inserting verb|leavevmode| would cause spurious numbering.
- section{With textbackslash leavevmode}
- @use@leavevmode@hacktrue
- commentnote{Foo}%
- Using verb|leavevmode| leads to correct indentation,
- but then requires manually removing newlines between
- verb|commentnote| and paragraphs, and adding %
- characters at the end of each invocation.
- commentnote{Note(3)}%
- commentnote[baselineskip]{Note (4)}%
- commentnote[2baselineskip]{Note (5)}%
- Furthermore, it leads to spurious numbering of out-of-paragraph notes.
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement