In a 200 page document I have 20-30 portions, 2-5 sentences long usually, scattered throughout that discuss something about statistics. My thought is to add a marginpar for each statistics portion.

My question is whether I can label each marginpar uniquely so that I am able to ref-er to it (and thus to the few sentences on statistics). [While tagging this question, marginnote appeared, and that might be an alternative to be labelled.)

EDIT: The reference to another question that shows how to number marginpar items, like footnotes are numbered sequentially, is very helpful, but doesn't explain how then to refer to a numbered marginpar later in the document.

If this is possible, it seems it will require a counter (need counter to refer to text that has been labeled). But being a beginner, I don't know whether the basic idea is a dead end let alone how to code it.

I am using R, RStudio, and the knitr package on Windows.

  • Your question leaves all the effort to our community, even typing the essentials of a TeX document such as \documentclass{}...\begin{document} etc. As it is, most of our users will be very reluctant to touch your question, and you are left to the mercy of our procrastination team who are very few in number and very picky about selecting questions. You can improve your question by adding a minimal working example (MWE) that more users can copy/paste onto their systems to work on. If no hero takes the challenge we might have to close your question. Apr 1 '17 at 13:26
  • Related: tex.stackexchange.com/questions/137546 (googled marginpar latex reference) Apr 1 '17 at 13:53

EDIT: As Dr. Manuel Kuehner mentioned in the comments, there is a package called marginnote, therefore the naming of the provided code is perhaps bad. Because of that I changed the \marginnote to \mymarginnote

This is a small setup, which allows what (I think) you want:



        \refstepcounter{marginnotenumber}\label{#1}\themarginnotenumber: #2%

\section{first section}
\mymarginnote{not:mylab}{This is a marginnote}
\section{second section}
also see marginnote \ref{not:mylab}.

In a book (containing chapters) you might want to define the counter like this:

  • There is also a package called marginnote(ctan.org/pkg/marginnote). Maybe it's better to choose another name to avoid confusion. It is from the author of the KOMA-Script (ctan.org/author/kohm). Apr 1 '17 at 13:28
  • Yeah, I guess you're right. I'll edit my answer. And sorry, that I did touch the question despite there is no MWE :)
    – Skillmon
    Apr 1 '17 at 13:30

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