I would like to add side notes to my document as in the example below, but I do not know how. I will be grateful for any suggestions.
A default \todo
from the todonotes
package does something similar to what you're asking, so if you're not using todonotes
already, the following might be useful.
\todo
does draw a coloured box around the margin note, but changing the bordercolor
and backgroundcolor
as below removes that.
\documentclass{article}
\usepackage[
bordercolor=none,
backgroundcolor=none,
linecolor=gray
]{todonotes}
\begin{document}
Bla bla etc., uzw., osb., Lorem ipsum dolor \todo{Foo bar}{} and so on and so forth.
\end{document}
It's possible to redefine some macros to get output more like your image.
\documentclass{article}
\usepackage[
bordercolor=none,
backgroundcolor=none,
linecolor=gray
]{todonotes}
\usetikzlibrary{arrows.meta}
\tikzset{
smallcirc/.tip={Circle[width=2pt,length=2pt]},
% connectstyle is used for the line drawing to the marginnote,
% add the arrow tip on each end, and make it thin
connectstyle/.append style={smallcirc-smallcirc,thin}
}
\makeatletter
\renewcommand{\@todonotes@drawLineToRightMargin}{%
\begin{tikzpicture}[remember picture, overlay]%
\draw[connectstyle]%
(inText) -- ([yshift=-0.2cm] inText)% %% <--- added "(intext) --"
-| (inNote.west);% %% <--- removed "-| ([xshift=-0.2cm] inNote.west)"
\end{tikzpicture}%
}%
\renewcommand{\@todonotes@drawLineToLeftMargin}{%
\begin{tikzpicture}[remember picture, overlay]%
\draw[connectstyle]%
(inText) -- ([yshift=-0.2cm] inText)% %% <--- added "(intext) --"
-| (inNote.west);% %% <--- removed "-| ([xshift=-0.2cm] inNote.west)"
\end{tikzpicture}%
}%
\makeatother
\begin{document}
Bla bla etc., uzw., osb., Lorem ipsum dolor \todo{Foo bar}{} and so on and so forth.
\end{document}
todonotes
package does something very similar. – Torbjørn T. Nov 17 '17 at 18:29