# Margin notes aligned with top of paragraph

When I put a margin not at the beginning of a paragraph, latex assumes it is at the end of the previous paragraph. I'd like the margin note to align with the top of the paragraph it is in. It seems this is possible with individual notes. How do I achieve that globally without having to put the margin note inside the text of the paragraph. Follows the MWE:

\documentclass{article}
\usepackage{lipsum}
\begin{document}

\marginpar{some note} This is what it should look like in the source code. \lipsum[1]

\marginpar{another note} Good in source code, but bad in PDF. \lipsum[2]

Cluttered\marginpar{yet another note}source code, but produces desired effect in PDF. \lipsum[3]

\leavevmode\marginpar{individual solution to be implemented globally} Would be nice, you know. \lipsum[4]

\end{document}


EDIT:

I tried with a \newcommand:

\newcommand*{\annot}[1]{
\leavevmode\marginpar{#1}}
}


but

\annot{margintext}Text.


produces an extra indentation, so this is not the end of the solution. Actually this is the one that needs fixation.

• Try adding a % at the end of your \newcommand* line, so that TeX sees no space before \leavevmode – ShreevatsaR Nov 1 '17 at 16:36
• Remove the blank space after the closing } of the \annot invocation. – Steven B. Segletes Nov 1 '17 at 16:40
• I always wondered why people put a space after their newcommand and environments and stuff. I always thought it was to prepare comments or something bland... well, thanks. – thymaro Nov 1 '17 at 16:40
• Alternately, you can define \newcommand*{\annot}[1]{\leavevmode\marginpar{#1}\ignorespaces} which will ignore the spaces after the closing of the argument – Steven B. Segletes Nov 1 '17 at 16:41
• Then you should read tex.stackexchange.com/questions/34844/… – TeXnician Nov 1 '17 at 16:46