\documentclass[a4paper,12pt]{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{smartnotes}

\begin{document}

\title{Package example use for \texttt{smartnotes}}
\date{}
\maketitle

\bigskip
{\Large \textbf{Automatic placement}}
\vspace{0.8cm}

This sentence places a note automatically\note{This note is placed automatically according to where it appears in the text area.}
while the text continues normally.

\bigskip\bigskip

Automatic placement also works across the line, as you will see just about now: here is a note in the left half\note{Auto Left}
\hfill and here is one in the right\note{Auto Right}.
 half
\bigskip
\vspace{1cm}

{\Large \textbf{Forced placement}}
\vspace{0.8cm}

The package also allows explicit control. \newline \noindent
This note\note[right]{This note is forced to the right margin, regardless of where it appears in the line.} is forced to the right even though it is attached near the beginning of the sentence.

\vspace{1.5cm}

Likewise, this note is forced to the left while the sentence finishes at the far\note[left]{Forced left} right.\hfill

\bigskip
\vspace{1cm}

{\Large \textbf{Changing the box shape}}
\vspace{0.8cm}

The default shape is rounded\note{Rounded boxes are the package default.}, but a local option can switch\note[rectangle]{This note uses the rectangular box shape instead of the default rounded shape.} to a rectangular note when sharper corners are preferred.

\bigskip
\vspace{1cm}

\newpage
{\Large \textbf{Changing colours locally}}
\vspace{0.8cm}

A note can also be used to mark different kinds of remarks. For example, this one might indicate a correction\note[backgroundcolor=red!15,linecolor=red]{Please recheck this argument before the final version.}
while this one could be a general reminder\note[backgroundcolor=green!20,linecolor=green!50!black]{Add the missing reference once the bibliography is finalized.}.

\bigskip
\vspace{1cm}

{\Large \textbf{Switching off the fancy line}}
\vspace{0.8cm}

The package normally uses the fancy connector line\note{This note uses the default fancy connector.},
but it can also be disabled for a simpler visual style\note[nofancyline]{This note is shown without the fancy connector line.} when a cleaner margin is preferred.

\bigskip
\vspace{1cm}

{\Large \textbf{Stacking behaviour}}
\vspace{0.8cm}

When several notes are attached close to one another on the same side of the page, the package stacks them vertically instead of letting them overlap. This is useful when reviewing a dense paragraph with several short remarks in quick succession.

First one appears here\note{First note.} and
the second\note{Second note that got stacked} note can be added nearby as well without the margin notes colliding.

\vspace{1cm}

The spacing between stacked notes can be adjusted globally with the \verb|stacksep| option in \verb|\notesetup|.

\bigskip
\vspace{1cm}

{\Large \textbf{Global setup}}
\vspace{0.8cm}

Global settings can be changed in the preamble using \verb|\notesetup|. For example, one might use:

\begin{verbatim}
\notesetup{
  width=2.4cm,
  sep=10pt,
  backgroundcolor=yellow!20,
  linecolor=black,
  rectangle,
  font={\small\ttfamily\bfseries}
  fancyline
}
\end{verbatim}

This makes it easy to adapt the general appearance of the notes for a particular document while still allowing local overrides where needed.



\end{document}