2

I defined \tnote{...} and use it a lot in my text. When I am in draft mode this should print ... into the margin in a tiny font. In final mode nothing should appear.

The current version I have is defined thusly:

\newcommand{\tnote}[1]{\tikz[overlay] \node at (0ex,2pt) [font=\tiny,anchor=north west,text=blue] {#1};}

This prints a tiny blue text below the place where \tnote appears when used like this:

Lorem Ipsum is simply \tnote{note1} dummy text of \tnote{note2} the
printing and typesetting industry. Lorem Ipsum has been the

Sometimes I have paragraphs that only consist of notes. This (alas) creates an empty white space with all notes overprinting each other:

Lorem Ipsum is simply dummy text of the.

\tnote{note1} \tnote{note2}

Printing and typesetting industry. Lorem Ipsum has been the.

Now I have three issues:

  • Instead of text below the like I'd like it to be placed besides the text. It does not have to be in the regular TeX "margin" (there is such a thing, I believe). It is only draft notes I need.
  • Sometimes I have lines only with notes. Then I have nasty empty paragraphs the way I do it. The extra vertical white space should disappear.
  • In this case the notes should be stacked, so each one stays readable. It would be ok to reserve a special area on a page where they accumulate like footnotes but that sounds more complicated then to have them automatically arranged inside the margin. I have no idea how to do either.
  • 1
    Have a look at the \marginpar (that's the standard thing that puts notes into the margins). Also there is the marginnote-package (but \marginpar seems to be better suited in your case). – Skillmon May 10 '17 at 21:35
  • Also: If those are only for editorial purpose, why don't you put comments with %TODO: in your .tex-files (most editors highlight those)? – Skillmon May 10 '17 at 21:46
3

One easy way to do this would be:

\documentclass[draft]{scrartcl}

\usepackage{blindtext}
\usepackage{xcolor}
\usepackage{ifdraft}
\newcommand{\tnote}[1]{\ifdraft{\marginpar{\tiny\color{blue}#1}}{}}

\begin{document}
\blindtext\tnote{test1}

\tnote{test2}

\tnote{test3} \tnote{test4}

No empty space added. The notes are stacked nicely -- with a warning during
compilation.
\end{document}

This way the \tnote command does nothing if you didn't pass the draft-option, if you passed it the contents will be placed into the margin in blue color. enter image description here

  • marginpar... I thought I already did but had difficulties. I try it out again and will come back after the test. – towi May 11 '17 at 20:53
  • @towi depending on your document the placement can be a bit odd. This might be caused by the geometry-package if you don't specify the marginparwidth and marginparsep options. – Skillmon May 12 '17 at 18:16

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.