Consider the following LaTeX code, which contains an index entry my index
.
\documentclass{scrartcl}
\usepackage{showidx}
\begin{document}
Hello, world!\index{myindex}
\end{document}
This typesets as follows, with the index keyword shown in the margin:
If the line \usepackage{showidx}
is deleted or commented out:
\documentclass{scrartcl}
% \usepackage{showidx}
\begin{document}
Hello, world!\index{myindex}
\end{document}
the index keyword disappears from the margin:
A similar mechanism exists for labels using the showlabels
package:
\documentclass{scrartcl}
\usepackage{showlabels}
\begin{document}
Hello, world!\label{mylabel}
\end{document}
This produces:
whereas deleting or commenting out the line \usepackage{showlabels}
produces, as before:
Question
Is there a similar mechanism for margin notes? Consider, for example, the following piece of LaTeX code containing a margin note:
\documentclass{scrartcl}
\begin{document}
Hello, world!\marginpar{A margin note.}
\end{document}
This code typesets as follows:
Is it possible to easily hide all margin notes? More intricately, is it possible to assign identifiers to margin notes (in such a way that several notes can share a single identifier), and then to hide only those notes associated with certain identifiers?
A putative example
A putative piece of LaTeX code in which margin notes are assigned identifiers:
\documentclass{scrartcl}
\usepackage{lipsum}
\begin{document}
\lipsum[1][1-4]\marginpar[tempnote]{1st margin note}
\lipsum[2][1-4]\marginpar{2nd margin note}
\lipsum[3][1-4]\marginpar[tempnote]{3nd margin note}
\end{document}
This would produce:
Now the addition of the putative line \usepackage{hidemarginpar}[tempnote]
to the preamble:
\documentclass{scrartcl}
\usepackage{hidemarginpar}[tempnote]
\usepackage{lipsum}
\begin{document}
\lipsum[1][1-4]\marginpar[tempnote]{1st margin note}
\lipsum[2][1-4]\marginpar{2nd margin note}
\lipsum[3][1-4]\marginpar[tempnote]{3nd margin note}
\end{document}
would produce: