summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/underoverlap
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/underoverlap
Initial commit
Diffstat (limited to 'macros/latex/contrib/underoverlap')
-rw-r--r--macros/latex/contrib/underoverlap/README37
-rw-r--r--macros/latex/contrib/underoverlap/dry.sty56
-rw-r--r--macros/latex/contrib/underoverlap/packagedoc.cls315
-rw-r--r--macros/latex/contrib/underoverlap/underoverlap.pdfbin0 -> 264380 bytes
-rw-r--r--macros/latex/contrib/underoverlap/underoverlap.sty411
-rw-r--r--macros/latex/contrib/underoverlap/underoverlap.tex267
-rw-r--r--macros/latex/contrib/underoverlap/with.sty309
7 files changed, 1395 insertions, 0 deletions
diff --git a/macros/latex/contrib/underoverlap/README b/macros/latex/contrib/underoverlap/README
new file mode 100644
index 0000000000..f2d32fe5ef
--- /dev/null
+++ b/macros/latex/contrib/underoverlap/README
@@ -0,0 +1,37 @@
+LaTeX Package : underoverlap 0.0.1-r1
+
+Last Modified : 2013-02-01
+
+Author : Michiel Helvensteijn (www.mhelvens.net)
+
+===== Prerequisites =====
+
+To use this package, you need at least the following packages
+installed:
+
+* etoolbox
+* mathtools
+* xparse
+
+===== Installation =====
+
+underoverlap.sty is provided directly in the package archive. Put
+it in a place where your LaTeX distribution can find it.
+
+(underoverlap.sty is not generated, but manually maintained; you
+ may use docstrip to remove the documentation, but you don't
+ have to; it will just work the way it is)
+
+===== Documentation =====
+
+underoverlap.pdf is provided directly in the package archive. To
+generate the documentation yourself, run LaTeX on underoverlap.tex.
+
+(underoverlap.tex does not contain the package code itself; it inputs
+ underoverlap.sty directly to document the implementation)
+
+===== License =====
+
+This material is subject to the LaTeX Project Public License. See
+http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html
+for the details of that license.
diff --git a/macros/latex/contrib/underoverlap/dry.sty b/macros/latex/contrib/underoverlap/dry.sty
new file mode 100644
index 0000000000..fd639991ce
--- /dev/null
+++ b/macros/latex/contrib/underoverlap/dry.sty
@@ -0,0 +1,56 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \iffalse %%%%
+% %
+% Copyright (c) 2012 - Michiel Helvensteijn (www.mhelvens.net) %
+% %
+% http://latex-with.googlecode.com %
+% %
+% 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 `author-maintained'. %
+% %
+% The Current Maintainer of this work is Michiel Helvensteijn. %
+% %
+% This work consists of the file dry.sty. %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \fi %%%%
+
+% I will 'officially' release this package at some point in the future. For
+% now I'm just using it to document a couple of packages. Still, it's
+% released under LPPL, so use it as you will.
+%
+% -- Michiel Helvensteijn
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{dry}
+ [2012/12/19 convenience macros for reusing LaTeX code]
+
+\RequirePackage{filecontents}
+\RequirePackage{xparse}
+\RequirePackage{etoolbox}
+\RequirePackage{with}
+
+\newcommand\minput[1]{%
+ \input{#1}\unskip%
+}
+
+\NewDocumentCommand{\NewDRYer}{m +m}{%
+ \with{un} [#1] [#2] {%
+ \newenvironment{#1}{%
+ \begingroup%
+ \@tempswafalse\filec@ntents{##1.tmp}%
+ }{%
+ \endfilecontents%
+ \endgroup%
+ }%
+ \AfterEndEnvironment{#1}{%
+ \with{xn} [##1.tmp] [\minput{##1.tmp}] {%
+ ##2%
+ }%
+ }%
+ }%
+}
diff --git a/macros/latex/contrib/underoverlap/packagedoc.cls b/macros/latex/contrib/underoverlap/packagedoc.cls
new file mode 100644
index 0000000000..82665874e5
--- /dev/null
+++ b/macros/latex/contrib/underoverlap/packagedoc.cls
@@ -0,0 +1,315 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% Copyright (C) 2012 by Michiel Helvensteijn - www.mhelvens.net %
+% %
+% 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 `author-maintained'. %
+% %
+% The Current Maintainer of this work is Michiel Helvensteijn. %
+% %
+% This work consists of the file packagedoc.cls. %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\let\packagename\jobname
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Document Class %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\LoadClassWithOptions{ltxdoc}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Importing The Relevant Package %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\RequirePackage{\packagename}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Importing Other Packages %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+\RequirePackage[hyphens]{url}
+
+\RequirePackage{etoolbox}
+\RequirePackage[xcolor]{mdframed}
+\RequirePackage{marginnote}
+\RequirePackage{listings}
+\RequirePackage{textcomp}
+\RequirePackage[pdftex,colorlinks=true]{hyperref}
+\RequirePackage{dry}
+\RequirePackage{needspace}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Documentation Options %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% File Info %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\GetFileInfo{\packagename.sty}
+
+\title{The \textsf{\packagename} package\thanks{%
+ This document corresponds to \textsf{\packagename}~\fileversion,
+ dated \filedate.%
+}}
+
+\author{
+ Michiel Helvensteijn\\
+ \href{mailto:mhelvens+latex@gmail.com}{mhelvens+latex@gmail.com}
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Development Info %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newmdenv[
+ leftline = false,
+ rightline = false
+]{bannerframe}
+
+\apptocmd{\maketitle}{
+ \begin{bannerframe}
+ \small
+ \begin{center}
+ Development of this package is organized at
+ \href{http://latex-\packagename.googlecode.com}
+ {latex-\packagename.googlecode.com}.\\
+ I am happy to receive feedback there!
+ \end{center}
+ \end{bannerframe}
+}{}{}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Example Environment Setup %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%% Extra keywords for LaTeX
+%
+\newcommand{\moretexcs}[1]{
+ \lstdefinelanguage{latex}{
+ language=[LaTeX]tex,
+ alsoletter={\[,\],\$},
+ moretexcs={ExplSyntaxOn,ExplSyntaxOff,lstinputlisting,detokenize,[,],#1},
+ keywords={\$}
+ }
+}
+
+%%% Code formatting
+%
+\lstdefinestyle{examplecode}{%
+ language=latex,%
+ basicstyle=\ttfamily\small,%
+ texcsstyle=*\bfseries,%
+ keywordstyle=*\bfseries,%
+ upquote=true%
+}
+
+%%% Setting up example code block
+%
+\definecolor{examplecodelinecolor}{rgb}{0,0,0}
+\definecolor{examplecodebackgroundcolor}{rgb}{.9,.9,.9}
+\newmdenv[
+ linecolor = examplecodelinecolor,
+ backgroundcolor = examplecodebackgroundcolor,
+ skipabove = 0px,
+ skipbelow = 0px,
+ innertopmargin = -3px,
+ innerrightmargin = 4px,
+ innerbottommargin = -3px,
+ innerleftmargin = 4px
+]{examplecodeframe}
+
+%%% Defining example output block
+%
+\definecolor{exampleoutputbackgroundcolor}{rgb}{1,1,1}
+\newmdenv[
+ linecolor = examplecodelinecolor,
+ backgroundcolor = exampleoutputbackgroundcolor,
+ skipabove = 0px,
+ skipbelow = 0px,
+ innertopmargin = 4px,
+ innerrightmargin = 4px,
+ innerbottommargin = 4px,
+ innerleftmargin = 4px,
+ nobreak = true
+]{exampleoutputframe}
+
+%%% Macros for counting lines in file, adapted from
+%%% http://andreas.scherbaum.la/blog/archives/
+%%% 670-Read-number-lines-in-a-file-in-LaTeX.html
+%
+\RequirePackage{ifthen}
+\newboolean{packagedoc@restfile}
+\newcommand*{\packagedoc@fileline}{}
+\newread\packagedoc@file
+\newcommand*{\packagedoc@readnextline}[1]{%
+ \ifthenelse{\boolean{packagedoc@restfile}}{%
+ \read#1 to \packagedoc@fileline%
+ \ifeof#1\setboolean{packagedoc@restfile}{false}%
+ \else\fi%
+ }{}%
+}
+\newcommand*{\countlinesinfile}[2]{%
+ \setboolean{packagedoc@restfile}{true}%
+ \setcounter{packagedoc@linecount}{0}%
+ \openin\packagedoc@file=#1%
+ \whiledo{\boolean{packagedoc@restfile}}{%
+ \packagedoc@readnextline{\packagedoc@file}%
+ \ifthenelse{\boolean{packagedoc@restfile}}{%
+ \stepcounter{packagedoc@linecount}%
+ }{}%
+ }%
+ \closein\packagedoc@file%
+ \edef#2{\thepackagedoc@linecount}%
+}
+
+\newcounter{packagedoc@linecount}
+\newlength{\packagedoc@spacetoreserve}
+
+%%% DRYer without output
+%
+\NewDRYer{latex-example}{%
+ \addvspace{6px}%
+ {%
+ \ttfamily\small%
+ \countlinesinfile{#1}{\countedlines}%
+ \setlength{\packagedoc@spacetoreserve}{\countedlines\baselineskip}%
+ \addtolength{\packagedoc@spacetoreserve}{-4px}%
+ \needspace{\packagedoc@spacetoreserve}%
+ }%
+ \begin{examplecodeframe}%
+ \renewcommand{\ttdefault}{pcr}%
+ \lstinputlisting[style=examplecode]{#1}%
+ \end{examplecodeframe}%
+ #2%
+ \addvspace{6px}%
+}
+
+%%% DRYer WITH output but WITHOUT side-effects
+%
+\NewDRYer{latex-example-show}{%
+ \addvspace{6px}%
+ {%
+ \ttfamily\small%
+ \countlinesinfile{#1}{\countedlines}%
+ \setlength{\packagedoc@spacetoreserve}{\countedlines\baselineskip}%
+ \addtolength{\packagedoc@spacetoreserve}{\baselineskip}%
+ \needspace{\packagedoc@spacetoreserve}%
+ }%
+ \begin{examplecodeframe}%
+ \renewcommand{\ttdefault}{pcr}%
+ \lstinputlisting[style=examplecode]{#1}%
+ \end{examplecodeframe}\vspace{-4px}%
+ \begin{exampleoutputframe}%
+ #2%
+ \end{exampleoutputframe}%
+ \addvspace{6px}%
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Implementation Code Box Setup %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%% Saving old implementation code block font
+%
+\AtBeginDocument{\let\old@macro@font\macro@font}
+
+%%% Setup for 'interesting' implementation code blocks
+%
+\definecolor{interestingcodebackgroundcolor}{rgb}{.9,.9,.9}
+\definecolor{interestingcodelinecolor}{rgb}{0,0,0}
+\mdfdefinestyle{interestingcode}{
+ linecolor = interestingcodelinecolor,
+ backgroundcolor = interestingcodebackgroundcolor
+}
+\newcommand*{\interesting}{%
+ \def\codestyle{interestingcode}%
+ \def\codeskipabove{5px}%
+ \let\macro@font\old@macro@font%
+}
+
+%%% Setup for 'UNinteresting' implementation code blocks
+%
+\definecolor{uninterestingcodebackgroundcolor}{rgb}{.97,.97,.97}
+\definecolor{uninterestingcodelinecolor}{rgb}{.5,.5,.5}
+\definecolor{uninterestingcodecolor}{rgb}{.4,.4,.4}
+\mdfdefinestyle{uninterestingcode}{
+ linecolor = uninterestingcodelinecolor,
+ backgroundcolor = uninterestingcodebackgroundcolor,
+}
+\newcommand*{\uninteresting}{%
+ \def\codestyle{uninterestingcode}%
+ \def\codeskipabove{-5px}%
+ \def\macro@font{\color{uninterestingcodecolor}\old@macro@font}%
+}
+
+%%% Actually surround 'macrocode' with the frame
+%
+\surroundwithmdframed[
+ style = \codestyle,
+ skipabove = \codeskipabove,
+ skipbelow = 5px,
+ splittopskip = 10px,
+ splitbottomskip = 4px,
+ innertopmargin = 4px,
+ innerrightmargin = 4px,
+ innerbottommargin = 4px,
+ innerleftmargin = 4px
+]{macrocode}
+
+%%% Start out with 'interesting' code status and
+%%% always go back to it after one code block
+%
+\interesting
+\AfterEndEnvironment{macrocode}{\interesting}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Argument Specifiers and such %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcommand*{\movarg}[1]{[ \texttt{#1} ]}
+\newcommand*{\momarg}[1]{[ \meta{#1} ]}
+
+\newcommand{\describemacro}[2]{%
+ \needspace{3\baselineskip}%
+ \noindent\\\DescribeMacro{#1} #2\\%
+}
+
+\newcommand{\describemetamacro}[2]{%
+ \needspace{3\baselineskip}%
+ \noindent\\\marginnote{\meta{#1}} #2\\%
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Automatic Implementation Docs %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\AtEndDocument{
+ \pagebreak
+
+ \section{Implementation}
+
+ \StopEventually {\PrintChanges}
+
+ We now show and explain the entire implementation from \texttt{\packagename.sty}.
+
+ \DocInput{\packagename.sty}
+
+ \Finale
+
+ \PrintIndex
+}
diff --git a/macros/latex/contrib/underoverlap/underoverlap.pdf b/macros/latex/contrib/underoverlap/underoverlap.pdf
new file mode 100644
index 0000000000..818d78edc7
--- /dev/null
+++ b/macros/latex/contrib/underoverlap/underoverlap.pdf
Binary files differ
diff --git a/macros/latex/contrib/underoverlap/underoverlap.sty b/macros/latex/contrib/underoverlap/underoverlap.sty
new file mode 100644
index 0000000000..231d80b202
--- /dev/null
+++ b/macros/latex/contrib/underoverlap/underoverlap.sty
@@ -0,0 +1,411 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \iffalse %%%%
+% %
+% Copyright (c) 2013 - Michiel Helvensteijn - www.mhelvens.net %
+% %
+% http://latex-underoverlap.googlecode.com %
+% %
+% 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 Michiel Helvensteijn. %
+% %
+% This work consists of the files underoverlap.tex and underoverlap.sty. %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \fi %%%%
+
+% \CheckSum{99}
+%
+% \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 \~}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Package Info} %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{underoverlap}[2013/02/03 0.0.1-r1
+ construct for partly overlapping math decorations]
+% \end{macrocode}
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Packages} %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% These are the packages we'll need.
+%
+% \begin{macrocode}
+\RequirePackage{etoolbox}
+\RequirePackage{mathtools}
+\RequirePackage{xparse}
+% \end{macrocode}
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Public Macros} %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % \begin{macro}{\newUOLdecorator}
+ % \marg{control sequence} \marg{definition}
+%%% \\\nopagebreak
+%
+% \noindent This defines the macro \meta{control sequence} as a
+% new decorator command that is capable of overlapping
+% with others.
+%
+% \begin{macrocode}
+\NewDocumentCommand{\newUOLdecorator}{mm}{%
+ \newcommand{#1}[1]{#2}%
+ \UOLaugment{#1}%
+}
+% \end{macrocode}
+%
+%\end{macro}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % \begin{macro}{\UOLaugment}
+ % \marg{control sequence}
+%%% \\\nopagebreak
+%
+% \noindent This augments the macro \meta{control sequence}
+% to allow it to be overlapped.
+%
+% \begin{macrocode}
+\NewDocumentCommand{\UOLaugment}{m}{%
+ \cslet{\uol@oldcsname{#1}}{#1}%
+ \renewcommand{#1}{%
+ \ifbool{mmode}{%
+ \uol@construct{\csuse{\uol@oldcsname{#1}}}%
+ }{%
+ \csuse{\csuse{\uol@oldcsname{#1}}}%
+ }%
+ }%
+}
+% \end{macrocode}
+%
+%\end{macro}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % \begin{macro}{\UOLunaugment}
+ % \marg{original cs}
+%%% \\\nopagebreak
+%
+% \noindent This unaugments the macro \meta{original cs} so
+% it will once again have its original meaning. This will
+% only make sense if you're previously augmented that command
+% with |\UOLaugment|.
+%
+% \begin{macrocode}
+\NewDocumentCommand{\UOLunaugment}{m}{%
+ \letcs{#1}{\uol@oldcsname{#1}}%
+}
+% \end{macrocode}
+%
+%\end{macro}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Private Macros} %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% The content inside a decoration has three parts:
+% \begin{itemize}
+% \item A `left' part that may overlap with the
+% previous construct.
+% \item A `middle' part that does not overlap.
+% \item A `right' part that overlaps with the next construct.
+% \end{itemize}
+%
+% \noindent Only the `middle' and `right' parts are passed as parameters
+% throughout most of the following commands. The `left' part is defined
+% by the previous \meta{UOL decorator} inside the |\uol@overlap@content|
+% macro.
+
+
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % \begin{macro}{\uol@oldcsname}
+ % \marg{control sequence}
+%%% \\\nopagebreak
+%
+% \noindent Given a control sequence, this derives the corresponding
+% 'old csname' used by this package when augmenting it.
+%
+% \begin{macrocode}
+\newcommand{\uol@oldcsname}[1]{%
+ uol@old@\expandafter\@gobble\string#1%
+}
+% \end{macrocode}
+%
+%\end{macro}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % \begin{macro}{\uol@construct}
+ % \marg{original macro}
+ % \marg{middle}
+ % \marg{right}
+%%% \\\nopagebreak
+%
+% \noindent Scans ahead for subscript or superscript.
+%
+% \begin{macrocode}
+\NewDocumentCommand{\uol@construct}{mmO{}}{%
+ \let\uol@sup\empty%
+ \let\uol@sub\empty%
+ \@ifnextchar^{%
+ \uol@construct@sup{#1}{#2}{#3}%
+ }{%
+ \@ifnextchar_%
+ {\uol@construct@sub {#1}{#2}{#3}}%
+ {\uol@construct@final{#1}{#2}{#3}}%
+ }%
+}
+% \end{macrocode}
+%
+%\end{macro}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % \begin{macro}{\uol@construct@sup}
+ % \marg{original macro}
+ % \marg{middle}
+ % \marg{right}
+%%% \verb|^| \marg{superscript} \\\nopagebreak
+%
+% \noindent Processes superscript and scans ahead for subscript.
+%
+% \begin{macrocode}
+\def\uol@construct@sup#1#2#3^#4{%
+ \def\uol@sup{#4}%
+ \@ifnextchar_%
+ {\uol@construct@sup@sub{#1}{#2}{#3}}%
+ {\uol@construct@final {#1}{#2}{#3}}%
+}
+% \end{macrocode}
+%
+%\end{macro}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % \begin{macro}{\uol@construct@sub}
+ % \marg{original macro}
+ % \marg{middle}
+ % \marg{right}
+%%% \verb|_| \marg{subscript} \\\nopagebreak
+%
+% \noindent Processes subscript and scans ahead for superscript.
+%
+% \begin{macrocode}
+\def\uol@construct@sub#1#2#3_#4{%
+ \def\uol@sub{#4}%
+ \@ifnextchar^%
+ {\uol@construct@sub@sup{#1}{#2}{#3}}%
+ {\uol@construct@final {#1}{#2}{#3}}%
+}
+% \end{macrocode}
+%
+%\end{macro}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % \begin{macro}{\uol@construct@sub@sup}
+ % \marg{original macro}
+ % \marg{middle}
+ % \marg{right}
+%%% \verb|^| \marg{superscript} \\\nopagebreak
+%
+% \noindent Processes superscript and calls the 'final' command.
+%
+% \begin{macrocode}
+\def\uol@construct@sub@sup#1#2#3^#4{%
+ \def\uol@sup{#4}%
+ \uol@construct@final{#1}{#2}{#3}%
+}
+% \end{macrocode}
+%
+%\end{macro}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % \begin{macro}{\uol@construct@sup@sub}
+ % \marg{original macro}
+ % \marg{middle}
+ % \marg{right}
+%%% \verb|_| \marg{subscript} \\\nopagebreak
+%
+% \noindent Processes subscript and calls the 'final' command.
+%
+% \begin{macrocode}
+\def\uol@construct@sup@sub#1#2#3_#4{%
+ \def\uol@sub{#4}%
+ \uol@construct@final{#1}{#2}{#3}%
+}
+% \end{macrocode}
+%
+%\end{macro}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% \begin{macro}{\uol@overlap@content}\nopagebreak
+%
+% \noindent This macro stores the 'overlapped' part of the
+% math content between two augmented macros. We make sure
+% that it is empty at the beginning of a new equation.
+%
+% \begin{macrocode}
+\let\uol@overlap@content\@empty
+% \end{macrocode}
+%
+%\end{macro}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % \begin{macro}{\uol@construct@final}
+ % \marg{original macro}
+ % \marg{middle}
+ % \marg{right}
+%%% \\\nopagebreak
+%
+% \noindent This command typesets the result and reserves
+% space for the overlap.
+%
+% \begin{macrocode}
+\newcommand{\uol@construct@final}[3]{
+% \end{macrocode}
+%
+% The following block will set the visible ink of the
+% decoration without visibly setting the content itself
+% and without moving our current position (using |\mathrlap|).
+%
+% \begin{macrocode}
+ \mathrlap{%
+% \end{macrocode}
+%
+% We do several things next. Using |\mathop| we allow any
+% subscript and superscript to be positioned directly under
+% or over the construct, even if the original command doesn't
+% natively support it.
+%
+% We call the original command with |#1| and make it initially
+% invisible using |\phantom|.
+%
+% Using braces we provide the spacing most likely to be
+% satisfactory. If it's not, the user should manually
+% correct with math-spacing commands.
+%
+% \begin{macrocode}
+ \displaystyle%
+ \mathop{#1{\phantom{%
+ {\uol@overlap@content}{{}#2{}}{#3}%
+ }}}%
+% \end{macrocode}
+%
+% The following two lines set the subscript and superscript
+% that we collected during the previous phases.
+%
+% \begin{macrocode}
+ ^{\mathclap{\uol@sup}}%
+ _{\mathclap{\uol@sub}}%
+% \end{macrocode}
+% \uninteresting\begin{macrocode}
+ }%
+% \end{macrocode}
+%
+% Next, we optionally print the debug-shadow (disabled right now).
+%
+% \begin{macrocode}
+ %\mathrlap{\textcolor{green}{\uol@overlap@content#2#3}}%
+% \end{macrocode}
+%
+% The following code visibly typesets the `left' and `middle' parts of the content.
+%
+% \begin{macrocode}
+ {\uol@overlap@content}{{}#2{}}%
+% \end{macrocode}
+%
+% We assume that the `right' part (that overlaps with the next construct)
+% will be visibly set by the following command, which will be \emph{its}
+% `left' part. We store it in the |\uol@overlap@content| macro now.
+%
+% \begin{macrocode}
+ \def\uol@overlap@content{#3}%
+% \end{macrocode}
+% \uninteresting\begin{macrocode}
+}
+% \end{macrocode}
+%
+%\end{macro}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % \makeatletter\newcount\c@CodelineNoBackup
+ % \c@CodelineNoBackup=\c@CodelineNo
+ % \begin{macro}{\UOLoverbrace} \advance\c@CodelineNo\@ne
+ % \begin{macro}{\UOLunderbrace}\advance\c@CodelineNo\@ne
+ % \begin{macro}{\UOLoverline} \advance\c@CodelineNo\@ne
+ % \begin{macro}{\UOLunderline} \c@CodelineNo=\c@CodelineNoBackup
+%%% \makeatother\ \\[-2\baselineskip]
+%
+% \noindent We predefine the following commands in a
+% straightforward way:
+%
+% \begin{macrocode}
+\newUOLdecorator{\UOLoverbrace} {\overbrace {#1}}
+\newUOLdecorator{\UOLunderbrace}{\underbrace{#1}}
+\newUOLdecorator{\UOLoverline} {\overline {#1}}
+\newUOLdecorator{\UOLunderline} {\underline {#1}}
+% \end{macrocode}
+%
+%\end{macro}\end{macro}\end{macro}\end{macro}%%%%%%%%%%%%%%%
+
diff --git a/macros/latex/contrib/underoverlap/underoverlap.tex b/macros/latex/contrib/underoverlap/underoverlap.tex
new file mode 100644
index 0000000000..b7fe382a09
--- /dev/null
+++ b/macros/latex/contrib/underoverlap/underoverlap.tex
@@ -0,0 +1,267 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% Copyright (c) 2013 - Michiel Helvensteijn - www.mhelvens.net %
+% %
+% http://latex-concepts.googlecode.com %
+% %
+% 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 Michiel Helvensteijn. %
+% %
+% This work consists of the files underoverlap.tex and underoverlap.sty. %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\documentclass[a4paper]{packagedoc}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Setup %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\moretexcs{%
+ newUOLdecorator, UOLaugment,%
+ UOLoverbrace, UOLunderbrace,%
+ UOLoverline, UOLunderline,%
+ UOLfbox, bigstrut%
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Global Changes %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\changes{0.0.1}{2013/02/02}
+ {initial version}
+
+\changes{0.0.1-r1}{2012/02/03}
+ {several improvements in the documentation}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{document} %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\maketitle
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Introduction} %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\TeX\ and \LaTeX\ provide several commands for decorating parts of our
+equations---to direct attention or to indicate some special meaning. For
+\hbox{example}:
+
+\begin{latex-example-show}
+\[ n \times x = \overbrace{x + \cdots + x}^n \]
+\end{latex-example-show}
+
+\noindent I'm refering to the |\overbrace|, of course. You can even nest
+such commands:
+
+\begin{latex-example-show}
+\[ n \times x =
+ \overbrace{x + \underbrace{x + \cdots + x}_{n-2}{} + x}^n \]
+\end{latex-example-show}
+
+\noindent But they have an inherent limitation: they cannot overlap partially. For
+example, you cannot do the following out-of-the-box:
+\[
+ a + \UOLoverbrace{b +}[c + d]^x \UOLunderbrace{+ e}_y + f
+\]
+That's what this package is all about. It allows you to define new
+decorator commands that can partially overlap like this, as well as
+augment existing commands.
+
+\break
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Usage} %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\describemetamacro{UOL decorator}{
+ \marg{non-overlapping content} \oarg{overlapping content}
+}
+
+\noindent An \meta{UOL decorator} is a decorator command prepared by this
+package, such as |\UOLoverbrace| and |\UOLunderbrace| in the examples below.
+
+If you never use the optional argument at all, they should behave exactly like
+the simple \TeX\ commands |\overbrace| and |\underbrace|.
+
+As far as the `current \meta{UOL decorator}' is concerned, the optional
+content is placed directly to the right of the mandatory content and both are
+decorated as a whole. But a subsequent \meta{UOL decorator} will be
+expected directly following this one. Its decorator will cover also the
+optional content from the current command. That's how we can
+typeset the example from the introduction:
+
+\begin{latex-example-show}
+\[ a + \UOLoverbrace{b +}[c + d]^x \UOLunderbrace{+ e}_y + f \]
+\end{latex-example-show}
+
+\noindent
+\DescribeMacro{\UOLoverbrace}
+\DescribeMacro{\UOLunderbrace}
+\DescribeMacro{\UOLoverline}
+\DescribeMacro{\UOLunderline}
+The following \meta{UOL decorator} commands are predefined by the package,
+with obvious meaning:
+\begin{itemize}\parskip=0pt
+ \item |\UOLoverbrace|
+ \item |\UOLunderbrace|
+ \item |\UOLoverline|
+ \item |\UOLunderline|
+\end{itemize}
+
+\noindent Note that you are not limited to \emph{two} overlapping decorators:
+
+\begin{latex-example-show}
+\[ a + \UOLoverbrace{b +}[c]^x \UOLunderbrace{+}[d]_y
+ \UOLoverbrace{+ e}^z + f \]
+\end{latex-example-show}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\describemacro{\newUOLdecorator}{
+ \marg{command sequence} \marg{definition containing\/ {\upshape|\#1|}}
+}
+
+\noindent Using this command you can create a new \meta{UOL decorator}. The
+first argument is the desired command sequence and the second contains its
+definition.
+
+Define it as if a simple |\newcommand| were used for a traditional decorator.
+The package will automatically augment it to allow it to overlap. You can use
+|#1| to stand for the content provided by the user. The |\UOLoverline| decorator,
+for example, was defined as follows:
+
+\let\UOLoverline\relax
+\begin{latex-example}
+\newUOLdecorator\UOLoverline{\overline{#1}}
+\end{latex-example}
+
+\noindent But note that the result will not be satisfactory unless the decorator
+requires no \emph{horizontal space} to be allocated other than for its
+content. For the commands listed above, this is no problem. But this
+may not be true for all native decorations.
+
+For example, one may naively try to define a |\UOLfbox| command as follows:
+
+\begin{latex-example}
+\newUOLdecorator\UOLfbox{{%
+ \fboxsep=1.2pt \fboxrule=.8pt \fbox{$#1$}%
+}}
+\end{latex-example}
+
+\noindent To test it, we define the following command as well:
+
+\begin{latex-example}
+\newcommand\bigstrut{\vrule height 10pt depth 4pt width 0pt}
+\end{latex-example}
+
+\noindent The result will look like this:
+
+\begin{latex-example-show}
+\[ a + \UOLfbox{b +c +}[d]^x \UOLfbox{\bigstrut + e}^y + f \]
+\end{latex-example-show}
+
+\noindent The spacing is incorrect because |\fbox| allocates horizontal space for itself
+in addition to the space for its content and our package cannot take that into
+account. We'll have to correct for this manually:
+
+\let\UOLfbox\relax
+\begin{latex-example}
+\newUOLdecorator\UOLfbox{{%
+ \fboxsep=1.2pt \fboxrule=.8pt%
+ \kern-\fboxrule \kern-\fboxsep%
+ \fbox{$#1$}%
+ \kern-\fboxsep \kern-\fboxrule%
+}}
+\end{latex-example}
+
+\begin{latex-example-show}
+\[ a + \UOLfbox{b +c +}[d]^x \UOLfbox{\bigstrut + e}^y + f \]
+\end{latex-example-show}
+
+\noindent Much better!
+
+Note that subscripts / superscripts will be placed directly
+below / above the content, even if the original decorator did not
+support that.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\describemacro{\UOLaugment}{
+ \marg{command sequence}
+}
+
+\noindent This command can augment an existing native decorator command to
+allow overlapping with its original name:
+
+\begin{latex-example-show}
+\UOLaugment\overline
+\UOLaugment\overbrace
+\[ a + \overline{b +}[c + d] \overbrace{\bigstrut + e}^y + f \]
+\end{latex-example-show}
+
+\noindent Note, however, the following assumptions on the original command:
+\begin{itemize}
+ \item It should not be a native \TeX\ command such as |\underline|.
+ Augmenting |\underline| like this actually seems to work fine, but the
+ \TeX\ specification can give us no guarantees about its behavior if
+ we do.
+ \item It should originally only support one standard mandatory argument.
+ If it already supported optional arguments or other code structures
+ then that behavior will be lost after augmentation.
+\end{itemize}
+
+\noindent If these requirements are satisfied then the new command should be
+\emph{almost} backwards compatible. The exceptions being, of course,
+when you supply an optional argument or when it follows another
+\meta{UOL decorator} that does. The other exception is the behavior of
+subscripts and superscripts if the original decorator did not place them
+directly below / above the content.
+
+Of course, you can manually correct for these exceptions, but be aware
+that backwards compatibility is not completely guaranteed if you simply
+augment a decorator without any other measures.
+
+This package does not `pre-augment' any commands.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\describemacro{\UOLunaugment}{
+ \marg{command sequence}
+}
+
+\noindent Assuming that \meta{command sequence} has been augmented by the
+|\UOLaugment| command, using |\UOLunaugment| reverses the effects and
+\meta{command sequence} will once again have its original meaning.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Acknowledgements} %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+I originaly read the following question on \url{http://tex.stackexchange.com}:
+\begin{itemize}
+ \item \url{http://tex.stackexchange.com/questions/12963}
+\end{itemize}
+The commands of this package are partially based on the technique described by
+Herbert and the command definitions proposed by Martin Scharrer.
+
+I got a lot of useful help from the answers to my own questions too:
+\begin{itemize}
+ \item \url{http://tex.stackexchange.com/questions/95786}
+ \item \url{http://tex.stackexchange.com/questions/95897}
+\end{itemize}
+Thanks in particular to David Carlisle and Hendrik Vogt.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\end{document} %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/macros/latex/contrib/underoverlap/with.sty b/macros/latex/contrib/underoverlap/with.sty
new file mode 100644
index 0000000000..49e16dac49
--- /dev/null
+++ b/macros/latex/contrib/underoverlap/with.sty
@@ -0,0 +1,309 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \iffalse %%%%
+% %
+% Copyright (c) 2012 - Michiel Helvensteijn (www.mhelvens.net) %
+% %
+% http://latex-with.googlecode.com %
+% %
+% 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 `author-maintained'. %
+% %
+% The Current Maintainer of this work is Michiel Helvensteijn. %
+% %
+% This work consists of the file with.sty and with.tex. %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \fi %%%%
+
+% \CheckSum{0}
+%
+% \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 \~}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Package Info} %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\RequirePackage{expl3}
+\ProvidesExplPackage{with}{2012/12/23}{0.0.1}
+ {an inline construct for passing token lists as parameters}
+% \end{macrocode}
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Required Packages} %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+% \begin{macrocode}
+\RequirePackage{xparse}
+\RequirePackage{l3regex}
+% \end{macrocode}
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Package Code} %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+% \begin{macrocode}
+\cs_generate_variant:Nn \cs_generate_variant:Nn {cn}
+% \end{macrocode}
+
+
+
+% \begin{macrocode}
+\cs_new:Nn \gen_use:nn {
+ \cs_generate_variant:cn
+ { #1 : \prg_replicate:nn{\tl_count:n{#2}}{n} }
+ { #2 }
+ \use:c{ #1 : #2 }
+}
+% \end{macrocode}
+
+
+
+% \begin{macrocode}
+\cs_new_protected:Nn \with:n {#1}
+\cs_new_protected:Nn \with:nn {
+ \cs_set:Npn \__with:n ##1 {#2}
+ \__with:n {#1} }
+\cs_new_protected:Nn \with:nnn {
+ \cs_set:Npn \__with:nn ##1##2 {#3}
+ \__with:nn {#1}{#2} }
+\cs_new_protected:Nn \with:nnnn {
+ \cs_set:Npn \__with:nnn ##1##2##3 {#4}
+ \__with:nnn {#1}{#2}{#3} }
+\cs_new_protected:Nn \with:nnnnn {
+ \cs_set:Npn \__with:nnnn ##1##2##3##4 {#5}
+ \__with:nnnn {#1}{#2}{#3}{#4} }
+\cs_new_protected:Nn \with:nnnnnn {
+ \cs_set:Npn \__with:nnnnn ##1##2##3##4##5 {#6}
+ \__with:nnnnn {#1}{#2}{#3}{#4}{#5} }
+\cs_new_protected:Nn \with:nnnnnnn {
+ \cs_set:Npn \__with:nnnnnn ##1##2##3##4##5##6 {#7}
+ \__with:nnnnnn {#1}{#2}{#3}{#4}{#5}{#6} }
+\cs_new_protected:Nn \with:nnnnnnnn {
+ \cs_set:Npn \__with:nnnnnnn ##1##2##3##4##5##6##7 {#8}
+ \__with:nnnnnnn {#1}{#2}{#3}{#4}{#5}{#6}{#7} }
+\cs_new_protected:Nn \with:nnnnnnnnn {
+ \cs_set:Npn \__with:nnnnnnnn ##1##2##3##4##5##6##7##8 {#9}
+ \__with:nnnnnnnn {#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8} }
+% \end{macrocode}
+
+
+
+% \begin{macrocode}
+\msg_new:nnnn{with}{invalid-parameter-specs}{
+ The~argument~specification~'#1'~is~not~valid.
+}{
+ The~argument~specification~should~consist~of~between~
+ one~and~seven~of~the~letters~'n',~'o',~'f',~'x',~'u'~or~'U'.
+}
+% \end{macrocode}
+
+
+
+% \begin{macrocode}
+\msg_new:nnnn{with}{invalid-parameter-number}{
+ You~specified~#1~arguments~but~provided~#2.
+}{
+ Your~argument~specification~is~'#3',~which~means~you~should~
+ provide~#1~optional~arguments.~However,~you~provided~only~#2.
+}
+% \end{macrocode}
+
+
+
+% \begin{macrocode}
+\tl_new:N \l__with_argspec_tl
+\tl_new:c {l__with_p_1_tl} \tl_new:c {l__with_p_2_tl}
+\tl_new:c {l__with_p_3_tl} \tl_new:c {l__with_p_4_tl}
+\tl_new:c {l__with_p_5_tl} \tl_new:c {l__with_p_6_tl}
+\tl_new:c {l__with_p_7_tl}
+\tl_new:N \l__with_code_tl
+% \end{macrocode}
+
+
+
+% \begin{macrocode}
+\int_new:N \l__with_arg_int
+\cs_new:Nn \__with_param_name: {
+ l__with_p_
+ \int_use:N\l__with_arg_int
+ _tl
+}
+% \end{macrocode}
+
+
+
+% \begin{macrocode}
+\tl_new:N \l__with_unique_counter_tl
+\tl_new:N \l__with_param_tl
+% \end{macrocode}
+
+
+
+% \begin{macrocode}
+\cs_generate_variant:Nn \with:nn {xn}
+\cs_generate_variant:Nn \with:nnnnnnnnn {oooooooon}
+% \end{macrocode}
+
+
+
+% \begin{macrocode}
+\NewDocumentCommand \with {m +o +o +o +o +o +o +o +m} {
+% \end{macrocode}
+
+
+
+% \begin{macrocode}
+ \regex_match:nnF {^[noxfuU]{1,7}$} {#1}
+ { \msg_critical:nnn{with}{invalid-parameter-specs}{#1} }
+% \end{macrocode}
+
+
+
+% \begin{macrocode}
+ \tl_set:Nn \l__with_argspec_tl {#1}
+ \int_zero:N \l__with_arg_int
+ \IfValueT{#2} {
+ \tl_set:cn {l__with_p_1_tl} {#2} \int_incr:N \l__with_arg_int
+ \IfValueT{#3} {
+ \tl_set:cn {l__with_p_2_tl} {#3} \int_incr:N \l__with_arg_int
+ \IfValueT{#4} {
+ \tl_set:cn {l__with_p_3_tl} {#4} \int_incr:N \l__with_arg_int
+ \IfValueT{#5} {
+ \tl_set:cn {l__with_p_4_tl} {#5} \int_incr:N \l__with_arg_int
+ \IfValueT{#6} {
+ \tl_set:cn {l__with_p_5_tl} {#6} \int_incr:N \l__with_arg_int
+ \IfValueT{#7} {
+ \tl_set:cn {l__with_p_6_tl} {#7} \int_incr:N \l__with_arg_int
+ \IfValueT{#8} {
+ \tl_set:cn {l__with_p_7_tl} {#8} \int_incr:N \l__with_arg_int
+ }}}}}}}
+ \tl_set:Nn \l__with_code_tl {#9}
+% \end{macrocode}
+
+
+
+% \begin{macrocode}
+ \int_compare:nNnF {\tl_count:n{#1}} = {\l__with_arg_int} {
+ \msg_error:nnxxx{with}{invalid-parameter-number}
+ { \tl_count:n{#1} }
+ { \int_use:N \l__with_arg_int }
+ { #1 }
+ }
+% \end{macrocode}
+
+
+
+% \begin{macrocode}
+ \tl_replace_all:Nnn \l__with_argspec_tl {u} {x}
+ \tl_replace_all:Nnn \l__with_argspec_tl {U} {c}
+% \end{macrocode}
+
+
+
+% \begin{macrocode}
+ \int_zero:N \l__with_arg_int
+ \tl_map_inline:nn {#1} {
+ \int_incr:N \l__with_arg_int
+% \end{macrocode}
+
+
+
+% \begin{macrocode}
+ \tl_if_in:nnT {uU} {##1} {
+ \tl_set:Nx \l__with_unique_counter_tl
+ { g__with_unique_ \use:c{\__with_param_name:} _count_int }
+
+ \int_if_exist:cF {\l__with_unique_counter_tl}
+ { \int_new:c {\l__with_unique_counter_tl} }
+
+ \int_incr:c {\l__with_unique_counter_tl}
+
+ \tl_put_left:cx {\__with_param_name:}
+ { g_with_unique_ }
+
+ \tl_put_right:cx {\__with_param_name:}
+ { _ \int_use:c{\l__with_unique_counter_tl} }
+ }
+% \end{macrocode}
+
+
+
+% \uninteresting\begin{macrocode}
+ }
+% \end{macrocode}
+
+
+
+% \begin{macrocode}
+ \with:oooooooon {\l__with_argspec_tl}
+ {\cs:w l__with_p_1_tl \cs_end:}
+ {\cs:w l__with_p_2_tl \cs_end:}
+ {\cs:w l__with_p_3_tl \cs_end:}
+ {\cs:w l__with_p_4_tl \cs_end:}
+ {\cs:w l__with_p_5_tl \cs_end:}
+ {\cs:w l__with_p_6_tl \cs_end:}
+ {\cs:w l__with_p_7_tl \cs_end:} {
+ \with:oooooooon {##1o}{##2}{##3}{##4}
+ {##5}{##6}{##7}{##8} {
+ \int_case:nnn {\l__with_arg_int} {
+ {1} { \gen_use:nn{with}{####1}
+ {####2} {\l__with_code_tl} }
+ {2} { \gen_use:nn{with}{####1}
+ {####2}{####3} {\l__with_code_tl} }
+ {3} { \gen_use:nn{with}{####1}
+ {####2}{####3}{####4} {\l__with_code_tl} }
+ {4} { \gen_use:nn{with}{####1}
+ {####2}{####3}{####4}
+ {####5} {\l__with_code_tl} }
+ {5} { \gen_use:nn{with}{####1}
+ {####2}{####3}{####4}
+ {####5}{####6} {\l__with_code_tl} }
+ {6} { \gen_use:nn{with}{####1}
+ {####2}{####3}{####4}
+ {####5}{####6}{####7} {\l__with_code_tl} }
+ {7} { \gen_use:nn{with}{####1}
+ {####2}{####3}{####4}
+ {####5}{####6}{####7}
+ {####8} {\l__with_code_tl} }
+ }{}
+ }
+ }
+% \end{macrocode}
+
+
+
+% \uninteresting\begin{macrocode}
+}
+% \end{macrocode}
+
+