texlive[63355] Master: sidenotesplus (21may22)

commits+karl at tug.org commits+karl at tug.org
Sat May 21 22:19:24 CEST 2022


Revision: 63355
          http://tug.org/svn/texlive?view=revision&revision=63355
Author:   karl
Date:     2022-05-21 22:19:23 +0200 (Sat, 21 May 2022)
Log Message:
-----------
sidenotesplus (21may22)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/sidenotesplus/
    trunk/Master/texmf-dist/doc/latex/sidenotesplus/README.txt
    trunk/Master/texmf-dist/doc/latex/sidenotesplus/sidenotesplus.pdf
    trunk/Master/texmf-dist/doc/latex/sidenotesplus/tests-sidenoteplus.pdf
    trunk/Master/texmf-dist/doc/latex/sidenotesplus/tests-sidenoteplus.tex
    trunk/Master/texmf-dist/source/latex/sidenotesplus/
    trunk/Master/texmf-dist/source/latex/sidenotesplus/sidenotesplus.dtx
    trunk/Master/texmf-dist/source/latex/sidenotesplus/sidenotesplus.ins
    trunk/Master/texmf-dist/tex/latex/sidenotesplus/
    trunk/Master/texmf-dist/tex/latex/sidenotesplus/sidenotesplus.sty
    trunk/Master/tlpkg/tlpsrc/sidenotesplus.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/sidenotesplus/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/sidenotesplus/README.txt	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/sidenotesplus/README.txt	2022-05-21 20:19:23 UTC (rev 63355)
@@ -0,0 +1,18 @@
+LaTeX package sidenotesplus
+Copyright (c) Anton Vrba, 2022
+-------------------------------------------------------------------
+Version:
+  2022/05/20 1.00  Initial release
+Licence:
+  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 2008-05-04 or later.
+Abstract:
+   A package to manage margin notes, figures, tables and captions. 
+   Also body text can be extended into the margin for wide figures, 
+   tables and equation. Twoside symmetry is preserved. 
+   For biblatex users, routines for side references are provided.
+-------------------------------------------------------------------
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/doc/latex/sidenotesplus/README.txt
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/sidenotesplus/sidenotesplus.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/sidenotesplus/sidenotesplus.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/sidenotesplus/sidenotesplus.pdf	2022-05-21 20:18:01 UTC (rev 63354)
+++ trunk/Master/texmf-dist/doc/latex/sidenotesplus/sidenotesplus.pdf	2022-05-21 20:19:23 UTC (rev 63355)

Property changes on: trunk/Master/texmf-dist/doc/latex/sidenotesplus/sidenotesplus.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/sidenotesplus/tests-sidenoteplus.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/sidenotesplus/tests-sidenoteplus.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/sidenotesplus/tests-sidenoteplus.pdf	2022-05-21 20:18:01 UTC (rev 63354)
+++ trunk/Master/texmf-dist/doc/latex/sidenotesplus/tests-sidenoteplus.pdf	2022-05-21 20:19:23 UTC (rev 63355)

Property changes on: trunk/Master/texmf-dist/doc/latex/sidenotesplus/tests-sidenoteplus.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/sidenotesplus/tests-sidenoteplus.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/sidenotesplus/tests-sidenoteplus.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/sidenotesplus/tests-sidenoteplus.tex	2022-05-21 20:19:23 UTC (rev 63355)
@@ -0,0 +1,371 @@
+
+\documentclass[twoside,10pt,ragged]{article}
+\PassOptionsToPackage{%
+     a4paper,% landscape,%
+     bindingoffset=3mm,%
+     left=20mm,%
+     textwidth=110mm,%
+     marginparsep=10mm,%
+     marginparwidth=55mm,%
+     top=20mm,%
+     bottom=20mm,%
+     headsep=1\baselineskip,%
+     footskip = 2\baselineskip,%
+     includeall}   {geometry}%
+\usepackage  {geometry}
+\RequirePackage[utf8]{inputenc}\usepackage[T1]{fontenc}
+\usepackage[alerton]{sidenotesplus}
+
+\RequirePackage[svgnames,dvipsnames]{xcolor}
+\usepackage{lipsum}
+\usepackage{xcolor}
+%\setlipsum{%
+%  par-before = \begingroup\color{gray},
+%  par-after = \endgroup,
+%  sentence-before = \begingroup\color{gray},
+%  sentence-after = \endgroup
+%}
+
+%auto generate the bib file
+\usepackage{filecontents}
+%
+\begin{filecontents}{\jobname.bib}
+ at book{Tufte1990,
+	author = {Edward R. Tufte},
+	title = {Envisioning Information},
+	publisher = {Graphics Press},
+	year = {1990},
+	isbn = {0-9613921-1-8}
+}
+
+ at book{Tufte2006,
+	author = {Edward R. Tufte},
+	title = {Beautiful Evidence},
+	year = {2006},
+	publisher = {Graphics Press, {LLC}},
+	isbn = {0-9613921-7-7}
+}
+
+ at BOOK{bringhurst:2002,
+    title = {{T}he {E}lements of {T}ypographic {S}tyle},
+    publisher = {Hartley \& Marks Publishers},
+    year = {2013},
+    author = {Robert Bringhurst},
+    series = {Version 4.0: 20th Anniversary Edition},
+    address = {Point Roberts, WA, USA}
+    }
+
+ at Article{Einstein_1905e,
+  author    = {A. Einstein},
+  journal   = {Annalen der Physik},
+  title     = {Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?},
+  year      = {1905},
+  number    = {13},
+  pages     = {639--641},
+  volume    = {323},
+  doi       = {10.1002/andp.19053231314},
+  file      = {:Articles/Einstein_1905e - Does the Inertia of a Body Depend upon its
+  Energy-Content_.pdf:PDF;:Articles/Einstein_1905e - Ist Die Trägheit Eines Körpers Von Seinem
+  Energieinhalt Abhängig_.pdf:PDF},
+  groups    = {Relativity},
+  publisher = {Wiley},
+}
+
+\end{filecontents}
+\usepackage{mwe}
+% -- language: English --
+%
+\usepackage[english]{babel}
+% -- biblatex --
+\usepackage[backend=biber,style=nature]{biblatex} % xxx
+% the .bib file with the references
+\addbibresource{\jobname.bib}
+
+
+\usepackage{listings}
+\lstset{
+basicstyle=\sffamily,
+  lineskip=0pt,
+  aboveskip= 3pt,
+  belowskip= 0pt,
+}
+
+\usepackage{tabularx}
+\usepackage{amsmath}
+\usepackage{mathabx}
+\usepackage{tikz}
+\usetikzlibrary{calc}
+\usepackage{xspace}
+
+\captionsetup{font=small}  % Requires Package{caption} loaded in sidenoteplus
+
+
+
+
+% Author info
+\title{\textbf{\textsf{sidenotesplus}} Example Pages}
+\author{Anton Vrba}
+
+\date{	\today}
+
+         \PassOptionsToPackage{osf,sc}{mathpazo}%
+         \RequirePackage{mathpazo}
+         \linespread{1.05} % a bit more for Palatino
+
+\let\OldTexttt\texttt
+\renewcommand{\texttt}[1]{\OldTexttt{\color{MidnightBlue}{#1}}}
+
+
+\newcommand{\someimage}[3]{% Width, height, label
+\begin{tikzpicture}[x=1pt,y=1pt]% 4x3
+    \path [fill=black!25] (0,0) rectangle (#1,#2);
+    \draw [thick,black!40]
+        (0,0) -- (#1,#2)
+        (#1,0) -- (0,#2)
+        (0.5*#1,0) -- (0.5*#1,#2)
+        (0,0.5*#2) -- (#1,0.5*#2)
+    ;
+    \path [draw,very thick] (0,0) rectangle (#1,#2);
+     \node at (0.5*#1,0.5*#2) {\sffamily\Huge #3}
+    ;
+\end{tikzpicture}%
+}
+\newcommand \describe \paragraph
+
+
+\begin{document}
+
+
+	\maketitle
+	
+	\begin{abstract}
+		\noindent Here we demonstrate the features of \textsf{sidenotesplus},
+        a \LaTeX\xspace package to manage the margin notes, figures, tables and captions.
+        Also body text can be extended into the margin for wide figures, tables and equation.
+        Twoside symmetry is preserved. For biblatex users, routines for side references are
+        provided.
+	\end{abstract}
+
+
+Please first read \textsf{sidenotesplus.pdf} for the descriptions and usage of this package.
+This document served as a test platform while developing the package, and uses the standard
+\verb"article" \LaTeX\xspace class. The above right margin note list the first view
+lines\sidenote|-200pt|{%
+\ttfamily\upshape\textbackslash documentclass[twoside,10pt]\textbraceleft
+article\textbraceright\\
+\textbackslash PassOptionsToPackage\textbraceleft\\
+\makebox[2ex]{} a4paper,\\
+\makebox[2ex]{} bindingoffset=3mm,\\
+\makebox[2ex]{} left=20mm,\\
+\makebox[2ex]{} textwidth=110mm,\\
+\makebox[2ex]{} marginparsep=10mm,\\
+\makebox[2ex]{} marginparwidth=55mm,\\
+\makebox[2ex]{} top=20mm, bottom=20mm,\\
+\makebox[2ex]{} headsep=1\textbackslash baselineskip,\\
+\makebox[2ex]{} footskip = 2\textbackslash baselineskip,\\
+\makebox[2ex]{} includeall\textbraceright   \textbraceleft geometry\textbraceright\\
+\textbackslash usepackage  \textbraceleft geometry\textbraceright\\
+\textbackslash usepackage[alerton]\textbraceleft sidenotesplus\textbraceright\\
+} of the document preamble.
+
+Here we have three \sidenote<-15pt>{\textsf{\upshape\textbackslash sidenote<-15pt>} Test up}%
+\sidenote!Blue!{\textsf{\upshape\textbackslash sidenote!Blue!} Test colour}%
+\sidenote|-12mm|{\textsf{\upshape\textbackslash sidenote|-12mm|} but cannot float past \textsuperscript d above}
+ and the commas are inserted automatically between the text markers. But, if a line break
+ is between the two \verb"\sidenote " commands, then that requires a \% sign before the line
+ break.
+
+In many environments the floating option fails thus the fixed option is used. Example, a side
+note used in an equation:
+
+\begin{equation} \label{eq:123}
+  a=b\quad \text{see\sidenote<0pt>{test} }
+\end{equation}
+an was coded \verb+a=b\quad\text{see\sidenote<0pt>{test}}+. in \eqref{eq:123} Important here is
+the option \verb/<0pt>/ with any valid length.
+
+
+Side notes can be placed without \sidenotetext*|-20.pt|{A sidenotetext without a mark. Also
+testing if the command \emph{sidepar} works.
+\sidepar And here we have a new paragraph. And here we have a new paragraph. And here we have a
+new paragraph} references by using the \verb"\sidenote*" option
+
+
+
+Similar to \verb"\footnotemark"  and \verb"\footnotetext" the package provides macros
+\verb"\sidenotemark", \verb"\sidenotetext" and \verb"\sidenotetextbefore" with the same option
+set. In usage \verb"\sidenotemark" is followed by \verb"\sidenotetext", whereas
+\verb"\sidenotetextbefore" is followed by \verb"\sidenotemark".  The side not is placed relative
+to the \verb"\sidenotetext" commands.
+
+  \sidecitet*{bringhurst:2002} expertise is in typography, and the famous expression $E=mc^2$ was
+  first presented in this paper\sidecite{Einstein_1905e}.
+
+~
+
+\noindent  The above paragraph was coded:
+  \begin{verbatim}
+   \sidecitet*{bringhurst:2002} expertise is in typography,
+   and the famous expression $E=mc^2$ was first presented
+   in this paper\sidecite{Einstein_1905e}.
+  \end{verbatim}
+
+
+
+
+The command \verb"\sidealert" provides a temporary margin notes rendered in red or
+by the user’s defined \verb"!colour!". The alert mark\sidealert{This paragraph needs to be
+expanded} has zero width so it does not alter the main text layout
+and is also rendered in colour The package option \verb"alerton" needs to
+be specified in the document preamble, if omitted the alerts are not printed.
+
+\newpage
+
+\subsection*{Figure demonstration page A}
+\begin{figure}[h]
+\centering
+    \someimage{0.75*\textwidth}{70pt}{A}%
+        \caption{A: Short caption}
+    \label{imageA}
+\end{figure}
+
+\lipsum[3][4-8]
+
+\begin{figure}[h]
+\centering
+    \someimage{0.75*\textwidth}{70pt}{B}%
+    \caption[A: Long caption] {A: \emph{Long caption} \lipsum[3][1-3]}
+    \label{imageB}
+\end{figure}
+%
+%
+\begin{marginfigure}|-500pt|%
+    \someimage{\marginparwidth}{70pt}{C}%%
+    \margincaption {A: small rectangle in the margin.\label{rectangle1}}%
+\end{marginfigure}%
+%
+%
+\begin{margintable}|-500pt|
+\upshape
+\begin{tabularx}{\marginparwidth}{c X}
+ \hline
+ \multicolumn{2}{c}{Long Table Heading}\\
+ Item&Description\\
+ \hline
+ one& The width of this column depends on the
+ width of the table.\\
+ \hline
+ \end{tabularx}
+ \vskip-1.8ex
+ \margincaption{A: Some description \label{mtable1}}
+\end{margintable}
+%
+%
+\begin{marginfigure}|-500pt|%
+    \someimage{\marginparwidth}{70pt}{D}%%
+    \margincaption[A: Second margin]{A: Second margin figure with a very long label to take many
+    lines.\label{rectangle2}}%
+\end{marginfigure}%
+%
+%
+\sidenote*|-40pt|{The gaps between the above floats can be increase by setting the length of {\upshape \textbackslash
+\textsf{marginparpush} }, e.g {\upshape 15pt}. The effect is visible on next page}
+\setlength{\marginparpush}{15pt}
+%
+%
+\begin{figure}[h]
+\raggedinner
+    \sidecaption[A: Side caption]{A:  \emph{Side caption} with raggedinner command in figure
+    ennvironment with a lengthy text \lipsum[7][4-5] }
+    \label{imageD}
+    \someimage{0.75*\textwidth}{70pt}{E}%
+\end{figure}
+%
+%
+\begin{figure*}[h]
+\centering
+    \someimage{\linewidth}{100pt}{Full width figure}%
+    \caption[A: Full width] {\emph{Full width} \lipsum[12][1-5]}
+    \label{imagefw}
+\end{figure*}
+\lipsum[3][4-6]\sidenote<-10pt>{\lipsum[3][1-2]}\par\lipsum[7][4-9]
+\newpage
+
+\subsection*{Figure demonstration page B}
+\begin{figure}[h]
+\centering
+    \someimage{0.75*\textwidth}{70pt}{A}%
+        \caption{B: Short caption}
+    \label{imageA}
+\end{figure}
+
+\lipsum[3][4-8]
+
+\begin{figure}[h]
+\centering
+    \someimage{0.75*\textwidth}{70pt}{B}%
+    \caption[B: Long caption] {B: \emph{Long caption} \lipsum[3][1-3]}
+    \label{imageB}
+\end{figure}
+%
+%
+\begin{marginfigure}|-500pt|%
+    \someimage{\marginparwidth}{70pt}{C}%%
+    \margincaption {B: small rectangle in the margin.\label{rectangle1}}%
+\end{marginfigure}%
+%
+%
+\begin{margintable}|-500pt|
+\upshape
+\begin{tabularx}{\marginparwidth}{c X}
+ \hline
+ \multicolumn{2}{c}{Long Table Heading}\\
+ Item&Description\\
+ \hline
+ one& The width of this column depends on the
+ width of the table.\\
+ \hline
+ \end{tabularx}
+ \vskip-1.8ex
+ \margincaption{B: Some description \label{mtable1}}
+\end{margintable}
+%
+%
+\begin{marginfigure}|-500pt|%
+    \someimage{\marginparwidth}{70pt}{D}%%
+    \margincaption[B: Second margin]{B: Second margin figure with a very long label to take many
+    lines.\label{rectangle2}}%
+\end{marginfigure}%
+%
+%
+\sidenote*|-40pt|{Note the larger gaps between the above floats as {\upshape \textbackslash
+\textsf{marginparpush} } was set to {\upshape 15pt}.}
+%
+%
+\begin{figure}[h]
+\raggedinner
+    \sidecaption[B: Side caption]{B:  \emph{Side caption} with raggedinner command in figure
+    ennvironment \lipsum[7][4-5]}
+    \label{imageD}
+    \someimage{0.75*\textwidth}{70pt}{E}%
+\end{figure}
+%
+%
+\begin{figure*}[h]
+\centering
+    \someimage{\linewidth}{100pt}{Full width figure}%
+    \caption[B: Full width] {\emph{Full width} \lipsum[12][1-5]}
+    \label{imagefw}
+\end{figure*}
+\lipsum[3][4-6]\sidenote<-10pt>{\lipsum[3][1-2]}\par\lipsum[7][4-9]
+\newpage
+
+
+\newpage
+And a final check
+\listoffigures
+\listoftables
+
+
+
+\end{document}


Property changes on: trunk/Master/texmf-dist/doc/latex/sidenotesplus/tests-sidenoteplus.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/sidenotesplus/sidenotesplus.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/sidenotesplus/sidenotesplus.dtx	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/sidenotesplus/sidenotesplus.dtx	2022-05-21 20:19:23 UTC (rev 63355)
@@ -0,0 +1,1341 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2022 by Anton Vrba
+%
+% Home Page: https://github.com/anton-vrba/sidenotesplus
+%    Issues: https://github.com/anton-vrba/sidenotesplus/issues
+%
+%
+% LaTeX Package: sidenotesplus
+%
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3c of this license
+% or (at your option) any later version. 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 2008-05-04 or later.
+%
+% This work was inspired by: https://ctan.org/pkg/sidenotes by: Andy Thomas
+%
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Anton Vrba.
+%
+% This work consists of the files sidenotesplus.dtx and sidenotesplus.ins
+% and the derived filebase sidenotesplus.sty.
+%
+% \fi
+%
+% \iffalse
+%<*driver>
+\ProvidesFile{sidenotesplus.dtx}
+%</driver>
+%<package>\NeedsTeXFormat{LaTeX2e}[2020/10/01]
+%<package>\ProvidesPackage{sidenotesplus}
+%<*package>
+    [2022/05/20 1.00 rich text marginal notes, tables and figures ]
+%</package>
+%<package>\RequirePackage{marginnote} % provides an offset option for the marginals instead of a float
+%<package>\RequirePackage{caption} % handles the captions (in the margin)
+%<package>\RequirePackage{xparse} % new LaTeX3 syntax to define macros and environments
+%<package>\RequirePackage{calc}
+%<package>\RequirePackage{etoolbox} % provides \patchcmd
+%<package>\RequirePackage{l3keys2e}
+%<package>\RequirePackage{ifoddpage}
+%<package>\RequirePackage{mparhack} % get marginpar right
+%<package>\RequirePackage{xspace}
+%<package>\RequirePackage[strict]{changepage}
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{tabularx}
+\usepackage{xspace}
+\setlength{\textheight}{9.25in}
+\setlength{\headsep}{-0.25in}
+\EnableCrossrefs
+%\CodelineIndex
+\RecordChanges
+\begin{document}
+  \DocInput{sidenotesplus.dtx}
+%  \PrintIndex
+  \PrintChanges
+\end{document}
+%</driver>
+% \fi
+%
+%
+% \CharacterTable
+%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%   Digits        \0\1\2\3\4\5\6\7\8\9
+%   Exclamation   \!     Double quote  \"     Hash (number) \#
+%   Dollar        \$     Percent       \%     Ampersand     \&
+%   Acute accent  \'     Left paren    \(     Right paren   \)
+%   Asterisk      \*     Plus          \+     Comma         \,
+%   Minus         \-     Point         \.     Solidus       \/
+%   Colon         \:     Semicolon     \;     Less than     \<
+%   Equals        \=     Greater than  \>     Question mark \?
+%   Commercial at \@     Left bracket  \[     Backslash     \\
+%   Right bracket \]     Circumflex    \^     Underscore    \_
+%   Grave accent  \`     Left brace    \{     Vertical bar  \|
+%   Right brace   \}     Tilde         \~}
+%
+%
+%
+%
+% \GetFileInfo{sidenotesplus.dtx}
+% \title{The \textsf{sidenotesplus} package}
+% \author{Anton Vrba\\\small%
+% Home Page: \url{https://github.com/anton-vrba/sidenotesplus} \\\small
+%    Issues: \url{https://github.com/anton-vrba/sidenotesplus/issues }}
+% \date{Version \fileversion\xspace from \filedate}
+%
+% \maketitle
+%
+% \changes{1.0}{2022/05/15}{Initial Release}
+%
+% \begin{abstract}
+%  \noindent A package to manage the margin notes, figures, tables and captions.
+%  Also body text can be extended into the margin for wide figures, tables and equation.
+%  Twoside symmetry is preserved. For biblatex users, routines for side references are
+%  included.
+% \end{abstract}
+%
+% \paragraph*{Note:} Margin notes, figures and tables placements require up to
+%  three compilations to be as intended.
+%%
+% \paragraph*{Note:} This package is inspired by the package |sidenotes| authored by
+% Andy Thomas and has many features in common. But, compatibility is
+% not maintained between the two.
+%
+% \section{Usage}
+% \subsection{Package options}
+% Below the options that can be passed to the package |sidenotesplus|
+% with the package defaults listed first.
+%
+% ~
+%
+% \begin{tabularx}{\textwidth}{ r X }
+%  |mark=| & |alph, Alph, arabic, roman, Roman, fnsymbol| \\
+%  |font=| & |rm, sf|\\
+%  |size=| & |footnote, normal, small, script| \\
+%  |shape=| & | up, it, sl|\\
+%  |ragged| & switches to ragged outer margins\\
+%  |classic| & switches to a classic look\\
+%  |sepdiff=| & |1em|, or a valid length within reason \\
+%  |alerton| & switches on the rendering of the margin alerts \\
+% \end{tabularx}
+%
+% ~
+%
+% The normal page style is that margin notes are left-right justified with the
+% last line ragged to the outer edge. The option |ragged| changes this
+% style to ragged-outer, that is the left page's marginal notes are |\raggedleft|
+% and the right page's are |\raggedright|.
+%
+% The marginal note's reference number or mark is placed in the margin separator,
+% that is on the left page the mark is on the right hand side of the note.
+% The option |classic| always places the mark to the left of the marginal note.
+% This requires that the margin separator on the left page is slightly reduced if not
+% enough space is availabe to the page outer edge.
+%
+% \subsection{Modified \LaTeX\xspace commands}
+%
+% \DescribeMacro{\marginpar}
+% The LaTex command |marginpar{abc}| with only one
+% parameter it is modified to
+% |\marginpar[left styled abc]{right styled abc}|
+% maintaining page symmetry.
+% If called with two parameters nothing is changed
+%
+% \subsection{Marginal note commands}
+%
+% All marginal note commands have five options followed by the side note text
+% enclosed in braces. Each option has its own enclosing symbols. The option
+% sequence is fixed but not used options are omitted entirely, including their
+% enclosing sequence. The option sequence is \verb"*, ||, <>, (), !!" plus |{}|.
+%
+% ~
+%
+% % \begin{tabularx}{\textwidth}{ r X }
+%   |*| & margin note reference labels is omitted \\
+%   \verb+|float offset|+ & floating offset, negative is towards page top\\
+%   |<fixed offsett>| & fixed offset, negative is towards page top \\
+%   |(custom mark)| & any custom mark\\
+%   |!colour!|& any valid colour\\
+%   |{content}|& margin note content
+% \end{tabularx}
+%
+% ~
+%
+%  \noindent Note: All marginals placed with a fixed offset, that is with the |<fixed offset>|
+%  option can be overwritten by the marginals that float.
+%
+% ~
+%
+%
+% \DescribeMacro{\sidenote}
+% The |\sidenote| has five options
+%  \verb+*|offset|<offsett>(custom mark)!colour!+
+% all preceding the note |{content}|.
+% The options are defined by their enclosures \verb+*||,<>,(),!!+
+% and must be in the order listed above.
+%
+% Example: \verb"\sitenote|10pt|($\bigstar$){text}" is valid
+%
+% but \verb"\sitenote($\bigstar$)|10pt|{text}" will give an error
+%
+% ~
+%
+% \DescribeMacro{\sidenotetext}
+% \DescribeMacro{\sidenotemark}
+% \DescribeMacro{\sidenotetextbefore}  Similar to |\footnotemark|
+% and |\footnotetext| the macros |\sidenotemark|, |\sidenotetext|
+% and |\sidenotetextbefore| are provided, the latter two have the same
+% options as |\sidenote|. This is useful in placing margin notes in
+% environments where the |\sidenote| is not permitted.
+% The margin note is not positioned by the |\sidenotemark|, but rather it
+% is positioned relative to |\sidenotetext| or |\sidenotetextbefore|
+%
+%% ~
+%
+% \DescribeMacro{\sidealert}
+% These are temporary margin notes rendered in red
+% or by the user's defined |!colour!|. The package option |alerton| needs to be
+% specified in the document preamble. The alert mark has zero width so it does not
+% alter the main text layout and is also rendered in colour. The alert mark is
+% either numeric arabic (default), or alphabetic if the side note mark is set to
+% arabic
+%
+%
+% ~
+%
+% \DescribeMacro{\sidepar} Starts a new paragraph in the side note,
+% whereas |\\| begins a new line without indentation.
+%
+% ~
+%
+%\DescribeMacro{\sidecaption}
+% The \verb"\sidecaption*<offset>[short form]{long form}"
+% macro can be used from within figure or table environment and
+% the caption is placed in the margin adjacent to the figure or table
+% The float \verb+||+ is not an option here. Therefore, the caption might
+% overlap with other marginals. Then, these marginals have to be adjusted with
+% offset parameters. The formatting of the caption is done by the \emph{caption}
+% package by defining a \emph{sidecaption} style. Please refer to the
+% documentation of the caption package for information on styles. The macro can
+% be starred, which is analog to the regular starred caption (no numbering, no
+% tof entry). Use |\raggedinner| within the figure, or table, environment
+% to place these near the caption.
+%
+% ~
+%
+% \DescribeMacro{\raggedinner}
+% \DescribeMacro{\raggedouter} Are raggedleft or raggedright modes depending if
+% document is one or two sided and if the page is even or odd.
+%
+% ~
+%
+% \DescribeEnv{marginfigure}
+% The |marginfigure| environment puts a figure and its caption in the margin.
+% Instead of |\begin{figure}[htbp]| use \verb"\begin{marginfigure}|offset|<offset>".
+% Again, using an offset value switches the behaviour from float to fixed
+% position. The marginfigure has its own caption style named \emph{marginfigure}.
+%
+% ~
+%
+% \DescribeEnv{margintable}
+% The |margintable| environment works similar to marginfigure, but with table
+% environments. Use \verb"\begin{marginfigure}|offset|<offset>" instead of
+% |\begin{table}[htbp]|, its caption style is named \emph{margintable}.
+%
+% ~
+%
+% \DescribeMacro{\margincaption}
+% The |\margincaption| macro is used only in the two above environments
+% (|marginfigure| and |marginfigure|) and it is not to be confused with |\sidecaption|.
+% It as the same options as |\caption|
+%
+% ~
+%
+% \DescribeEnv{figure*}
+% The |figure*| environment is used to position figures across the full
+% page, i.e. the text width plus the margin. The algorithm has to distinguish
+% between recto and verso (left and right) pages and might need up to three
+% \LaTeX{} runs to provide the desired result. The corresponding caption style
+% is called \emph{widefigure}.
+% \DescribeEnv{table*}
+% The sister environment for tables is |table*|. Use \emph{widetable} to
+% change its caption style.
+%
+%
+% \DescribeEnv{text*}
+% The |text*| environment is used to render text across up to
+% the full page width. Page breaks are not permitted within this environment.
+% This environment is useful when extra width for equations is required.
+% The environment |\begin{text*}[0.5]| extends the text width by
+% |0.5*(\marginparwidth+\marginparsep)|,  omitting the option is equivalent
+% to specifying the option |[1]|,
+%
+%
+% \DescribeMacro{\sidecite}
+% \DescribeMacro{\sidecitet}
+% \DescribeMacro{\sidecitet*}
+% The |\sidecite|, |\sidecitet| and |\sidecitet*| provide citing
+% references in the margin and uses the package |biblatex| which has to be setup
+% outside the |sitenotesplus| package.
+% Example settings  in the document preamble:
+%
+% ~~~~|\usepackage[english]{babel}|
+%
+% ~~~~|\usepackage[backend=biber,style=nature]{biblatex}|
+%
+% ~~~~|\addbibresource{mybibfile.bib}|
+% \\The above three cite-commands use the same options as sidenote followed by the two
+% options of the |biblatex|'s |\fullcite| command. Margin citations are always with marks,
+% hence the |*| takes new meaning here.
+% The command |\sidecite{BibReference}| and |\sidecite*{BibReference}| are
+% equivalent, and both place a side note mark
+% and the citation reference in the side margin. |\sidecitet{BibReference}|
+% renders:  Author\textsuperscript{a}, where 'a' is side note mark, whereas |\sidecitet*{BibReference}|
+% is the possessive version and renders:  Author's\textsuperscript{a}.
+%
+%
+% \subsection{Packages loaded}
+%
+%   \begin{description}
+%     \item[marginnote]
+%        supports an alternative to \verb+\marginpar+ and creates non floating
+%        notes in the margin.
+%     \item[mparhack] to get \verb+\marginpar+ right
+%     \item[caption]
+%        allows to set figure and table captions in the margin and allows
+%        easier formatting of these captions. Please refer to the
+%        \emph{caption} manual for details on styles.
+%     \item[xparse] is used to take advantage of the improved \LaTeX3 syntax.
+%        All macros and environments are defined using this package.
+%     \item[l3keys2e] provides a key/value mechanism
+%     \item[xspace] provides the command |\xspace|
+%     \item[changepage] is used to correctly shift figure* and table*. It has
+%        to use the option [strict] to work properly. This might lead to an
+%        option clash, if the same package is loaded without this option.
+%     \item[ifoddpage] provides the command |\ifoddpage|
+%     \item[etoolbox]  provides the command |\patchcmd|
+%     \item[calc] provides calculation such as adding lengths
+%
+%  \end{description}%
+
+%
+% \StopEventually{}
+%
+% \section{Implementation}
+%
+% \iffalse
+%<*package>
+% \fi
+%
+%    \begin{macrocode}
+\newcommand \snptest {{\upshape Figure \thefigure:} And some text\xspace}
+
+\ExplSyntaxOn
+\DeclareExpandableDocumentCommand{\IfNoValueOrEmptyTF}{ m m m }
+{
+ \IfNoValueTF{#1}
+  {#2}
+  {\tl_if_empty:nTF {#1} {#2} {#3}}
+}
+\setcounter{topnumber}{4}
+\setcounter{bottomnumber}{4}
+\setcounter{totalnumber}{8}
+%    \end{macrocode}
+%
+% \begin{macro}{\snp at sidenoteformat}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \snp at sidenoteformat {} {%
+   \snp at size\snp at shape\snp at font\leavevmode%
+   \lineskip=0pt \lineskiplimit=0pt %
+   \tolerance=2000 \hyphenpenalty=300 \exhyphenpenalty=300%
+   \doublehyphendemerits=100000%
+   \finalhyphendemerits=\doublehyphendemerits
+   }
+\NewDocumentCommand \snp at sideformat {} {}
+\NewDocumentCommand \snp at sidecolor {} {}
+
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{-}
+% --
+%   \begin{macrocode}
+\NewDocumentCommand \snp at symbol {} {\alph}
+\NewDocumentCommand \snp at alertsymbol {} {\arabic}
+\NewDocumentCommand \snp at font {} {}
+\NewDocumentCommand \snp at shape{} {\itshape}
+\NewDocumentCommand \snp at size {} {\footnotesize}
+\NewDocumentCommand \snp at leftmarginstyle{} {}
+\NewDocumentCommand \snp at rightmarginstyle{} {}
+%
+%
+\bool_new:N \l at snp@margincaption
+\bool_new:N \l at snp@alerton
+\bool_new:N \l at snp@alertmarkon
+\bool_new:N \l at snp@ragged
+\bool_new:N \l at snp@symmetric
+\bool_new:N \l at snp@page
+
+\bool_set_false:N \l at snp@margincaption
+\bool_set_false:N \l at snp@alerton
+\bool_set_false:N \l at snp@alertmarkon
+\bool_set_false:N \l at snp@ragged
+\bool_set_true:N \l at snp@symmetric
+
+
+%
+\newlength{\snp at marginsepdiff}
+\setlength{\snp at marginsepdiff}{1ex}
+%    \end{macrocode}
+%\end{macro}
+
+%   \begin{macrocode}
+\keys_define:nn { sidenoteplus }
+{
+ mark .code:n = \str_case:nn {#1}%
+     {  {fnsymbol}{\RenewDocumentCommand \snp at symbol {}{\fnsymbol}}%
+        {Alph}{\RenewDocumentCommand \snp at symbol {}{\Alph}}%
+        {arabic}{\RenewDocumentCommand \snp at symbol {}{\arabic}
+                 \RenewDocumentCommand \snp at alertsymbol {} {\alph}}%
+        {Roman}{\RenewDocumentCommand \snp at symbol {}{\Roman}}%
+        {roman}{\RenewDocumentCommand \snp at symbol {}{\roman}}%
+        {Other}{}  },
+ font .code:n = \str_case:nn {#1}%
+      {  {sf}{\RenewDocumentCommand \snp at font {}{\sffamily}}%
+        {Other}{} },
+ size .code:n = \str_case:nn {#1}%
+      {  {small}{\RenewDocumentCommand \snp at size {}{\small}}%
+         {script}{\RenewDocumentCommand \snp at size {}{\scriptsize}}%
+         {normal}{\RenewDocumentCommand \snp at size {}{\normalsize}}%
+        {Other}{} },
+ shape .code:n = \str_case:nn {#1}%
+      {  {sl}{\RenewDocumentCommand \snp at shape{}{\slshape}}%
+         {up}{\RenewDocumentCommand \snp at shape{}{\upshape}}%
+         {it}{\RenewDocumentCommand \snp at shape{}{\itshape}}%
+        {Other}{} },
+ sepdiff .code:n = \setlength{\snp at marginsepdiff}{#1},
+ classic .code:n = \bool_set_false:N \l at snp@symmetric,
+ ragged .code:n = { \RenewDocumentCommand \snp at leftmarginstyle {}{\raggedleft}
+                    \RenewDocumentCommand \snp at rightmarginstyle {}{\raggedright}
+                    \bool_set_true:N \l at snp@ragged  },
+ alerton .code:n = {\bool_set_true:N \l at snp@alerton},
+}
+\ProcessKeysOptions { sidenoteplus }
+\bool_if:NTF \l at snp@ragged
+     {\setlength{\snp at marginsepdiff}{0pt} \bool_set_false:N \l at snp@symmetric}
+     {\relax}
+\bool_if:NTF \l at snp@symmetric {\setlength{\snp at marginsepdiff}{0pt}}{\relax}
+ \newcounter{sidenote}[page] % make a counter
+\setcounter{sidenote}{0} % init the counter
+ \newcounter{sidealert}[page] % make a counter
+\setcounter{sidealert}{0} % init the counter
+%    \end{macrocode}
+%
+% \begin{macro}{\snp at putmarkintext}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \snp at putmarkintext { m }
+{
+    \leavevmode
+    \ifhmode
+        \edef \x at sf {\the \spacefactor }
+        \nobreak
+    \fi
+    \bool_if:NTF \l at snp@alertmarkon
+    {\makebox[0pt]{\raisebox{0.3ex}{\textsuperscript {\normalfont \bf ---~{#1}~---\kern-0.6ex }}}}
+    {\hbox {\textsuperscript {\normalfont #1 }}}
+    \ifhmode
+        \spacefactor \x at sf
+    \fi
+    \relax
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\snp at multisign}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \snp at multisign { } {3sp}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\snp at multimarker}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \snp at multimarker { }
+{
+  \kern-\snp at multisign
+  \kern\snp at multisign\relax
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\snp at multichecker}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \snp at multichecker { }
+{
+  \dim_compare:nNnTF \lastkern = \snp at multisign
+  {\snp at putmarkintext{,}}
+  {}
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{environment}{@snp at llr}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentEnvironment{@snp at llr} {}%
+{
+  \setlength{\parindent}{0pt}
+  \setlength{\leftskip}{0pt plus 1fil}
+  \setlength{\rightskip}{0pt plus -1fil}
+}{\par}
+%    \end{macrocode}
+% \end{environment}
+%
+%
+% \begin{macro}{\marginpar}
+%    \begin{macrocode}
+\let\oldmarginpar\marginpar
+\renewcommand{\marginpar}[2][]{
+   \if\relax\detokenize{#1}\relax
+      \oldmarginpar[\snp at leftmarginstyle\snp at sidenoteformat{#2}]%
+                   {\snp at rightmarginstyle\snp at sidenoteformat{#2}}%
+   \else%two parameters, let them use their styling
+      \oldmarginpar[{#1}]{#2}%
+   \fi%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\snp at placemarginal}
+% --
+%
+%    \begin{macrocode}
+\renewcommand*{\raggedleftmarginnote}{}
+\renewcommand*{\raggedrightmarginnote}{}
+\renewcommand*{\marginfont}{}
+
+\NewDocumentCommand \snp at placemarginal {d!! m m }
+{
+   \IfNoValueOrEmptyTF{#1}
+   {
+     \if at twoside
+        \snp at isoddpage
+        {
+           \IfNoValueOrEmptyTF{#2}
+           {\marginpar{  #3 }}
+           {\marginnote{\snp at sidenoteformat #3}[#2]}
+        }
+        {
+        \bool_if:NTF \l at snp@symmetric
+        {
+           \IfNoValueOrEmptyTF{#2}
+           {\marginpar{\begin{@snp at llr} #3\end{@snp at llr}}}
+           {\marginnote{\begin{@snp at llr}\snp at sidenoteformat #3\end{@snp at llr}}[#2]}
+        }
+
+        {
+           \IfNoValueOrEmptyTF{#2}
+           {\marginpar{ #3}}
+           {\marginnote{\snp at sidenoteformat #3}[#2]}
+        }
+        }
+     \else
+        \IfNoValueOrEmptyTF{#2}
+        {\marginpar{ #3}}
+        {\marginnote{\snp at sidenoteformat #3}[#2]}
+     \fi
+   }
+   {
+     \if at twoside
+        \snp at isoddpage
+        {
+           \IfNoValueOrEmptyTF{#2}
+           {\marginpar{  \textcolor{#1}{#3} }}
+           {\marginnote{\snp at sidenoteformat  \textcolor{#1}{#3}}[#2]}
+        }
+        {
+        \bool_if:NTF \l at snp@symmetric
+        {
+           \IfNoValueOrEmptyTF{#2}
+           {\marginpar{\begin{@snp at llr} \textcolor{#1}{#3}\end{@snp at llr}}}
+           {\marginnote{\begin{@snp at llr}\snp at sidenoteformat  \textcolor{#1}{#3}\end{@snp at llr}}[#2]}
+        }
+        {
+           \IfNoValueOrEmptyTF{#2}
+           {\marginpar{\textcolor{#1}{#3}}}
+           {\marginnote{ \snp at sidenoteformat  \textcolor{#1}{#3}}[#2]}
+        }
+        }
+     \else
+        \IfNoValueOrEmptyTF{#2}
+        {\marginpar{ \textcolor{#1}{#3}}}
+        {\marginnote{ \snp at sidenoteformat  \textcolor{#1}{#3}}[#2]}
+     \fi
+   }
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\sidepar}
+% --
+%    \begin{macrocode}
+\NewDocumentCommand \sidepar {}
+{
+  \\\makebox[1em]{}
+}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sidenote}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \sidenote {s d|| d<> d() d!! m  }
+{
+  \IfBooleanTF{#1}
+  { % starred
+  \snp at sidenotemark*(#4)
+  \snp at sidenotetext[*]|#2|<#3>(#4)!#5!{#6}
+  }{ % unstarred
+\IfNoValueOrEmptyTF{#5} {
+  \snp at sidenotemark(#4)
+  \snp at sidenotetext[]|#2|<#3>(#4)!#5!{#6}
+  \snp at multimarker }
+  {
+  \snp at sidenotemark(#4)!#5!
+  \snp at sidenotetext[]|#2|<#3>(#4)!#5!{#6}
+  \snp at multimarker }
+
+  }
+}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sidealert}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \sidealert {s d|| d<> d() d!! m  }
+{
+   \bool_if:NTF \l at snp@alerton
+     {
+     \bool_set_true:N \l at snp@alertmarkon
+      \IfNoValueOrEmptyTF{#5}
+      {
+        \IfBooleanTF{#1}
+        { % starred
+          \snp at sidenotemark*(#4)
+          \snp at sidenotetext[*]|#2|<#3>(#4)!Red!{#6}
+        }{ % unstarred
+          \snp at sidenotemark(#4)!Red!{}
+          \snp at sidenotetext[]|#2|<#3>(#4)!Red!{#6}
+          \snp at multimarker
+        }
+      }{ \IfBooleanTF{#1}
+         { % starred
+           \snp at sidenotemark*(#4)
+           \snp at sidenotetext[*]|#2|<#3>(#4)!#5!{#6}
+         }{ % unstarred
+           \snp at sidenotemark(#4)!#5!{}
+           \snp at sidenotetext[]|#2|<#3>(#4)!#5!{#6}
+           \snp at multimarker
+         }
+      }
+   }
+   {\relax}
+   \bool_set_false:N \l at snp@alertmarkon
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \begin{macro}{\sidenotemark}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \sidenotemark {s d() d!! m }
+{
+  \IfBooleanTF{#1}
+  { % starred
+    \relax}
+  {% unstarred
+     \IfNoValueOrEmptyT{#3}
+       {\snp at sidenotemark (#2)}
+       {\snp at sidenotemark !#3!( #2)}
+  }
+  \xspace
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\snp at sidenotemark}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \snp at symbolnoteoralert {}{}
+\NewDocumentCommand \snp at sidenotemark {s d() d!! }
+{
+  \IfBooleanTF{#1}
+  { % starred
+    \relax}
+  {% unstarred
+     \snp at multichecker
+     \bool_if:NTF \l at snp@alertmarkon
+        { \refstepcounter{sidealert}
+          \RenewDocumentCommand \snp at symbolnoteoralert {}{\snp at alertsymbol{sidealert}} }
+       { \refstepcounter{sidenote}
+          \RenewDocumentCommand \snp at symbolnoteoralert {}{\snp at symbol{sidenote}} }
+     \IfNoValueOrEmptyTF{#3}
+     {
+       \IfNoValueOrEmptyTF{#2}
+         { \snp at putmarkintext{\snp at symbolnoteoralert } }
+         { \snp at putmarkintext{#2} }
+     }{
+        \IfNoValueOrEmptyTF{#2}
+          { \textcolor{#3} {\snp at putmarkintext{\snp at symbolnoteoralert}} }
+          { \textcolor{#3} {\snp at putmarkintext{#2}} }
+     }
+     \snp at multimarker
+  }
+}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\snp at onelineup}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand{\snp at onelineup}{}
+   {\par \vspace*{-1\baselineskip}}
+\NewDocumentCommand{\snp at onexlineup}{}
+   {\par \vspace*{-1.5\baselineskip}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\snp at leftnotelabel}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand{\snp at leftnotelabel}{ m }
+   {\makebox[0em][l]{\hspace*{0.9ex}#1}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\snp at rightnotelabel}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand{\snp at rightnotelabel}{ m }
+   {\makebox[0em][r]{#1\hspace*{0.9ex}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\snp at justifiedleftnotelabel}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand{\snp at justifiedleftnotelabel}{ m }
+   {\makebox[0em][l]{\hspace*{\marginparwidth+0.9ex}#1}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sidenotetext}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \sidenotetext {s d|| d<> d() d!! m  } {
+   \IfBooleanTF{#1}
+      { \snp at sidenotetext[*]|#2|<#3>(#4)!#5!{#6} }
+      { \snp at sidenotetext[]|#2|<#3>(#4)!#5!{#6} }
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\sidenotetextbefore}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \sidenotetextbefore {s d|| d<> d() d!! m  } {
+   \refstepcounter{sidenote}
+   \IfBooleanTF{#1}
+      { \snp at sidenotetext[*]|#2|<#3>(#4)!#5!{#6} }
+      { \snp at sidenotetext[]|#2|<#3>(#4)!#5!{#6} }
+    \addtocounter{sidenote}{-1}
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%    \begin{macrocode}
+\DeclareExpandableDocumentCommand{\IfsTF}{ m m m }
+{
+ \IfNoValueTF{#1}
+  {#2}
+  {\tl_if_empty:nTF {#1} {#2} {#3}}
+}
+%    \end{macrocode}
+% --
+%
+%    \begin{macrocode}
+ \newlength{\d at snp@offset}
+%    \end{macrocode}
+%
+% \begin{macro}{\snp at sidenotetext}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \snp at sidenotesymbol {}{}
+\NewDocumentCommand \snp at sidenotetext {o d|| d<> d() d!! m } {
+  \bool_if:NTF \l at snp@alertmarkon
+  {
+  \IfNoValueOrEmptyTF{#4}
+     {\RenewDocumentCommand \snp at sidenotesymbol {}{-~\snp at alertsymbol{sidealert}~-}}
+     {\RenewDocumentCommand \snp at sidenotesymbol {}{-~#4~-}}
+  }
+  {
+  \IfNoValueOrEmptyTF{#4}
+     {\RenewDocumentCommand \snp at sidenotesymbol {}{\snp at symbol{sidenote}}}
+     {\RenewDocumentCommand \snp at sidenotesymbol {}{#4}}
+  }
+  \IfNoValueOrEmptyTF{#2}
+     {\relax}
+     {\setlength{\d at snp@offset}{#2} \vspace*{ \d at snp@offset }}
+   \bool_if:NTF \l at snp@ragged
+   {
+   \if at twoside
+     \snp at isoddpage
+     {%odd page
+       {  \snp at placemarginal!#5!{#3}%--
+              {\snp at rightnotelabel{%
+                  \normalfont\IfsTF{#1}{\snp at sidenotesymbol}{\relax}}#6}
+       }
+     }
+     {%even page
+        {\snp at placemarginal!#5!{#3}%--
+             {\snp at justifiedleftnotelabel{\normalfont%
+                    \IfsTF{#1}{\snp at sidenotesymbol}{\relax}}
+                    \hspace*{\marginparwidth}  \snp at onelineup#6}
+        }
+     }
+   \else %not twoside
+     {\snp at placemarginal!#5!{#3}%--
+          {\snp at rightnotelabel{\normalfont%
+              \IfsTF{#1}{\snp at sidenotesymbol}{\relax}}#6}
+     }
+   \fi % ends if at twoside
+   }
+   {
+   \if at twoside
+     \snp at isoddpage
+     {%odd page
+          {\snp at placemarginal!#5!{#3}%--
+               {\snp at rightnotelabel{
+                   \normalfont\IfsTF{#1}{\snp at sidenotesymbol}{\relax}}#6}
+          }
+     }
+     {%even page
+        \bool_if:NTF \l at snp@symmetric
+           {
+             {\snp at placemarginal!#5!{#3}%--
+                  {\snp at justifiedleftnotelabel{
+                         \normalfont\IfsTF{#1}{\snp at sidenotesymbol}{\relax} }
+                   \hspace*{\marginparwidth}\snp at onelineup#6
+                  }
+             }
+          }
+          {
+             {  \snp at placemarginal!#5!{#3}%--
+                    {\snp at rightnotelabel{
+                      \normalfont\IfsTF{#1}{\snp at sidenotesymbol}{\relax}}#6 }
+             }
+          }
+     }
+   \else
+       {   \snp at placemarginal!#5!{#3}%--
+           {\snp at rightnotelabel{
+               \normalfont\IfsTF{#1}{\snp at sidenotesymbol}{\relax}}#6}
+       }
+   \fi
+   }
+  \IfNoValueOrEmptyTF{#2}
+     {\relax}
+     { \setlength{\d at snp@offset}{#2 *(-1)} \vspace*{{\d at snp@offset}}}
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\snp at raggedcaption}
+% --
+%    \begin{macrocode}
+
+\NewDocumentCommand \snp at raggedcaption {m }
+{
+   \if at twoside
+      \snp at isoddpage {#1}
+         {\bool_if:NTF \l at snp@symmetric {\begin{@snp at llr}#1\end{@snp at llr}} {#1}}
+   \else #1 \fi
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+%    \begin{macrocode}
+\DeclareCaptionStyle{sidecaption}{font=footnotesize}
+%    \end{macrocode}
+%
+% \begin{macro}{\sidecaption}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \snp at entrycap {} {}
+\NewDocumentCommand \snp at offsetcap {} {}
+\NewDocumentCommand \sidecaption {s d|| d<> d!! o m} {
+  \captionsetup{style=sidecaption}
+  \IfBooleanTF{#1}
+  { %starred
+  \marginnote{\caption*{\snp at raggedcaption{#6}}}
+          [\IfNoValueOrEmptyTF{#3} {0pt} {#3}]
+  }
+  { %unstarred
+  \marginnote{\caption[\IfNoValueOrEmptyTF{#5} {#6} {#5}]
+                      {\snp at raggedcaption{#6}}}
+          [\IfNoValueOrEmptyTF{#3} {0pt} {#3}]
+  }
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\istwosided}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \istwosided {m m} {
+\if at twoside #1 \else #2 \raggedleft \fi
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\raggedinner}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \raggedinner {} {
+\if at twoside
+     \snp at isoddpage {\raggedleft}{\raggedright}
+\else
+     \raggedleft
+\fi
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\raggedouter}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \raggedouter {} {
+\if at twoside
+     \snp at isoddpage {\raggedright}{\raggedleft}
+\else
+     \raggedleft
+\fi
+}
+%    \end{macrocode}
+% \end{macro}
+%
+
+% \begin{macro}{\margincaption}
+% --
+%    \begin{macrocode}
+\newlength \l at snp@belowcaption
+\NewDocumentCommand \margincaption {s o m }
+{
+\setlength \l at snp@belowcaption \belowcaptionskip
+\setlength{\belowcaptionskip}{1ex plus 0.3ex minus -0.1ex}
+  \IfBooleanTF{#1}
+  { %starred
+    \if at twoside
+        \snp at isoddpage
+        {
+          \IfNoValueOrEmptyTF{#2} {\caption*{#3}} {\caption*[#2]{#3}}
+        }
+        {
+        \bool_if:NTF \l at snp@symmetric
+        {
+          \IfNoValueOrEmptyTF{#2}
+            {\caption*[#3]{\begin{@snp at llr}#3\end{@snp at llr}}}
+            {\caption*[#2]{\begin{@snp at llr}#3\end{@snp at llr}}}
+        }
+        {
+           \IfNoValueOrEmptyTF{#2} {\caption*{#3}} {\caption*[#2]{#3}}
+        }
+        }
+    \else
+        \IfNoValueOrEmptyTF{#2} {\caption*{#3}} {\caption*[#2]{#3}}
+    \fi
+  }
+  { %unstarred
+    \if at twoside
+        \snp at isoddpage
+        {
+          \IfNoValueOrEmptyTF{#2} {\caption{#3}} {\caption[#2]{#3}}
+        }
+        {
+        \bool_if:NTF \l at snp@symmetric
+        {
+          \IfNoValueOrEmptyTF{#2}
+            {\caption[#3]{\begin{@snp at llr}#3\end{@snp at llr}}}
+            {\caption[#2]{\begin{@snp at llr}#3\end{@snp at llr}}}
+        }
+        {
+           \IfNoValueOrEmptyTF{#2} {\caption{#3}} {\caption[#2]{#3}}
+        }
+        }
+    \else
+        \IfNoValueOrEmptyTF{#2} {\caption{#3}} {\caption[#2]{#3}}
+    \fi
+  }
+\setlength \belowcaptionskip \l at snp@belowcaption
+}
+%    \end{macrocode}
+% \end{macro}
+
+%    \begin{macrocode}
+ \newsavebox{\b at snp@marginfigurebox}
+\DeclareCaptionStyle{marginfigure}{font=footnotesize,skip=1ex}
+%    \end{macrocode}
+%
+% \begin{environment}{marginfigure}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentEnvironment{marginfigure} { d|| d<> }
+{ % begin{} part
+  \begin{lrbox}{\b at snp@marginfigurebox}
+    \begin{minipage}{\marginparwidth}
+      \captionsetup{type=figure,style=marginfigure}
+}
+%    \end{macrocode}
+% \end{environment}
+%
+%    \begin{macrocode}
+{ % end{} part
+    \end{minipage}%
+  \end{lrbox}%
+
+   \IfNoValueOrEmptyTF{#1}
+      {\relax}
+      {\setlength{\d at snp@offset}{#1} \vspace*{ \d at snp@offset }}
+  \snp at placemarginal{#2}{\usebox{\b at snp@marginfigurebox} }
+  %~\snp at onexlineup \snptest }
+  \IfNoValueOrEmptyTF{#1}
+     {\relax}
+     { \setlength{\d at snp@offset}{#1 *(-1)} \vspace*{{\d at snp@offset}}}
+}
+%    \end{macrocode}
+% --
+%
+%   \upshape Figure \begin{macrocode}
+\newsavebox{\b at snp@margintablebox}
+\DeclareCaptionStyle{margintable}{font=footnotesize}
+%    \end{macrocode}
+%
+% \begin{environment}{margintable}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentEnvironment{margintable} { d|| d<> d() }
+{ % begin part
+  \begin{lrbox}{\b at snp@margintablebox}
+     \snp at sidenoteformat
+    \begin{minipage}{\marginparwidth}
+      \captionsetup{type=table,style=margintable}
+}
+%    \end{macrocode}
+% \end{environment}
+%
+%    \begin{macrocode}
+{ % end part
+    \end{minipage}
+  \end{lrbox}
+   \IfNoValueOrEmptyTF{#1}
+      {\relax}
+      {\setlength{\d at snp@offset}{#1} \vspace*{ \d at snp@offset }}
+  \snp at placemarginal{#2}{\usebox{\b at snp@margintablebox} }
+  \IfNoValueOrEmptyTF{#1}
+    {\relax}
+    {\setlength{\d at snp@offset}{#1 *(-1)} \vspace*{{\d at snp@offset}}}
+%
+
+%
+}
+%    \end{macrocode}
+% --
+%
+%    \begin{macrocode}
+\AtBeginDocument{%
+\newlength{\d at snp@extrawidth}
+\setlength{\d at snp@extrawidth}{\marginparwidth}
+\addtolength{\d at snp@extrawidth}{\marginparsep}  }
+%    \end{macrocode}
+%
+% \begin{macro}{\snp at isoddpage}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \snp at isoddpage {m m}
+      { \checkoddpage\ifoddpage #1 \else #2 \fi }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{environment}{@snp at autoadjustwidth}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentEnvironment{@snp at autoadjustwidth}{ m m }%
+{ % begin part
+\begin{adjustwidth}{0pt}{0pt}
+  \if at twoside
+     \snp at isoddpage{\begin{adjustwidth}{#1}{-#2}}%
+        {\begin{adjustwidth}{-#2}{#1}}
+  \else
+     \begin{adjustwidth}{#1}{-#2}
+  \fi
+}
+%    \end{macrocode}
+% \end{environment}
+%
+%    \begin{macrocode}
+{ % end part
+   \end{adjustwidth}\end{adjustwidth}
+}
+%    \end{macrocode}
+%
+% \begin{environment}{text*}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentEnvironment{text*}{ o }%
+{ % begin part
+ \begin{adjustwidth}{0pt}{0pt}
+ \IfNoValueOrEmptyTF{#1}
+ {
+  \if at twoside
+     \snp at isoddpage{\begin{adjustwidth}{0pt}{-\d at snp@extrawidth}}%
+        {\begin{adjustwidth}{-\d at snp@extrawidth*}{0pt}}
+  \else
+     \begin{adjustwidth}{0pt}{-\d at snp@extrawidth*}
+  \fi
+  }
+  {
+  \if at twoside
+     \snp at isoddpage{\begin{adjustwidth}{0pt}{-\d at snp@extrawidth*#1}}%
+        {\begin{adjustwidth}{-\d at snp@extrawidth*#1}{0pt}}
+  \else
+     \begin{adjustwidth}{0pt}{-\d at snp@extrawidth*#1}
+  \fi
+  }
+}
+%    \end{macrocode}
+% \end{environment}
+%
+%    \begin{macrocode}
+{  % end part
+\end{adjustwidth}\end{adjustwidth} \snp at placemarginal{}{}
+}
+%    \end{macrocode}
+%
+% \begin{environment}{figure*}
+%    \begin{macrocode}
+\RenewDocumentEnvironment{figure*}{ O{htbp} }
+{
+   \begin{figure}[#1]
+   \begin{@snp at autoadjustwidth}{}{\d at snp@extrawidth}
+   \begin{minipage}[c]{\linewidth}
+   \centering
+   \captionsetup{ margin={\d at snp@extrawidth/2,\d at snp@extrawidth/2}}
+}{  % end part
+   \end{minipage}
+   \end{@snp at autoadjustwidth}
+   \end{figure}
+    \snp at placemarginal{}{}
+  }
+%    \end{macrocode}
+% \end{environment}
+%
+% \begin{environment}{table*}
+%    \begin{macrocode}
+\RenewDocumentEnvironment{table*}{O{htbp} }
+{
+    \begin{table}[#1]
+    \begin{@snp at autoadjustwidth}{}{\d at snp@extrawidth}
+    \if at twoside
+        \snp at isoddpage{\raggedright}{\raggedleft}
+        \snp at isoddpage
+           {\captionsetup{margin={0pt,0pt}}  }
+           {\captionsetup{margin={-\d at snp@extrawidth,\d at snp@extrawidth}}  }
+    \else
+       \raggedright \captionsetup{margin={0pt,0pt}}
+    \fi
+}
+{ % end part
+    \end{@snp at autoadjustwidth}
+    \end{table}
+}
+%    \end{macrocode}
+% \end{environment}
+%
+% \begin{macro}{\sidecite}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \snp at before {} {}
+\NewDocumentCommand \snp at after {} {}
+\NewDocumentCommand \sidecite {s d|| d<> d() d!! o o m }
+%    \end{macrocode}
+% \end{macro}
+%
+%    \begin{macrocode}
+{ \IfNoValueOrEmptyTF{#6}
+  {\RenewDocumentCommand \snp at before {} {}}
+  {\RenewDocumentCommand \snp at before {} {#6}}
+  \IfNoValueOrEmptyTF{#7}
+  {\RenewDocumentCommand \snp at after {} {}}
+  {\RenewDocumentCommand \snp at after {} {#7}}
+  \sidenote|#2|<#3>(#4)!#5!{\kern-2.3pt\upshape\fullcite[\snp at before][\snp at after]{#8}}
+}
+%    \end{macrocode}
+%
+% \begin{macro}{\sidecitet}
+% --
+%
+%    \begin{macrocode}
+\NewDocumentCommand \sidecitet {s d|| d<> d() d!! o o m }
+{ \IfNoValueOrEmptyTF{#6}
+  {\RenewDocumentCommand \snp at before {} {}}
+  {\RenewDocumentCommand \snp at before {} {#6}}
+  \IfNoValueOrEmptyTF{#7}
+  {\RenewDocumentCommand \snp at after {} {}}
+  {\RenewDocumentCommand \snp at after {} {#7}}
+   \IfBooleanTF{#1}
+   {
+      \citeauthor{#8}'s\sidenote|#2|<#3>(#4)!#5!
+          {\kern-2.3pt\upshape\fullcite[\snp at before][\snp at after]{#8}}
+   }
+   {
+      \citeauthor{#8}\sidenote|#2|<#3>(#4)!#5!
+          {\kern-2.3pt\upshape\fullcite[\snp at before][\snp at after]{#8}}
+   }
+}
+%    \end{macrocode}
+% \end{macro}
+%
+\ExplSyntaxOff
+%
+%%
+%    \begin{macrocode}
+\newlength\marginparsepodd
+\newlength\marginparsepeven
+
+\setlength{\marginparsepodd}{\marginparsep}
+\setlength{\marginparsepeven}{\marginparsep-\snp at marginsepdiff}
+
+\makeatletter
+% First we patch \@addmarginpar
+% The \patchcmd command does a search and replace.
+\patchcmd{\@addmarginpar}                 % In this command
+         {\mph at orig@addmarginpar}         % ... replace this...
+         {\if at twoside\ifodd\c at page\relax  % ... with this
+              \marginparsep=\marginparsepodd  % Page is odd
+            \else
+              \marginparsep=\marginparsepeven  % Page is even
+            \fi
+          \else
+            \marginparsep=\marginparsepodd
+          \fi
+          \mph at orig@addmarginpar}
+         {}                                           % success
+         {\message{Error! Couldn't hook into command  % failure
+             `\string\@addmarginpar'}}
+
+% Now we patch \@mn@@@marginnote
+{%% Group to keep patching commands local
+  %
+  % Here we use a little trick to repeatedly patch the \@mn@@@marginnote
+  % command, replacing all instances of \kern\marginparsep with a
+  % conditional. We call \patch recursively each time on success, and stop
+  % when the patch fails (because all instances have been replaced).  If the
+  % patch fails the first time, we show an error message.
+  \def\patcherr{%
+    \message{Error! Couldn't hook into command `\string\@mn@@@marginnote'}}
+  \def\patchok{%
+    \let\patcherr\relax % Only display error if first patch fails
+    \patch              % Now patch again.
+  }
+  \def\patch{
+    \patchcmd{\@mn@@@marginnote}                   % In this command
+             {\kern\marginparsep}                  % ... replace this...
+             {\ifx\@mn at currpage\relax\else         % ... with this
+                \if at twoside\ifodd\@mn at currpage\relax
+                    \kern\marginparsepodd
+                  \else
+                    \kern\marginparsepeven
+                  \fi
+                \else
+                  \kern\marginparsepodd
+                \fi
+              \fi}
+             {\message{Patched!}\patchok}          % success (recurse)
+             {\patcherr}                           % fail
+  }
+  \message{Patching `\string\@mn@@@marginnote`!}
+  \patch
+  \global\let\@mn@@@marginnote\@mn@@@marginnote    % Make patch global
+}
+\makeatother
+\endinput
+%    \end{macrocode}
+
+
+%
+% \iffalse
+%</package>
+% \fi
+%
+% \Finale
+\endinput


Property changes on: trunk/Master/texmf-dist/source/latex/sidenotesplus/sidenotesplus.dtx
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/sidenotesplus/sidenotesplus.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/sidenotesplus/sidenotesplus.ins	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/sidenotesplus/sidenotesplus.ins	2022-05-21 20:19:23 UTC (rev 63355)
@@ -0,0 +1,64 @@
+%% Copyright (C) 2022 by Anton Vrba
+%%
+%% Home Page: https://github.com/anton-vrba/sidenotesplus
+%%    Issues: https://github.com/anton-vrba/sidenotesplus/issues
+%% --------------------------------------------------------------------------
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Anton Vrba.
+%%
+%% This work consists of the files sidenotesplus.dtx and sidenotesplus.ins
+%% and the derived filebase sidenotesplus.sty.
+%%
+
+\input docstrip.tex
+\keepsilent
+
+
+\preamble
+
+ Copyright (C) 2022 by Anton Vrba
+ --------------------------------
+
+ This work may be distributed and/or modified under the
+ conditions of the LaTeX Project Public License, either version 1.3
+ of this license or (at your option) any later version.
+ 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 2008-05-04 or later.
+
+
+ This work has the LPPL maintenance status `maintained'.
+
+ The Current Maintainer of this work is Anton Vrba.
+
+
+\endpreamble
+
+\generate{\file{sidenotesplus.sty}{\from{sidenotesplus.dtx}{package}}}
+
+\obeyspaces
+\Msg{*************************************************************}
+\Msg{*                                                           *}
+\Msg{* To finish the installation you have to move the following *}
+\Msg{* file into a directory searched by TeX:                    *}
+\Msg{*                                                           *}
+\Msg{*     sidenotesplus.sty                                     *}
+\Msg{*                                                           *}
+\Msg{* To produce the documentation run the file sidenotesplus.dtx *}
+\Msg{* through LaTeX.                                            *}
+\Msg{*                                                           *}
+\Msg{* Happy TeXing!                                             *}
+\Msg{*                                                           *}
+\Msg{*************************************************************}
+
+\endbatchfile

Added: trunk/Master/texmf-dist/tex/latex/sidenotesplus/sidenotesplus.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/sidenotesplus/sidenotesplus.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/sidenotesplus/sidenotesplus.sty	2022-05-21 20:19:23 UTC (rev 63355)
@@ -0,0 +1,723 @@
+%%
+%% This is file `sidenotesplus.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% sidenotesplus.dtx  (with options: `package')
+%% 
+%%  Copyright (C) 2022 by Anton Vrba
+%%  --------------------------------
+%% 
+%%  This work may be distributed and/or modified under the
+%%  conditions of the LaTeX Project Public License, either version 1.3
+%%  of this license or (at your option) any later version.
+%%  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 2008-05-04 or later.
+%% 
+%% 
+%%  This work has the LPPL maintenance status `maintained'.
+%% 
+%%  The Current Maintainer of this work is Anton Vrba.
+%% 
+%% 
+\NeedsTeXFormat{LaTeX2e}[2020/10/01]
+\ProvidesPackage{sidenotesplus}
+    [2022/05/20 1.00 rich text marginal notes, tables and figures ]
+\RequirePackage{marginnote} % provides an offset option for the marginals instead of a float
+\RequirePackage{caption} % handles the captions (in the margin)
+\RequirePackage{xparse} % new LaTeX3 syntax to define macros and environments
+\RequirePackage{calc}
+\RequirePackage{etoolbox} % provides \patchcmd
+\RequirePackage{l3keys2e}
+\RequirePackage{ifoddpage}
+\RequirePackage{mparhack} % get marginpar right
+\RequirePackage{xspace}
+\RequirePackage[strict]{changepage}
+%%
+%% ~
+
+\newcommand \snptest {{\upshape Figure \thefigure:} And some text\xspace}
+
+\ExplSyntaxOn
+\DeclareExpandableDocumentCommand{\IfNoValueOrEmptyTF}{ m m m }
+{
+ \IfNoValueTF{#1}
+  {#2}
+  {\tl_if_empty:nTF {#1} {#2} {#3}}
+}
+\setcounter{topnumber}{4}
+\setcounter{bottomnumber}{4}
+\setcounter{totalnumber}{8}
+\NewDocumentCommand \snp at sidenoteformat {} {%
+   \snp at size\snp at shape\snp at font\leavevmode%
+   \lineskip=0pt \lineskiplimit=0pt %
+   \tolerance=2000 \hyphenpenalty=300 \exhyphenpenalty=300%
+   \doublehyphendemerits=100000%
+   \finalhyphendemerits=\doublehyphendemerits
+   }
+\NewDocumentCommand \snp at sideformat {} {}
+\NewDocumentCommand \snp at sidecolor {} {}
+
+\NewDocumentCommand \snp at symbol {} {\alph}
+\NewDocumentCommand \snp at alertsymbol {} {\arabic}
+\NewDocumentCommand \snp at font {} {}
+\NewDocumentCommand \snp at shape{} {\itshape}
+\NewDocumentCommand \snp at size {} {\footnotesize}
+\NewDocumentCommand \snp at leftmarginstyle{} {}
+\NewDocumentCommand \snp at rightmarginstyle{} {}
+\bool_new:N \l at snp@margincaption
+\bool_new:N \l at snp@alerton
+\bool_new:N \l at snp@alertmarkon
+\bool_new:N \l at snp@ragged
+\bool_new:N \l at snp@symmetric
+\bool_new:N \l at snp@page
+
+\bool_set_false:N \l at snp@margincaption
+\bool_set_false:N \l at snp@alerton
+\bool_set_false:N \l at snp@alertmarkon
+\bool_set_false:N \l at snp@ragged
+\bool_set_true:N \l at snp@symmetric
+
+\newlength{\snp at marginsepdiff}
+\setlength{\snp at marginsepdiff}{1ex}
+
+\keys_define:nn { sidenoteplus }
+{
+ mark .code:n = \str_case:nn {#1}%
+     {  {fnsymbol}{\RenewDocumentCommand \snp at symbol {}{\fnsymbol}}%
+        {Alph}{\RenewDocumentCommand \snp at symbol {}{\Alph}}%
+        {arabic}{\RenewDocumentCommand \snp at symbol {}{\arabic}
+                 \RenewDocumentCommand \snp at alertsymbol {} {\alph}}%
+        {Roman}{\RenewDocumentCommand \snp at symbol {}{\Roman}}%
+        {roman}{\RenewDocumentCommand \snp at symbol {}{\roman}}%
+        {Other}{}  },
+ font .code:n = \str_case:nn {#1}%
+      {  {sf}{\RenewDocumentCommand \snp at font {}{\sffamily}}%
+        {Other}{} },
+ size .code:n = \str_case:nn {#1}%
+      {  {small}{\RenewDocumentCommand \snp at size {}{\small}}%
+         {script}{\RenewDocumentCommand \snp at size {}{\scriptsize}}%
+         {normal}{\RenewDocumentCommand \snp at size {}{\normalsize}}%
+        {Other}{} },
+ shape .code:n = \str_case:nn {#1}%
+      {  {sl}{\RenewDocumentCommand \snp at shape{}{\slshape}}%
+         {up}{\RenewDocumentCommand \snp at shape{}{\upshape}}%
+         {it}{\RenewDocumentCommand \snp at shape{}{\itshape}}%
+        {Other}{} },
+ sepdiff .code:n = \setlength{\snp at marginsepdiff}{#1},
+ classic .code:n = \bool_set_false:N \l at snp@symmetric,
+ ragged .code:n = { \RenewDocumentCommand \snp at leftmarginstyle {}{\raggedleft}
+                    \RenewDocumentCommand \snp at rightmarginstyle {}{\raggedright}
+                    \bool_set_true:N \l at snp@ragged  },
+ alerton .code:n = {\bool_set_true:N \l at snp@alerton},
+}
+\ProcessKeysOptions { sidenoteplus }
+\bool_if:NTF \l at snp@ragged
+     {\setlength{\snp at marginsepdiff}{0pt} \bool_set_false:N \l at snp@symmetric}
+     {\relax}
+\bool_if:NTF \l at snp@symmetric {\setlength{\snp at marginsepdiff}{0pt}}{\relax}
+ \newcounter{sidenote}[page] % make a counter
+\setcounter{sidenote}{0} % init the counter
+ \newcounter{sidealert}[page] % make a counter
+\setcounter{sidealert}{0} % init the counter
+\NewDocumentCommand \snp at putmarkintext { m }
+{
+    \leavevmode
+    \ifhmode
+        \edef \x at sf {\the \spacefactor }
+        \nobreak
+    \fi
+    \bool_if:NTF \l at snp@alertmarkon
+    {\makebox[0pt]{\raisebox{0.3ex}{\textsuperscript {\normalfont \bf ---~{#1}~---\kern-0.6ex }}}}
+    {\hbox {\textsuperscript {\normalfont #1 }}}
+    \ifhmode
+        \spacefactor \x at sf
+    \fi
+    \relax
+}
+\NewDocumentCommand \snp at multisign { } {3sp}
+\NewDocumentCommand \snp at multimarker { }
+{
+  \kern-\snp at multisign
+  \kern\snp at multisign\relax
+}
+\NewDocumentCommand \snp at multichecker { }
+{
+  \dim_compare:nNnTF \lastkern = \snp at multisign
+  {\snp at putmarkintext{,}}
+  {}
+}
+\NewDocumentEnvironment{@snp at llr} {}%
+{
+  \setlength{\parindent}{0pt}
+  \setlength{\leftskip}{0pt plus 1fil}
+  \setlength{\rightskip}{0pt plus -1fil}
+}{\par}
+\let\oldmarginpar\marginpar
+\renewcommand{\marginpar}[2][]{
+   \if\relax\detokenize{#1}\relax
+      \oldmarginpar[\snp at leftmarginstyle\snp at sidenoteformat{#2}]%
+                   {\snp at rightmarginstyle\snp at sidenoteformat{#2}}%
+   \else%two parameters, let them use their styling
+      \oldmarginpar[{#1}]{#2}%
+   \fi%
+}
+\renewcommand*{\raggedleftmarginnote}{}
+\renewcommand*{\raggedrightmarginnote}{}
+\renewcommand*{\marginfont}{}
+
+\NewDocumentCommand \snp at placemarginal {d!! m m }
+{
+   \IfNoValueOrEmptyTF{#1}
+   {
+     \if at twoside
+        \snp at isoddpage
+        {
+           \IfNoValueOrEmptyTF{#2}
+           {\marginpar{  #3 }}
+           {\marginnote{\snp at sidenoteformat #3}[#2]}
+        }
+        {
+        \bool_if:NTF \l at snp@symmetric
+        {
+           \IfNoValueOrEmptyTF{#2}
+           {\marginpar{\begin{@snp at llr} #3\end{@snp at llr}}}
+           {\marginnote{\begin{@snp at llr}\snp at sidenoteformat #3\end{@snp at llr}}[#2]}
+        }
+
+        {
+           \IfNoValueOrEmptyTF{#2}
+           {\marginpar{ #3}}
+           {\marginnote{\snp at sidenoteformat #3}[#2]}
+        }
+        }
+     \else
+        \IfNoValueOrEmptyTF{#2}
+        {\marginpar{ #3}}
+        {\marginnote{\snp at sidenoteformat #3}[#2]}
+     \fi
+   }
+   {
+     \if at twoside
+        \snp at isoddpage
+        {
+           \IfNoValueOrEmptyTF{#2}
+           {\marginpar{  \textcolor{#1}{#3} }}
+           {\marginnote{\snp at sidenoteformat  \textcolor{#1}{#3}}[#2]}
+        }
+        {
+        \bool_if:NTF \l at snp@symmetric
+        {
+           \IfNoValueOrEmptyTF{#2}
+           {\marginpar{\begin{@snp at llr} \textcolor{#1}{#3}\end{@snp at llr}}}
+           {\marginnote{\begin{@snp at llr}\snp at sidenoteformat  \textcolor{#1}{#3}\end{@snp at llr}}[#2]}
+        }
+        {
+           \IfNoValueOrEmptyTF{#2}
+           {\marginpar{\textcolor{#1}{#3}}}
+           {\marginnote{ \snp at sidenoteformat  \textcolor{#1}{#3}}[#2]}
+        }
+        }
+     \else
+        \IfNoValueOrEmptyTF{#2}
+        {\marginpar{ \textcolor{#1}{#3}}}
+        {\marginnote{ \snp at sidenoteformat  \textcolor{#1}{#3}}[#2]}
+     \fi
+   }
+}
+\NewDocumentCommand \sidepar {}
+{
+  \\\makebox[1em]{}
+}
+\NewDocumentCommand \sidenote {s d|| d<> d() d!! m  }
+{
+  \IfBooleanTF{#1}
+  { % starred
+  \snp at sidenotemark*(#4)
+  \snp at sidenotetext[*]|#2|<#3>(#4)!#5!{#6}
+  }{ % unstarred
+\IfNoValueOrEmptyTF{#5} {
+  \snp at sidenotemark(#4)
+  \snp at sidenotetext[]|#2|<#3>(#4)!#5!{#6}
+  \snp at multimarker }
+  {
+  \snp at sidenotemark(#4)!#5!
+  \snp at sidenotetext[]|#2|<#3>(#4)!#5!{#6}
+  \snp at multimarker }
+
+  }
+}
+\NewDocumentCommand \sidealert {s d|| d<> d() d!! m  }
+{
+   \bool_if:NTF \l at snp@alerton
+     {
+     \bool_set_true:N \l at snp@alertmarkon
+      \IfNoValueOrEmptyTF{#5}
+      {
+        \IfBooleanTF{#1}
+        { % starred
+          \snp at sidenotemark*(#4)
+          \snp at sidenotetext[*]|#2|<#3>(#4)!Red!{#6}
+        }{ % unstarred
+          \snp at sidenotemark(#4)!Red!{}
+          \snp at sidenotetext[]|#2|<#3>(#4)!Red!{#6}
+          \snp at multimarker
+        }
+      }{ \IfBooleanTF{#1}
+         { % starred
+           \snp at sidenotemark*(#4)
+           \snp at sidenotetext[*]|#2|<#3>(#4)!#5!{#6}
+         }{ % unstarred
+           \snp at sidenotemark(#4)!#5!{}
+           \snp at sidenotetext[]|#2|<#3>(#4)!#5!{#6}
+           \snp at multimarker
+         }
+      }
+   }
+   {\relax}
+   \bool_set_false:N \l at snp@alertmarkon
+}
+\NewDocumentCommand \sidenotemark {s d() d!! m }
+{
+  \IfBooleanTF{#1}
+  { % starred
+    \relax}
+  {% unstarred
+     \IfNoValueOrEmptyT{#3}
+       {\snp at sidenotemark (#2)}
+       {\snp at sidenotemark !#3!( #2)}
+  }
+  \xspace
+}
+\NewDocumentCommand \snp at symbolnoteoralert {}{}
+\NewDocumentCommand \snp at sidenotemark {s d() d!! }
+{
+  \IfBooleanTF{#1}
+  { % starred
+    \relax}
+  {% unstarred
+     \snp at multichecker
+     \bool_if:NTF \l at snp@alertmarkon
+        { \refstepcounter{sidealert}
+          \RenewDocumentCommand \snp at symbolnoteoralert {}{\snp at alertsymbol{sidealert}} }
+       { \refstepcounter{sidenote}
+          \RenewDocumentCommand \snp at symbolnoteoralert {}{\snp at symbol{sidenote}} }
+     \IfNoValueOrEmptyTF{#3}
+     {
+       \IfNoValueOrEmptyTF{#2}
+         { \snp at putmarkintext{\snp at symbolnoteoralert } }
+         { \snp at putmarkintext{#2} }
+     }{
+        \IfNoValueOrEmptyTF{#2}
+          { \textcolor{#3} {\snp at putmarkintext{\snp at symbolnoteoralert}} }
+          { \textcolor{#3} {\snp at putmarkintext{#2}} }
+     }
+     \snp at multimarker
+  }
+}
+\NewDocumentCommand{\snp at onelineup}{}
+   {\par \vspace*{-1\baselineskip}}
+\NewDocumentCommand{\snp at onexlineup}{}
+   {\par \vspace*{-1.5\baselineskip}}
+\NewDocumentCommand{\snp at leftnotelabel}{ m }
+   {\makebox[0em][l]{\hspace*{0.9ex}#1}}
+\NewDocumentCommand{\snp at rightnotelabel}{ m }
+   {\makebox[0em][r]{#1\hspace*{0.9ex}}}
+\NewDocumentCommand{\snp at justifiedleftnotelabel}{ m }
+   {\makebox[0em][l]{\hspace*{\marginparwidth+0.9ex}#1}}
+\NewDocumentCommand \sidenotetext {s d|| d<> d() d!! m  } {
+   \IfBooleanTF{#1}
+      { \snp at sidenotetext[*]|#2|<#3>(#4)!#5!{#6} }
+      { \snp at sidenotetext[]|#2|<#3>(#4)!#5!{#6} }
+}
+\NewDocumentCommand \sidenotetextbefore {s d|| d<> d() d!! m  } {
+   \refstepcounter{sidenote}
+   \IfBooleanTF{#1}
+      { \snp at sidenotetext[*]|#2|<#3>(#4)!#5!{#6} }
+      { \snp at sidenotetext[]|#2|<#3>(#4)!#5!{#6} }
+    \addtocounter{sidenote}{-1}
+}
+\DeclareExpandableDocumentCommand{\IfsTF}{ m m m }
+{
+ \IfNoValueTF{#1}
+  {#2}
+  {\tl_if_empty:nTF {#1} {#2} {#3}}
+}
+ \newlength{\d at snp@offset}
+\NewDocumentCommand \snp at sidenotesymbol {}{}
+\NewDocumentCommand \snp at sidenotetext {o d|| d<> d() d!! m } {
+  \bool_if:NTF \l at snp@alertmarkon
+  {
+  \IfNoValueOrEmptyTF{#4}
+     {\RenewDocumentCommand \snp at sidenotesymbol {}{-~\snp at alertsymbol{sidealert}~-}}
+     {\RenewDocumentCommand \snp at sidenotesymbol {}{-~#4~-}}
+  }
+  {
+  \IfNoValueOrEmptyTF{#4}
+     {\RenewDocumentCommand \snp at sidenotesymbol {}{\snp at symbol{sidenote}}}
+     {\RenewDocumentCommand \snp at sidenotesymbol {}{#4}}
+  }
+  \IfNoValueOrEmptyTF{#2}
+     {\relax}
+     {\setlength{\d at snp@offset}{#2} \vspace*{ \d at snp@offset }}
+   \bool_if:NTF \l at snp@ragged
+   {
+   \if at twoside
+     \snp at isoddpage
+     {%odd page
+       {  \snp at placemarginal!#5!{#3}%--
+              {\snp at rightnotelabel{%
+                  \normalfont\IfsTF{#1}{\snp at sidenotesymbol}{\relax}}#6}
+       }
+     }
+     {%even page
+        {\snp at placemarginal!#5!{#3}%--
+             {\snp at justifiedleftnotelabel{\normalfont%
+                    \IfsTF{#1}{\snp at sidenotesymbol}{\relax}}
+                    \hspace*{\marginparwidth}  \snp at onelineup#6}
+        }
+     }
+   \else %not twoside
+     {\snp at placemarginal!#5!{#3}%--
+          {\snp at rightnotelabel{\normalfont%
+              \IfsTF{#1}{\snp at sidenotesymbol}{\relax}}#6}
+     }
+   \fi % ends if at twoside
+   }
+   {
+   \if at twoside
+     \snp at isoddpage
+     {%odd page
+          {\snp at placemarginal!#5!{#3}%--
+               {\snp at rightnotelabel{
+                   \normalfont\IfsTF{#1}{\snp at sidenotesymbol}{\relax}}#6}
+          }
+     }
+     {%even page
+        \bool_if:NTF \l at snp@symmetric
+           {
+             {\snp at placemarginal!#5!{#3}%--
+                  {\snp at justifiedleftnotelabel{
+                         \normalfont\IfsTF{#1}{\snp at sidenotesymbol}{\relax} }
+                   \hspace*{\marginparwidth}\snp at onelineup#6
+                  }
+             }
+          }
+          {
+             {  \snp at placemarginal!#5!{#3}%--
+                    {\snp at rightnotelabel{
+                      \normalfont\IfsTF{#1}{\snp at sidenotesymbol}{\relax}}#6 }
+             }
+          }
+     }
+   \else
+       {   \snp at placemarginal!#5!{#3}%--
+           {\snp at rightnotelabel{
+               \normalfont\IfsTF{#1}{\snp at sidenotesymbol}{\relax}}#6}
+       }
+   \fi
+   }
+  \IfNoValueOrEmptyTF{#2}
+     {\relax}
+     { \setlength{\d at snp@offset}{#2 *(-1)} \vspace*{{\d at snp@offset}}}
+}
+
+\NewDocumentCommand \snp at raggedcaption {m }
+{
+   \if at twoside
+      \snp at isoddpage {#1}
+         {\bool_if:NTF \l at snp@symmetric {\begin{@snp at llr}#1\end{@snp at llr}} {#1}}
+   \else #1 \fi
+}
+\DeclareCaptionStyle{sidecaption}{font=footnotesize}
+\NewDocumentCommand \snp at entrycap {} {}
+\NewDocumentCommand \snp at offsetcap {} {}
+\NewDocumentCommand \sidecaption {s d|| d<> d!! o m} {
+  \captionsetup{style=sidecaption}
+  \IfBooleanTF{#1}
+  { %starred
+  \marginnote{\caption*{\snp at raggedcaption{#6}}}
+          [\IfNoValueOrEmptyTF{#3} {0pt} {#3}]
+  }
+  { %unstarred
+  \marginnote{\caption[\IfNoValueOrEmptyTF{#5} {#6} {#5}]
+                      {\snp at raggedcaption{#6}}}
+          [\IfNoValueOrEmptyTF{#3} {0pt} {#3}]
+  }
+}
+\NewDocumentCommand \istwosided {m m} {
+\if at twoside #1 \else #2 \raggedleft \fi
+}
+\NewDocumentCommand \raggedinner {} {
+\if at twoside
+     \snp at isoddpage {\raggedleft}{\raggedright}
+\else
+     \raggedleft
+\fi
+}
+\NewDocumentCommand \raggedouter {} {
+\if at twoside
+     \snp at isoddpage {\raggedright}{\raggedleft}
+\else
+     \raggedleft
+\fi
+}
+
+\newlength \l at snp@belowcaption
+\NewDocumentCommand \margincaption {s o m }
+{
+\setlength \l at snp@belowcaption \belowcaptionskip
+\setlength{\belowcaptionskip}{1ex plus 0.3ex minus -0.1ex}
+  \IfBooleanTF{#1}
+  { %starred
+    \if at twoside
+        \snp at isoddpage
+        {
+          \IfNoValueOrEmptyTF{#2} {\caption*{#3}} {\caption*[#2]{#3}}
+        }
+        {
+        \bool_if:NTF \l at snp@symmetric
+        {
+          \IfNoValueOrEmptyTF{#2}
+            {\caption*[#3]{\begin{@snp at llr}#3\end{@snp at llr}}}
+            {\caption*[#2]{\begin{@snp at llr}#3\end{@snp at llr}}}
+        }
+        {
+           \IfNoValueOrEmptyTF{#2} {\caption*{#3}} {\caption*[#2]{#3}}
+        }
+        }
+    \else
+        \IfNoValueOrEmptyTF{#2} {\caption*{#3}} {\caption*[#2]{#3}}
+    \fi
+  }
+  { %unstarred
+    \if at twoside
+        \snp at isoddpage
+        {
+          \IfNoValueOrEmptyTF{#2} {\caption{#3}} {\caption[#2]{#3}}
+        }
+        {
+        \bool_if:NTF \l at snp@symmetric
+        {
+          \IfNoValueOrEmptyTF{#2}
+            {\caption[#3]{\begin{@snp at llr}#3\end{@snp at llr}}}
+            {\caption[#2]{\begin{@snp at llr}#3\end{@snp at llr}}}
+        }
+        {
+           \IfNoValueOrEmptyTF{#2} {\caption{#3}} {\caption[#2]{#3}}
+        }
+        }
+    \else
+        \IfNoValueOrEmptyTF{#2} {\caption{#3}} {\caption[#2]{#3}}
+    \fi
+  }
+\setlength \belowcaptionskip \l at snp@belowcaption
+}
+
+ \newsavebox{\b at snp@marginfigurebox}
+\DeclareCaptionStyle{marginfigure}{font=footnotesize,skip=1ex}
+\NewDocumentEnvironment{marginfigure} { d|| d<> }
+{ % begin{} part
+  \begin{lrbox}{\b at snp@marginfigurebox}
+    \begin{minipage}{\marginparwidth}
+      \captionsetup{type=figure,style=marginfigure}
+}
+{ % end{} part
+    \end{minipage}%
+  \end{lrbox}%
+
+   \IfNoValueOrEmptyTF{#1}
+      {\relax}
+      {\setlength{\d at snp@offset}{#1} \vspace*{ \d at snp@offset }}
+  \snp at placemarginal{#2}{\usebox{\b at snp@marginfigurebox} }
+  %~\snp at onexlineup \snptest }
+  \IfNoValueOrEmptyTF{#1}
+     {\relax}
+     { \setlength{\d at snp@offset}{#1 *(-1)} \vspace*{{\d at snp@offset}}}
+}
+\newsavebox{\b at snp@margintablebox}
+\DeclareCaptionStyle{margintable}{font=footnotesize}
+\NewDocumentEnvironment{margintable} { d|| d<> d() }
+{ % begin part
+  \begin{lrbox}{\b at snp@margintablebox}
+     \snp at sidenoteformat
+    \begin{minipage}{\marginparwidth}
+      \captionsetup{type=table,style=margintable}
+}
+{ % end part
+    \end{minipage}
+  \end{lrbox}
+   \IfNoValueOrEmptyTF{#1}
+      {\relax}
+      {\setlength{\d at snp@offset}{#1} \vspace*{ \d at snp@offset }}
+  \snp at placemarginal{#2}{\usebox{\b at snp@margintablebox} }
+  \IfNoValueOrEmptyTF{#1}
+    {\relax}
+    {\setlength{\d at snp@offset}{#1 *(-1)} \vspace*{{\d at snp@offset}}}
+
+}
+\AtBeginDocument{%
+\newlength{\d at snp@extrawidth}
+\setlength{\d at snp@extrawidth}{\marginparwidth}
+\addtolength{\d at snp@extrawidth}{\marginparsep}  }
+\NewDocumentCommand \snp at isoddpage {m m}
+      { \checkoddpage\ifoddpage #1 \else #2 \fi }
+\NewDocumentEnvironment{@snp at autoadjustwidth}{ m m }%
+{ % begin part
+\begin{adjustwidth}{0pt}{0pt}
+  \if at twoside
+     \snp at isoddpage{\begin{adjustwidth}{#1}{-#2}}%
+        {\begin{adjustwidth}{-#2}{#1}}
+  \else
+     \begin{adjustwidth}{#1}{-#2}
+  \fi
+}
+{ % end part
+   \end{adjustwidth}\end{adjustwidth}
+}
+\NewDocumentEnvironment{text*}{ o }%
+{ % begin part
+ \begin{adjustwidth}{0pt}{0pt}
+ \IfNoValueOrEmptyTF{#1}
+ {
+  \if at twoside
+     \snp at isoddpage{\begin{adjustwidth}{0pt}{-\d at snp@extrawidth}}%
+        {\begin{adjustwidth}{-\d at snp@extrawidth*}{0pt}}
+  \else
+     \begin{adjustwidth}{0pt}{-\d at snp@extrawidth*}
+  \fi
+  }
+  {
+  \if at twoside
+     \snp at isoddpage{\begin{adjustwidth}{0pt}{-\d at snp@extrawidth*#1}}%
+        {\begin{adjustwidth}{-\d at snp@extrawidth*#1}{0pt}}
+  \else
+     \begin{adjustwidth}{0pt}{-\d at snp@extrawidth*#1}
+  \fi
+  }
+}
+{  % end part
+\end{adjustwidth}\end{adjustwidth} \snp at placemarginal{}{}
+}
+\RenewDocumentEnvironment{figure*}{ O{htbp} }
+{
+   \begin{figure}[#1]
+   \begin{@snp at autoadjustwidth}{}{\d at snp@extrawidth}
+   \begin{minipage}[c]{\linewidth}
+   \centering
+   \captionsetup{ margin={\d at snp@extrawidth/2,\d at snp@extrawidth/2}}
+}{  % end part
+   \end{minipage}
+   \end{@snp at autoadjustwidth}
+   \end{figure}
+    \snp at placemarginal{}{}
+  }
+\RenewDocumentEnvironment{table*}{O{htbp} }
+{
+    \begin{table}[#1]
+    \begin{@snp at autoadjustwidth}{}{\d at snp@extrawidth}
+    \if at twoside
+        \snp at isoddpage{\raggedright}{\raggedleft}
+        \snp at isoddpage
+           {\captionsetup{margin={0pt,0pt}}  }
+           {\captionsetup{margin={-\d at snp@extrawidth,\d at snp@extrawidth}}  }
+    \else
+       \raggedright \captionsetup{margin={0pt,0pt}}
+    \fi
+}
+{ % end part
+    \end{@snp at autoadjustwidth}
+    \end{table}
+}
+\NewDocumentCommand \snp at before {} {}
+\NewDocumentCommand \snp at after {} {}
+\NewDocumentCommand \sidecite {s d|| d<> d() d!! o o m }
+{ \IfNoValueOrEmptyTF{#6}
+  {\RenewDocumentCommand \snp at before {} {}}
+  {\RenewDocumentCommand \snp at before {} {#6}}
+  \IfNoValueOrEmptyTF{#7}
+  {\RenewDocumentCommand \snp at after {} {}}
+  {\RenewDocumentCommand \snp at after {} {#7}}
+  \sidenote|#2|<#3>(#4)!#5!{\kern-2.3pt\upshape\fullcite[\snp at before][\snp at after]{#8}}
+}
+\NewDocumentCommand \sidecitet {s d|| d<> d() d!! o o m }
+{ \IfNoValueOrEmptyTF{#6}
+  {\RenewDocumentCommand \snp at before {} {}}
+  {\RenewDocumentCommand \snp at before {} {#6}}
+  \IfNoValueOrEmptyTF{#7}
+  {\RenewDocumentCommand \snp at after {} {}}
+  {\RenewDocumentCommand \snp at after {} {#7}}
+   \IfBooleanTF{#1}
+   {
+      \citeauthor{#8}'s\sidenote|#2|<#3>(#4)!#5!
+          {\kern-2.3pt\upshape\fullcite[\snp at before][\snp at after]{#8}}
+   }
+   {
+      \citeauthor{#8}\sidenote|#2|<#3>(#4)!#5!
+          {\kern-2.3pt\upshape\fullcite[\snp at before][\snp at after]{#8}}
+   }
+}
+\ExplSyntaxOff
+%%
+\newlength\marginparsepodd
+\newlength\marginparsepeven
+
+\setlength{\marginparsepodd}{\marginparsep}
+\setlength{\marginparsepeven}{\marginparsep-\snp at marginsepdiff}
+
+\makeatletter
+\patchcmd{\@addmarginpar}                 % In this command
+         {\mph at orig@addmarginpar}         % ... replace this...
+         {\if at twoside\ifodd\c at page\relax  % ... with this
+              \marginparsep=\marginparsepodd  % Page is odd
+            \else
+              \marginparsep=\marginparsepeven  % Page is even
+            \fi
+          \else
+            \marginparsep=\marginparsepodd
+          \fi
+          \mph at orig@addmarginpar}
+         {}                                           % success
+         {\message{Error! Couldn't hook into command  % failure
+             `\string\@addmarginpar'}}
+
+{%% Group to keep patching commands local
+  %
+  % Here we use a little trick to repeatedly patch the \@mn@@@marginnote
+  % command, replacing all instances of \kern\marginparsep with a
+  % conditional. We call \patch recursively each time on success, and stop
+  % when the patch fails (because all instances have been replaced).  If the
+  % patch fails the first time, we show an error message.
+  \def\patcherr{%
+    \message{Error! Couldn't hook into command `\string\@mn@@@marginnote'}}
+  \def\patchok{%
+    \let\patcherr\relax % Only display error if first patch fails
+    \patch              % Now patch again.
+  }
+  \def\patch{
+    \patchcmd{\@mn@@@marginnote}                   % In this command
+             {\kern\marginparsep}                  % ... replace this...
+             {\ifx\@mn at currpage\relax\else         % ... with this
+                \if at twoside\ifodd\@mn at currpage\relax
+                    \kern\marginparsepodd
+                  \else
+                    \kern\marginparsepeven
+                  \fi
+                \else
+                  \kern\marginparsepodd
+                \fi
+              \fi}
+             {\message{Patched!}\patchok}          % success (recurse)
+             {\patcherr}                           % fail
+  }
+  \message{Patching `\string\@mn@@@marginnote`!}
+  \patch
+  \global\let\@mn@@@marginnote\@mn@@@marginnote    % Make patch global
+}
+\makeatother
+\endinput
+%%
+%% End of file `sidenotesplus.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/sidenotesplus/sidenotesplus.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2022-05-21 20:18:01 UTC (rev 63354)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2022-05-21 20:19:23 UTC (rev 63355)
@@ -720,7 +720,7 @@
     show2e showcharinbox showdim showexpl showhyphens showlabels
     showtags shtthesis
     shuffle
-    sidecap sidenotes sides signchart silence sillypage
+    sidecap sidenotes sidenotesplus sides signchart silence sillypage
     simple-resume-cv simple-thesis-dissertation simplebnf simplecd simplecv
     simpleicons simpleinvoice simplekv simplenodes
     simpleoptics simpler-wick simplewick

Modified: trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2022-05-21 20:18:01 UTC (rev 63354)
+++ trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2022-05-21 20:19:23 UTC (rev 63355)
@@ -1160,6 +1160,7 @@
 depend showlabels
 depend sidecap
 depend sidenotes
+depend sidenotesplus
 depend silence
 depend sillypage
 depend simplecd

Added: trunk/Master/tlpkg/tlpsrc/sidenotesplus.tlpsrc
===================================================================


More information about the tex-live-commits mailing list.