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.
%at the end of your\newcommand*line, so that TeX sees no space before\leavevmode– ShreevatsaR Nov 01 '17 at 16:36}of the\annotinvocation. – Steven B. Segletes Nov 01 '17 at 16:40\newcommand*{\annot}[1]{\leavevmode\marginpar{#1}\ignorespaces}which will ignore the spaces after the closing of the argument – Steven B. Segletes Nov 01 '17 at 16:41%everywhere, from now on! – thymaro Nov 01 '17 at 16:42%everywhere [...]". Ask @egreg about this topic ;) – TeXnician Nov 01 '17 at 16:44\let\origmarginpar\marginpar \renewcommand{\marginpar}[2][]{\mbox{}\origmarginpar[#1]{#2}}– Matthias Nov 01 '17 at 16:52