[Tex/LaTex] how can i make the marginpar note have a number like footnote command does

footnotesmarginpar

how can i make the marginpar note have a number like footnote command does?
just like this picture show,
this picture is going to show the marginpar note have the auto numbered label like footnote command does

Best Answer

\documentclass{article}
\usepackage{blindtext}
\newcounter{mparcnt}
\renewcommand\themparcnt{\textbf{\arabic{mparcnt}: }}
\newcommand\mpar[1]{\refstepcounter{mparcnt}\marginpar{\themparcnt#1}}

\begin{document}
\mpar{test}\blindtext
\mpar{test\label{p:test}}\blindtext
\mpar{test}\blindtext
\mpar{test}\blindtext

See margin~\ref{p:test} for a labeltest
\end{document} 

enter image description here

Related Question