Absolute vertical positioning of marginnote

marginnotevertical alignment

I am using the "marginnote" package in a document as shown in the following example:

\documentclass{report}
\usepackage{marginnote}
\begin{document}
Richard of York gave battle in vain.\marginnote{This is a margin note}[1.0cm]
\end{document}

I can offset the margin note vertically using the value in brackets, but this offsetting is relative to the margin note's default position. What I want to do is define an absolute vertical position for the margin note – say, 2 inches from the top of the page – irrespective of the margin note's default location.

Is this possible, either with marginnote or with another package?

Best Answer

This uses tikzpagenodes. Like \marginnote, it takes two runs.

\documentclass{report}
\usepackage{tikzpagenodes}
\usepackage{showframe}

\newcommand{\marginpos}[2][0pt]{\tikz[overlay,remember picture]%
  {\node[yshift=#1, below right, text width=\marginparwidth, inner sep=0pt, font=\sloppy]
    at (current page marginpar area.north west)
    {#2};}}

\begin{document}
Richard of York gave battle in vain.\marginpos[-2in]{This is a margin note}
\end{document}
Related Question