The context is collaborative latex writing using GIT and some online repository. I have a simple macro that uses a counter to index notes in a pdf, which puts a number in the margin:
\documentclass[11pt]{article}
\usepackage[fulladjust]{marginnote}
\usepackage[dvipsnames]{xcolor}
\newcounter{mynote}
\newcommand{\note}[1]{% a simple margin note
\refstepcounter{mynote}% step counter
{\color{red} ToNote;~#1
\marginnote{\color{red}\mbox{\textbf{[\themynote]}}}}% the note
}
\begin{document}
Here is some text \note{with a note.}
\end{document}
The problem with this solution is that the labels will change (in general) each time a new note is added in the text. This makes it hard to discuss when several versions are pushed/merged, with text edits and new notes added.
I have no MWE for this as I am not sure how I should proceed: would writing some data in an auxiliary file be optimal ? Maybe there would be a way to use the hash of the last commit ? That would probably lead to rather random and annoying label names though.
%
after#1
(otherwise you get at least a word space and possibly a line break between the text and the node holding the marginpar)