% ======================================================================
% scrlayer-notecolumn-example-en.tex
% Copyright (c) Markus Kohm, 2018-2024
%
% This file is part of the LaTeX2e KOMA-Script bundle.
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, version 1.3c of the license.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX 
% version 2005/12/01 or later and of this work.
%
% This work has the LPPL maintenance status "author-maintained".
%
% The Current Maintainer and author of this work is Markus Kohm.
%
% This work consists of all files listed in MANIFEST.md.
% ======================================================================
%
% Example file for the chapter about scrlayer-notecolumn 
% of the KOMA-Script guide
% Maintained by Markus Kohm
%
% ============================================================================
\documentclass{scrartcl}
\usepackage{lmodern}
\usepackage{xcolor}

\usepackage{contract}
\setkomafont{contract.Clause}{\bfseries}
\setkeys{contract}{preskip=-\dp\strutbox}

\usepackage{scrlayer-scrpage}
\usepackage{scrlayer-notecolumn}

\newlength{\paragraphscolwidth}
\AfterCalculatingTypearea{%
  \setlength{\paragraphscolwidth}{.333\textwidth}%
  \addtolength{\paragraphscolwidth}{-\marginparsep}%
}
\recalctypearea
\DeclareNewNoteColumn[%
  position=\oddsidemargin+1in
           +.667\textwidth
           +\marginparsep,
  width=\paragraphscolwidth,
  font=\raggedright\footnotesize
       \color{blue}
]{paragraphs}

\begin{document}

\title{Commentary on the SCRACH}
\author{Professor R. O. Tenase}
\date{11/11/2011}
\maketitle
\tableofcontents

\section{Preamble}
The SCRACH is without doubt the most important law on the manners of humour
that has been passed in the last thousand years. The first reading took place
on 11/11/1111 in the Supreme Manic Fun Congress, but the law was rejected by
the Vizier of Fun. Only after the ludicrous, Manic Fun monarchy was
transformed into a representative, witty monarchy by W. Itzbold, on 9/9/1999
was the way finally clear for this law.

\section{Analysis}

\begin{addmargin}[0pt]{.333\textwidth}
  \makenote[paragraphs]{%
    \protect\begin{contract}
      \protect\Clause[title={No Joke without an Audience}]
      A joke can only be funny if is has an audience.
    \protect\end{contract}
  }
  This is one of the most central statements of the law. It is so fundamental
  that it is quite appropriate to bow to the wisdom of the authors.

  \syncwithnotecolumn[paragraphs]\bigskip
  \makenote[paragraphs]{%
    \protect\begin{contract}
      \protect\Clause[title={Humor of a Culture}]
      \setcounter{par}{0}The humour of a joke can be determined by the
      cultural environment in which it is told.

      The humour of a joke can be determined by the cultural environment in
      which it acts.
    \protect\end{contract}
  }
  The cultural component of a joke is, in fact, not negligible. Although the
  political correctness of using the cultural environment can easily be 
  disputed, nonetheless the accuracy of such comedy in the appropriate
  environment is striking. On the other hand, a supposed joke in the wrong
  cultural environment can also be a real danger for the joke teller.
\end{addmargin}

\end{document}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% coding: utf-8
%%% ispell-local-dictionary: "en_GB"
%%% eval: (flyspell-mode 1)
%%% End:
