Skip to content

Instantly share code, notes, and snippets.

@prithwi
Last active August 27, 2020 21:11
Show Gist options
  • Save prithwi/2c5b4cbc23fc257998b02b795cca80e5 to your computer and use it in GitHub Desktop.
Save prithwi/2c5b4cbc23fc257998b02b795cca80e5 to your computer and use it in GitHub Desktop.
Simple tricks to add notes to latex margins

todonotes provides a nice method to add notes in latex document in the margin. However, it doesn't work properly with latex documents with muli-level \input statements (eg. inputing a tex in another tex file that was inputted in the main file).

A simple solution is to use the following package:

\usepackage{marginnote}  % to add notes to margins
\usepackage{amssymb}     % for special latex symbols
\usepackage{xcolors}     % for more broader range of latex colors

A few snippets that can then be used to add notes and also turn off the notes during final submission is as below:

\begin{document}

% put the notes on the left and todo on right margin
\newcommand{\todo}[2][NA]{{\color{red} $\rhd$\marginnote{[Assignee #1]: #2}}}
\newcommand{\note}[2][NA]{{\reversemarginpar \color{blue} $\lhd$\marginnote{[#1 says]: #2}}}

% uncomment following line before submitting
% \renewcommand{\note}[2][NA]{}  
% \renewcommand{\todo}[2][NA]{}  

TODO: sync the comment/uncommenting with the draft/final status of the latex doc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment