4

I am using the marginnote package in combination with scrbook. Normally the first paragraph after a heading is not indented. When I now use \marginnote at the beginning of the first paragraph it gets indented. Since I want to have the margin notes at the height of the first line of the paragraph I cannot move the \marginnote command to the end of the paragraph to avoid this behaviour.

enter image description here

MWE:

\documentclass{scrbook}

\usepackage{blindtext}
\usepackage{marginnote}

\begin{document}

\chapter{test}
\marginnote{1}\blindtext

\marginnote{2}\blindtext

\chapter{test}
\blindtext\marginnote{3}

\blindtext

\end{document}
2
  • 1
    Use \leavevmode\marginnote{1}. Or move the marginnote behind the first word. Mar 1, 2016 at 9:54
  • @UlrikeFischer Thank you, works as expected. If you wrtite this as an answer I will accept it.
    – Frank
    Mar 1, 2016 at 10:08

1 Answer 1

5

Use \leavevmode\marginnote{1}, or move the marginnote behind the first word.

\documentclass{scrbook}
\usepackage{marginnote}

\begin{document}
\section{test a}
\marginnote{1} bllb

\section{test b}
\leavevmode\marginnote{2}blub

\section{text c}
blub\marginnote{3} blub

\end{document}

enter image description here

5
  • This requires that there is no space between \leavevmode\marginnote{...} and the first word of the paragraph. For easy of use it would be preferable to separate the margin note onto one line of the file, and the start of the paragraph on another. This can be achieved by putting an % at the end, although I don't know why, and would prefer a solution where I wouldn't have to remember this. (Perhaps xspace can be utilised?).
    – oliversm
    Jan 29, 2019 at 15:29
  • @oliversm % at the end of line suppress the space introduced by the linebreak. The purpose of the xspace package is to insert spaces, not to suppress them. You would need a command with \ignorespaces. Jan 29, 2019 at 15:38
  • so do you see a way to neatly circumvent the need for a % here if you want whitespace/newlines.
    – oliversm
    Jan 29, 2019 at 15:42
  • 1
    @oliversm Something like \newcommand\mymarginnote[1]{\leavevmode\marginnote{#1}\ignorespaces} should work. Jan 29, 2019 at 15:57
  • 1
    works a treat. (I had thought \ignorespaces was a fictitious command you were suggesting be invented, rather than one that existed!).
    – oliversm
    Jan 29, 2019 at 16:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .