1

How can I get top-alignement for marginnotes?

I tried optional commands like heightadjust, deptadjust - without succes.

By the way: I need to use to use the marginnote-package.

enter image description here

\documentclass[fontsize=9pt, paper=a5]{scrreprt}
%\usepackage{showframe}

\usepackage[]{marginnote} % heightadjust deptadjust parboxrestore
\renewcommand*{\marginfont}{\sffamily\bfseries\footnotesize}

\usepackage{blindtext}
\begin{document}
\chapter{First Chapter}
{\Huge Huge to highlight the align effect.} \marginnote{121}

\blindtext 
\marginnote{122} \blindtext
\end{document}
cis
  • 8,073
  • 1
  • 16
  • 45

1 Answers1

3
\documentclass[fontsize=9pt, paper=a5]{scrreprt}
%\usepackage{showframe}

\usepackage[]{marginnote} % heightadjust deptadjust parboxrestore
\renewcommand*{\marginfont}{\sffamily\bfseries\footnotesize}
\newsavebox\ABox\newsavebox\BBox
\newcommand\MarginNote[2][]{\sbox\ABox{#1#2}\sbox\BBox{#2}\marginnote{#2}[-\the\dimexpr\ht\ABox-\ht\BBox]}

\usepackage{blindtext}
\begin{document}
\chapter{First Chapter}
{\Huge Huge to highlight the align effect.} \MarginNote[\Huge]{121}

\blindtext 
\MarginNote{122} \blindtext
\end{document}

Without the optional argument of \MarginNote it always uses the current font size.

enter image description here

user187802
  • 16,850