MarginNote – Adjusting Vertical Position of Margin Notes

marginnote

I want the first line of my margin notes—which are set in \small size—to be at the height of the baseline of the body text, like this:

enter image description here

My problem is that using something simple like

\documentclass{article}
\usepackage{marginnote}
\renewcommand{\marginfont}{\small}
\begin{document}
What can I do to align the first line of the marginnote?\marginnote{D-D-D-Drop the baseline!}
\end{document}

results in

enter image description here

Best Answer

You can write your own with the tabto package. EDITED to flip \mynote margin on every page. You can choose to fix the \mynote in a single margin (left or right) by eliminating the \AddEverypageHook and setting \pagesense to R or L as desired.

\documentclass{article}
\usepackage{marginnote}
\usepackage{lipsum}
\usepackage{tabto,everypage}
\def\pagesense{R}
\AddEverypageHook{\if R\pagesense\gdef\pagesense{L}\else\gdef\pagesense{R}\fi}
\renewcommand{\marginfont}{\small}
\newcommand\mynote[1]{%
  \if R\pagesense%
    \tabto*{\dimexpr\textwidth+\marginparsep\relax}%
  \else%
    \tabto*{\dimexpr-\marginparsep-\marginparwidth\relax}%
  \fi%
  \smash{\parbox[t]{\marginparwidth}{\small#1}}%
  \tabto*{\TabPrevPos}%
  {}%
}
\textwidth=3.9in
\begin{document}
Original marginnote\par
What can I do to align the first line of the marginnote?\marginnote{D-D-D-Drop the baseline!} Here I continue the text.
\vspace{.2in}

Revised mynote\par
What can I do to align the first line of the marginnote?\mynote{D-D-D-Drop the baseline!} Here I continue the text.

\lipsum[1-5]

Another test.\mynote{I should be to the left}

\lipsum[6-10]

Last test.\mynote{I'm back on the right}
\end{document}

enter image description here

enter image description here