2

First of all, I am sorry because I cannot describe the expected behavior well with words, but I hope the image explains it better.

  • How can I make the text in the \sidenote command from the sidenotes package "hang"?

  • I want the text in the side note aligned at the red line, just as it works in the foot note using the \usepackage[hang]{footmisc}.

Is there a way to make it work?

Thank you in advance.

enter image description here

MWE:

\documentclass[paper=a4, DIV=6]{scrartcl}
\usepackage[utf8]{inputenc}

\usepackage{blindtext}

\usepackage{sidenotes} \usepackage[hang]{footmisc}

\begin{document}

Hello World!\footnote{\blindtext}\sidenote{\blindtext}

\end{document}

1 Answers1

2

I grabbed the macro in the sidenotes package that places the sidenote mark and text and revised it. What I did was horizontally shift the mark leftward using a right-aligned, zero-width makebox: \makebox[0pt][r]{\textsuperscript{\thesidenote}{}~}. Later, outside of the macro, I shifted the \marginparsep 9pt to the right. I also increased the \marginparwidth by 9pt as well. Here is the result.

EDITED to address the issue when an optional argument (sidenotemark) is specified.

\documentclass[paper=a4, DIV=6]{scrartcl}
\usepackage[utf8]{inputenc}

\usepackage{lipsum}

\usepackage{sidenotes} \usepackage[hang]{footmisc} \makeatletter \RenewDocumentCommand \sidenotetext { o o +m } { \IfNoValueOrEmptyTF{#1} { @sidenotes@placemarginal{#2}{% \makebox[0pt][r]{% <--THIS WAS ADDED \textsuperscript{\thesidenote}{}~% }% <--THIS WAS ADDED #3} \refstepcounter{sidenote} } {@sidenotes@placemarginal{#2}{% \makebox[0pt][r]{% <--THIS WAS ADDED \textsuperscript{#1}~% }% <--THIS WAS ADDED #3}} } \makeatother \marginparwidth=\dimexpr\marginparwidth+9pt% <--THIS WAS ADDED \marginparsep=\dimexpr\marginparsep+9pt% <--THIS WAS ADDED \begin{document}

Hello World!\footnote{\lipsum[4]}\sidenote{This is the text of my sidenote. I want it to hang.}

\lipsum[2]\sidenote[*]{This is a secondary test when an optional argument is specified}

\end{document}

enter image description here