From 740a11f29a3551babe3d7edbb57ac3baa2280a3f Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Sat, 26 Feb 2022 03:00:34 +0000
Subject: CTAN sync 202202260300

---
 .../contrib/stex/source/extensions/notesslides.dtx | 1078 ++++++++++++++++++++
 1 file changed, 1078 insertions(+)
 create mode 100644 macros/latex/contrib/stex/source/extensions/notesslides.dtx

(limited to 'macros/latex/contrib/stex/source/extensions/notesslides.dtx')

diff --git a/macros/latex/contrib/stex/source/extensions/notesslides.dtx b/macros/latex/contrib/stex/source/extensions/notesslides.dtx
new file mode 100644
index 0000000000..a6ff395377
--- /dev/null
+++ b/macros/latex/contrib/stex/source/extensions/notesslides.dtx
@@ -0,0 +1,1078 @@
+% \iffalse meta-comment
+% A LaTeX Class for Semantic Lectures Slides (originally developed for Michael Kohlhase)
+% Copyright (c) 2019 Michael Kohlhase, all rights reserved
+%               this file is released under the
+%               Gnu Library Public Licences (LGPL)
+%
+% The original of this file is in the public repository at 
+% http://github.com/sLaTeX/sTeX/
+% \fi
+% 
+% \iffalse
+%
+%<*driver>
+\providecommand\bibfolder{../../lib/bib}
+\input{../../doc/docheader}
+
+\begin{document}
+  \DocInput{\jobname.dtx}
+\end{document}
+%</driver>
+% \fi
+% ^^A\changes{v0.1}{2005/12/06}{Initial Version}
+% 
+% \GetFileInfo{notesslides.cls}
+% \MakeShortVerb{\|}
+%
+% \def\twin#1#2{\index{#1!#2}\index{#2!#1}}
+% \def\twintoo#1#2{{#1 #2}\twin{#1}{#2}}
+% \def\atwin#1#2#3{\index{#1!#2!#3}\index{#3!#2 (#1)}}
+% \def\atwintoo#1#2#3{{#1 #2 #3}\atwin{#1}{#2}{#3}}
+%
+% \def\scsys#1{{{\sc #1}}\index{#1@{\sc #1}}}
+% \def\stex{\hbox{\raisebox{-.5ex}S\kern-.5ex\TeX}}
+% \def\sTeX{\stex}
+% \def\cnxml{\scshape{CNXml}}
+% \def\connexions{\scshape{Connexions}}
+% \def\element#1{{\ttfamily{#1}}}
+% \def\snippet#1{{\ttfamily{#1}}}
+% \def\cnxlatex{CNX\LaTeX\xspace}
+% \def\mathml{{\scshape{MathML}}\xspace}
+% \def\omdoc{OMDoc\xspace}
+% \def\activemath{{\scshape{ActiveMath}}\xspace}
+% \def\textwarning{\includegraphics[width=1.2em]{dangerous-bend}\xspace}
+% 
+% \title{NotesSlides -- Slides and Course Notes\thanks{Version {\fileversion}
+% (last revised {\filedate})}}
+%    \author{Michael Kohlhase\\
+%            FAU Erlangen-N\"urnberg\\
+%            \url{http://kwarc.info/kohlhase}}
+% \maketitle
+%
+%\ifinfulldoc\else
+% This is the documentation for the \pkg{notesslides} package.
+% For a more high-level introduction, 
+%  see \href{\basedocurl/manual.pdf}{the \sTeX Manual} or the
+% \href{\basedocurl/stex.pdf}{full \sTeX documentation}.
+%
+% \input{../../doc/packages/slides}
+% \fi
+%
+% \begin{documentation}\label{pkg:notesslides:doc}
+%
+%   We present a document class from which we can generate both course slides and course
+%   notes in a transparent way.
+%
+%\section{Introduction}
+%
+% The |notesslides| document class is derived from |beamer.cls|~\cite{beamerclass:on}, it
+% adds a ``notes version'' for course notes derived from the |omdoc|
+% class~\cite{Kohlhase:smomdl} that is more suited to printing than the one supplied by
+% |beamer.cls|.
+%
+% 
+%\section{The User Interface}\label{sec:user}
+%
+% The |notesslides| class takes the notion of a slide frame from Till Tantau's excellent
+% |beamer| class and adapts its notion of frames for use in the \sTeX and \omdoc. To
+% support semantic course notes, it extends the notion of mixing frames and explanatory
+% text, but rather than treating the frames as images (or integrating their contents into
+% the flowing text), the |notesslides| package displays the slides as such in the course
+% notes to give students a visual anchor into the slide presentation in the course (and to
+% distinguish the different writing styles in slides and course notes).
+% 
+% In practice we want to generate two documents from the same source: the slides for
+% presentation in the lecture and the course notes as a narrative document for home
+% study. To achieve this, the |notesslides| class has two modes: \emph{slides mode} and
+% \emph{notes mode} which are determined by the package option. 
+%
+% \subsection{Package Options}\label{sec:user:options}
+% 
+% The |notesslides| class takes a variety of class options:\ednote{leaving out noproblems
+% for the moment until we decide what to do with it.}
+% \begin{itemize}
+% \item The options \DescribeMacro{slides}|slides| and \DescribeMacro{notes}|notes| switch
+%   between slides mode and notes mode (see Section~\ref{sec:user:notesslides}).
+% \item If the option \DescribeMacro{sectocframes}|sectocframes| is given, then for the
+%   |omgroup|s, special frames with the |omgroup| title (and number) are generated.
+% \item \DescribeMacro{showmeta}|showmeta|. If this is set, then the metadata keys are
+%   shown (see~\cite{Kohlhase:metakeys:git} for details and customization options).
+% \item If the option \DescribeMacro{frameimages}|frameimages| is set, then slide mode
+%   also shows the |\frameimage|-generated frames (see
+%   section~\ref{sec:user:frameimage}). If also the \DescribeMacro{fiboxed}|fiboxed|
+%   option is given, the slides are surrounded by a box.
+% \item \DescribeMacro{topsect}|topsect=|\meta{sect} can be used to specify the
+%   top-level sectioning level; the default for \meta{sect} is |section|.
+% \end{itemize}
+% 
+% \subsection{Notes and Slides}\label{sec:user:notesslides}
+% 
+% Slides are represented with the \DescribeEnv{frame}|frame| just like in the |beamer|
+% class, see~\cite{Tantau:ugbc} for details. The |notesslides| class adds the
+% \DescribeEnv{note}|note| environment for encapsulating the course note
+% fragments.\footnote{MK: it would be very nice, if we did not need this environment, and
+% this should be possible in principle, but not without intensive LaTeX trickery. Hints to
+% the author are welcome.} 
+%
+% \textwarning Note that it is essential to start and end the |notes| environment at the
+% start of the line -- in particular, there may not be leading blanks -- else {\LaTeX}
+% becomes confused and throws error messages that are difficult to decipher.
+%
+% \begin{exfig}
+% \begin{verbatim}
+% \ifnotes\maketitle\else
+% \frame[noframenumbering]\maketitle\fi
+% 
+% \begin{note}
+%   We start this course with ...
+% \end{note}
+%
+% \begin{frame}
+%   \frametitle{The first slide}
+%   ...
+% \end{frame}
+% \begin{note}
+%   ... and more explanatory text
+% \end{note}
+%
+% \begin{frame}
+%   \frametitle{The second slide}
+%   ...
+% \end{frame}
+% ...
+% \end{verbatim}
+% \caption{A typical Course Notes File}\label{fig:notesfile}
+% \end{exfig}
+% 
+% By interleaving the |frame| and |note| environments, we can build course notes as shown
+% in Figure~\ref{fig:notesfile}.
+%
+% Note the use of the \DescribeMacro{\ifnotes}|\ifnotes| conditional, which allows
+% different treatment between |notes| and |slides| mode -- manually setting |\notestrue|
+% or |\notesfalse| is strongly discouraged however.
+% 
+% \textwarning: We need to give the title frame the |noframenumbering| option so that the
+% frame numbering is kept in sync between the slides and the course notes.
+%
+% \textwarning: The |beamer| class recommends not to use the |allowframebreaks| option on
+% frames (even though it is very convenient). This holds even more in the |notesslides|
+% case: At least in conjunction with |\newpage|, frame numbering behaves funnily (we have
+% tried to fix this, but who knows). 
+% 
+% If we want to transclude a the contents of a file as a note, we can use a new variant
+% \DescribeMacro{\inputref*}|\inputref*| of the |\inputref| macro from
+% \cite{KohAmb:smmssl:git}: |\inputref*{foo}| is equivalent to
+% |\begin{note}\inputref{foo}\end{note}|.
+% 
+% There are some environments that tend to occur at the top-level of |note|
+% environments. We make convenience versions of these: e.g. the
+% \DescribeEnv{nparagraph}|nparagraph| environment is just an |sparagraph| inside a |note|
+% environment (but looks nicer in the source, since it avoids one level of source
+% indenting). Similarly, we have the \DescribeEnv{nfragment}|nomgroup|,
+% \DescribeEnv{ndefinition}|ndefinition|, \DescribeEnv{nexample}|nexample|,
+% \DescribeEnv{nsproof}|nsproof|, and \DescribeEnv{nassertion}|nassertion| environments.
+%  
+% \subsection{Header and Footer Lines of the Slides}\label{sec:user:headfootlines}
+%
+% The default logo provided by the |notesslides| package is the {\sTeX} logo it can be
+% customized using \DescribeMacro{\setslidelogo}|\setslidelogo{|\meta{logo name}|}|.
+%
+% The default footer line of the |notesslides| package mentions copyright and licensing. In
+% the |beamer| class, |\source| stores the author's name as the copyright holder . By
+% default it is {\it Michael Kohlhase} in the |notesslides| package since he is the main
+% user and designer of this package. \DescribeMacro{\setsource}|\setsource{|\meta{name}|}|
+% can change the writer's name. For licensing, we use the Creative Commons
+% Attribuition-ShareAlike license by default to strengthen the public domain. If package
+% |hyperref| is loaded, then we can attach a hyperlink to the license
+% logo. \DescribeMacro{\setlicensing}|\setlicensing[|\meta{url}|]{|\meta{logo name}|}| is
+% used for customization, where \meta{url} is optional.
+%
+% \subsection{Frame Images}\label{sec:user:frameimage}
+% 
+% Sometimes, we want to integrate slides as images after all -- e.g. because we already
+% have a PowerPoint presentation, to which we want to add \sTeX notes. In this case we can
+% use \DescribeMacro{\frameimage}|\frameimage[|\meta{opt}|]{|\meta{path}|}|, where
+% \meta{opt} are the options of |\includegraphics| from the |graphicx|
+% package~\cite{CarRah:tpp99} and \meta{path} is the file path (extension can be left off
+% like in |\includegraphics|). We have added the |label| key that allows to give a frame
+% label that can be referenced like a regular |beamer| frame.\ednote{MK: the hyperref link
+% does not seem to work yet. I wonder why but do not have the time to fix it.}
+% 
+% The \DescribeMacro{\mhframeimage}|\mhframeimage| macro is a variant of |\frameimage|
+% with repository support. Instead of writing
+% \begin{verbatim}
+% \frameimage{\MathHub{fooMH/bar/source/baz/foobar}}
+% \end{verbatim}
+% we can simply write (assuming that |\MathHub| is defined as above)
+% \begin{verbatim}
+% \mhframeimage[fooMH/bar]{baz/foobar}
+% \end{verbatim}
+% Note that the |\mhframeimage| form is more semantic, which allows more advanced document
+% management features in \textsf{MathHub}.
+% 
+% If |baz/foobar| is the ``current module'', i.e. if we are on the \textsf{MathHub} path
+% \ldots|MathHub/fooMH/bar|\ldots, then stating the repository in the first optional
+% argument is redundant, so we can just use
+% \begin{verbatim}
+% \mhframeimage{baz/foobar}
+% \end{verbatim}
+%
+% \subsection{Colors and Highlighting}\label{sec:user:highlighting}
+% The \DescribeMacro{\textwarning}|\textwarning| macro generates a warning
+% sign: \textwarning
+%
+% \subsection{Front Matter, Titles, etc.}\label{sec:user:matter}
+%
+% \subsection{Excursions}\label{sec:user:excursions}
+%
+% In course notes, we sometimes want to point to an ``excursion'' -- material that is
+% either presupposed or tangential to the course at the moment -- e.g. in an appendix. The
+% typical setup is the following:
+% 
+% \begin{verbatim}
+% \excursion{founif}{../ex/founif}{We will cover first-order unification in}
+% ...
+% \begin{appendix}\printexcursions\end{appendix}
+% \end{verbatim}
+%
+% The \DescribeMacro{\excursion}|\excursion{|\meta{ref}|}{|\meta{path}|}{|\meta{text}|}| is
+% syntactic sugar for \DescribeMacro{\activateexcursion}
+%
+% \begin{verbatim}
+% \begin{nparagraph}[title=Excursion]
+%   \activateexcursion{founif}{../ex/founif}
+%   We will cover first-order unification in \sref{founif}.
+% \end{nparagraph}
+% \end{verbatim}
+%
+% where \DescribeMacro{\activateexcursion}|\activateexcursion{|\meta{path}|}| augments the
+% |\printexcursions| macro by a call |\inputref{|\meta{path}|}|. In this way, the3
+% \DescribeMacro{\printexcursions}|\printexcursions| macro (usually in the appendix) will
+% collect up all excursions that are specified in the main text.
+%
+% Sometimes, we want to reference -- in an excursion -- part of another. We can use
+% \DescribeMacro{\excursionref}|\excursionref{|\meta{label}|}| for that.
+%
+% Finally, we usually want to put the excursions into an |omgroup| environment and add an
+% introduction, therefore we provide the a variant of the |\printexcursions| macro:
+% \DescribeMacro{\excursiongroup}|\excursiongroup[id=|\meta{id}|,intro=|\meta{path}|]| is
+% equivalent to
+% \begin{verbatim}
+% \begin{note}
+% \begin{sfragment}[id=<id>]{Excursions}
+%   \inputref{<path>}
+%   \printexcursions
+% \end{sfragment}
+% \end{note}
+% \end{verbatim}
+% 
+% \subsection{Miscellaneous}\label{sec:user:misc}
+%
+% \section{Limitations}\label{sec:limitations}
+% 
+% In this section we document known limitations. If you want to help alleviate them,
+% please feel free to contact the package author. Some of them are currently discussed in
+% the \sTeX GitHub repository~\cite{sTeX:github:on}. 
+% \begin{enumerate}
+% \item when option |book| which uses |\pagestyle{headings}| is given and semantic macros
+%   are given in the |omgroup| titles, then they sometimes are not defined by the time the
+%   heading is formatted. Need to look into how the headings are made. This is a problem
+%   of the underlying |omdoc| package.
+% \end{enumerate}
+% 
+% \end{documentation}
+%
+% \begin{implementation}\label{pkg:notesslides:impl}
+% 
+%\section{NotesSlides -- Implementation}\label{sec:impl}
+%
+%\subsection{Class and Package Options}\label{sec:impl:init}
+%
+% We define some Package Options and switches for the |notesslides| class and activate them
+% by passing them on to |beamer.cls| and |omdoc.cls| and the |notesslides| package. We pass
+% the |nontheorem| option to the |statements| package when we are not in notes mode, since
+% the |beamer| package has its own (overlay-aware) theorem environments. 
+%
+%    \begin{macrocode}
+%<*cls>
+%<@@=notesslides>
+\ProvidesExplClass{notesslides}{2022/02/24}{3.0.0}{notesslides Class}
+\RequirePackage{l3keys2e}
+
+\keys_define:nn{notesslides / cls}{
+  class   .code:n   = {
+    \PassOptionsToClass{\CurrentOption}{document-structure}
+    \str_if_eq:nnT{#1}{book}{
+      \PassOptionsToPackage{defaulttopsec=part}{notesslides}
+    }
+    \str_if_eq:nnT{#1}{report}{
+      \PassOptionsToPackage{defaulttopsec=part}{notesslides}
+    }
+  },
+  notes   .bool_set:N  = \c_@@_notes_bool ,
+  slides  .code:n      = { \bool_set_false:N \c_@@_notes_bool },
+  unknown .code:n      = {
+    \PassOptionsToClass{\CurrentOption}{document-structure}
+    \PassOptionsToClass{\CurrentOption}{beamer}
+    \PassOptionsToPackage{\CurrentOption}{notesslides}
+  }
+}
+\ProcessKeysOptions{ notesslides / cls }
+\bool_if:NTF \c_@@_notes_bool {
+  \PassOptionsToPackage{notes=true}{notesslides}
+}{
+  \PassOptionsToPackage{notes=false}{notesslides}
+}
+%</cls>
+%    \end{macrocode}
+% now we do the same for the |notesslides| package. 
+%    \begin{macrocode}
+%<*package>
+\ProvidesExplPackage{notesslides}{2022/02/24}{3.0.0}{notesslides Package}
+\RequirePackage{l3keys2e}
+
+\keys_define:nn{notesslides / pkg}{
+  topsect         .str_set_x:N  = \c_@@_topsect_str,
+  defaulttopsect  .str_set_x:N  = \c_@@_defaulttopsec_str,
+  notes           .bool_set:N   = \c_@@_notes_bool ,
+  slides          .code:n       = { \bool_set_false:N \c_@@_notes_bool },
+  sectocframes    .bool_set:N   = \c_@@_sectocframes_bool ,
+  frameimages     .bool_set:N   = \c_@@_frameimages_bool ,
+  fiboxed         .bool_set:N   = \c_@@_fiboxed_bool ,
+  noproblems      .bool_set:N   = \c_@@_noproblems_bool,
+  unknown         .code:n       = {
+    \PassOptionsToClass{\CurrentOption}{stex}
+    \PassOptionsToClass{\CurrentOption}{tikzinput}
+  }
+}
+\ProcessKeysOptions{ notesslides / pkg }
+\newif\ifnotes
+\bool_if:NTF \c_@@_notes_bool {
+  \notestrue
+}{
+  \notesfalse
+}
+
+%    \end{macrocode}
+% we give ourselves a macro |\@@topsect| that needs only be evaluated once, so that the
+% |\ifdefstring| conditionals work below.
+%    \begin{macrocode}
+\str_if_empty:NTF \c_@@_topsect_str {
+  \str_set_eq:NN \@@topsect \c_@@_defaulttopsec_str
+}{
+  \str_set_eq:NN \@@topsect \c_@@_topsect_str
+}
+%</package>
+%    \end{macrocode}
+%
+% Depending on the options, we either load the |article|-based |document-structure| or the |beamer|
+% class (and set some counters).
+%    \begin{macrocode}
+%<*cls>
+\bool_if:NTF \c_@@_notes_bool {
+  \LoadClass{document-structure}
+}{
+  \LoadClass[10pt,notheorems,xcolor={dvipsnames,svgnames}]{beamer}
+  \newcounter{Item}
+  \newcounter{paragraph}
+  \newcounter{subparagraph}
+  \newcounter{Hfootnote}
+  \RequirePackage{document-structure}
+}
+%    \end{macrocode}
+% now it only remains to load the |notesslides| package that does all the rest. 
+%    \begin{macrocode}
+\RequirePackage{notesslides}
+%</cls>
+%    \end{macrocode}
+% 
+% In |notes| mode, we also have to make the |beamer|-specific things available to
+% |article| via the |beamerarticle| package. We use options to avoid loading theorem-like
+% environments, since we want to use our own from the $\sTeX$ packages.  The first batch
+% of packages we want are loaded on |notesslides.sty|. These are the general ones, we will
+% load the \sTeX-specific ones after we have done some work (e.g. defined the counters
+% |m*|). Only the |stex-logo| package is already needed now for the default theme.
+%
+%    \begin{macrocode}
+%<*package>
+\bool_if:NT \c_@@_notes_bool {
+  \RequirePackage{a4wide}
+  \RequirePackage{marginnote}
+  \PassOptionsToPackage{usenames,dvipsnames,svgnames}{xcolor}
+  \RequirePackage{mdframed}
+  \RequirePackage[noxcolor,noamsthm]{beamerarticle}
+  \RequirePackage[bookmarks,bookmarksopen,bookmarksnumbered,breaklinks,hidelinks]{hyperref}
+}
+\RequirePackage{stex-tikzinput}
+\RequirePackage{etoolbox}
+\RequirePackage{amssymb}
+\RequirePackage{amsmath}
+\RequirePackage{comment}
+\RequirePackage{textcomp}
+\RequirePackage{url}
+\RequirePackage{graphicx}
+\RequirePackage{pgf}
+%    \end{macrocode}
+% 
+% \subsection{Notes and Slides}\label{sec:impl:noteslides}
+%
+% For the lecture notes cases, we also provide the |\usetheme| macro that would otherwise
+% come from the the |beamer| class. While the latter loads
+% |beamertheme|\meta{theme}{.sty}, the notes version loads
+% |beamernotestheme|\meta{theme}|.sty|.\ednote{MK: This is not ideal, but I am not sure
+% that I want to be able to provide the full theme functionality there.}
+%    \begin{macrocode}
+\bool_if:NT \c_@@_notes_bool {
+  \renewcommand\usetheme[2][]{\usepackage[#1]{beamernotestheme#2}}
+}
+%    \end{macrocode}
+% We define the sizes of slides in the notes. Somehow, we cannot get by with the same
+% here. 
+%
+%    \begin{macrocode}
+\newcounter{slide}
+\newlength{\slidewidth}\setlength{\slidewidth}{13.5cm}
+\newlength{\slideheight}\setlength{\slideheight}{9cm}
+%    \end{macrocode}
+% 
+% \begin{environment}{note}
+% The |note| environment is used to leave out text in the |slides| mode. It does not have
+% a counterpart in OMDoc. So for course notes, we define the |note| environment to be a
+% no-operation otherwise we declare the |note| environment as a comment via the |comment|
+% package.
+%    \begin{macrocode}
+\bool_if:NTF \c_@@_notes_bool {
+  \renewenvironment{note}{\ignorespaces}{}
+}{
+  \excludecomment{note}
+}
+%    \end{macrocode}
+% \end{environment}
+% 
+% We first set up the slide boxes in |article| mode. We set up sizes and provide a
+% box register for the frames and a counter for the slides.
+% 
+%    \begin{macrocode}
+\bool_if:NT \c_@@_notes_bool {
+  \newlength{\slideframewidth}
+  \setlength{\slideframewidth}{1.5pt}
+%    \end{macrocode}
+% 
+% \begin{environment}{frame}
+%   We first define the keys. 
+%    \begin{macrocode}
+  \cs_new_protected:Nn \_@@_do_yes_param:Nn {
+    \exp_args:Nx \str_if_eq:nnTF { \str_uppercase:n{ #2 } }{ yes }{
+      \bool_set_true:N #1
+    }{
+      \bool_set_false:N #1
+    }
+  }
+  \keys_define:nn{notesslides / frame}{
+    label               .str_set_x:N  = \l_@@_frame_label_str,
+    allowframebreaks    .code:n       = {
+      \_@@_do_yes_param:Nn \l_@@_frame_allowframebreaks_bool { #1 }
+    },
+    allowdisplaybreaks  .code:n       = {
+      \_@@_do_yes_param:Nn \l_@@_frame_allowdisplaybreaks_bool { #1 }
+    },
+    fragile             .code:n       = {
+      \_@@_do_yes_param:Nn \l_@@_frame_fragile_bool { #1 }
+    },
+    shrink              .code:n       = {
+      \_@@_do_yes_param:Nn \l_@@_frame_shrink_bool { #1 }
+    },
+    squeeze             .code:n       = {
+      \_@@_do_yes_param:Nn \l_@@_frame_squeeze_bool { #1 }
+    },
+    t                   .code:n       = {
+      \_@@_do_yes_param:Nn \l_@@_frame_t_bool { #1 }
+    },
+  }
+  \cs_new_protected:Nn \_@@_frame_args:n {
+    \str_clear:N \l_@@_frame_label_str
+    \bool_set_true:N \l_@@_frame_allowframebreaks_bool
+    \bool_set_true:N \l_@@_frame_allowdisplaybreaks_bool
+    \bool_set_true:N \l_@@_frame_fragile_bool
+    \bool_set_true:N \l_@@_frame_shrink_bool
+    \bool_set_true:N \l_@@_frame_squeeze_bool
+    \bool_set_true:N \l_@@_frame_t_bool
+    \keys_set:nn { notesslides / frame }{ #1 }
+  }
+%    \end{macrocode}
+% We define the environment, read them, and construct the slide number and label.
+%    \begin{macrocode}
+  \renewenvironment{frame}[1][]{
+    \_@@_frame_args:n{#1}
+    \sffamily
+    \stepcounter{slide}
+    \def\@currentlabel{\theslide}
+    \str_if_empty:NF \l_@@_frame_label_str {
+      \label{\l_@@_frame_label_str}
+    }
+%    \end{macrocode}
+%   We redefine the |itemize| environment so that it looks more like the one in |beamer|. 
+%    \begin{macrocode}
+    \def\itemize@level{outer}
+    \def\itemize@outer{outer}
+    \def\itemize@inner{inner}
+    \renewcommand\newpage{\addtocounter{framenumber}{1}}
+    \newcommand\metakeys@show@keys[2]{\marginnote{{\scriptsize ##2}}}
+    \renewenvironment{itemize}{
+      \ifx\itemize@level\itemize@outer
+        \def\itemize@label{$\rhd$}
+      \fi
+      \ifx\itemize@level\itemize@inner
+        \def\itemize@label{$\scriptstyle\rhd$}
+      \fi
+      \begin{list}
+      {\itemize@label}
+      {\setlength{\labelsep}{.3em}
+       \setlength{\labelwidth}{.5em}
+       \setlength{\leftmargin}{1.5em}
+      }
+      \edef\itemize@level{\itemize@inner}
+    }{
+      \end{list}
+    }
+%    \end{macrocode}
+% We create the box with the |mdframed| environment from the equinymous package.
+%    \begin{macrocode}
+    \begin{mdframed}[linewidth=\slideframewidth,skipabove=1ex,skipbelow=1ex,userdefinedwidth=\slidewidth,align=center]\sf
+  }{
+    \medskip\miko@slidelabel\end{mdframed}
+  }
+%    \end{macrocode}
+% \end{environment}
+% 
+% Now, we need to redefine the frametitle (we are still in course notes mode). 
+% \begin{macro}{\frametitle}
+%    \begin{macrocode}
+  \renewcommand{\frametitle}[1]{{\Large\bf\sf\color{blue}{#1}}\medskip}
+}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pause}
+%   \ednote{MK: fake it in notes mode for now}
+%    \begin{macrocode}
+\bool_if:NT \c_@@_notes_bool {
+  \newcommand\pause{}
+}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{environment}{nparagraph}
+%    \begin{macrocode}
+\bool_if:NTF \c_@@_notes_bool {
+  \newenvironment{nparagraph}[1][]{\begin{sparagraph}[#1]}{\end{sparagraph}}
+}{
+  \excludecomment{nparagraph}
+}
+%    \end{macrocode}
+% \end{environment}
+%
+% \begin{environment}{nfragment}
+%    \begin{macrocode}
+\bool_if:NTF \c_@@_notes_bool {
+  \newenvironment{nfragment}[2][]{\begin{sfragment}[#1]{#2}}{\end{sfragment}}
+}{
+  \excludecomment{nfragment}
+}
+%    \end{macrocode}
+% \end{environment}
+%
+% \begin{environment}{ndefinition}
+%    \begin{macrocode}
+\bool_if:NTF \c_@@_notes_bool {
+  \newenvironment{ndefinition}[1][]{\begin{sdefinition}[#1]}{\end{sdefinition}}
+}{
+  \excludecomment{ndefinition}
+}
+%    \end{macrocode}
+% \end{environment}
+%
+% \begin{environment}{nassertion}
+%    \begin{macrocode}
+\bool_if:NTF \c_@@_notes_bool {
+  \newenvironment{nassertion}[1][]{\begin{sassertion}[#1]}{\end{sassertion}}
+}{
+  \excludecomment{nassertion}
+}
+%    \end{macrocode}
+% \end{environment}
+%
+% \begin{environment}{nsproof}
+%    \begin{macrocode}
+\bool_if:NTF \c_@@_notes_bool {
+  \newenvironment{nproof}[2][]{\begin{sproof}[#1]{#2}}{\end{sproof}}
+}{
+  \excludecomment{nproof}
+}
+%    \end{macrocode}
+% \end{environment}
+%
+% \begin{environment}{nexample}
+%    \begin{macrocode}
+\bool_if:NTF \c_@@_notes_bool {
+  \newenvironment{nexample}[1][]{\begin{sexample}[#1]}{\end{sexample}}
+}{
+  \excludecomment{nexample}
+}
+%    \end{macrocode}
+% \end{environment}
+%
+% \begin{macro}{\inputref@*skip}
+% We customize the hooks for in |\inputref|. 
+%    \begin{macrocode}
+\def\inputref@preskip{\smallskip}
+\def\inputref@postskip{\medskip}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\inputref*}
+%    \begin{macrocode}
+\let\orig@inputref\inputref
+\def\inputref{\@ifstar\ninputref\orig@inputref}
+\newcommand\ninputref[2][]{
+  \bool_if:NT \c_@@_notes_bool {
+    \orig@inputref[#1]{#2}
+  }
+}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \subsection{Header and Footer Lines}\label{sec:impl:headfootlines}
+%
+% Now, we set up the infrastructure for the footer line of the slides, we use boxes for
+% the logos, so that they are only loaded once, that considerably speeds up processing.
+% 
+% \begin{macro}{\setslidelogo}
+% The default logo is the {\sTeX} logo. Customization can be done by |\setslidelogo{|\meta{logo name}|}|.
+%    \begin{macrocode}
+\newlength{\slidelogoheight}
+
+\bool_if:NTF \c_@@_notes_bool {
+  \setlength{\slidelogoheight}{.4cm}
+}{
+  \setlength{\slidelogoheight}{1cm}
+}
+\newsavebox{\slidelogo}
+\sbox{\slidelogo}{\sTeX}
+\newrobustcmd{\setslidelogo}[1]{
+  \sbox{\slidelogo}{\includegraphics[height=\slidelogoheight]{#1}}
+}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setsource}
+% |\source| stores the writer's name. By default it is {\it Michael Kohlhase} since he is the main user and designer of this package. |\setsource{|\meta{name}|}| can change the writer's name.
+%    \begin{macrocode}
+\def\source{Michael Kohlhase}% customize locally
+\newrobustcmd{\setsource}[1]{\def\source{#1}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setlicensing}
+%   Now, we set up the copyright and licensing. By default we use the Creative Commons
+%   Attribuition-ShareAlike license to strengthen the public domain. If package |hyperref|
+%   is loaded, then we can attach a hyperlink to the license
+%   logo. |\setlicensing[|\meta{url}|]{|\meta{logo name}|}| is used for customization,
+%   where ||\meta{url}|| is optional.
+%    \begin{macrocode}
+\def\copyrightnotice{\footnotesize\copyright :\hspace{.3ex}{\source}}
+\newsavebox{\cclogo}
+\sbox{\cclogo}{\includegraphics[height=\slidelogoheight]{cc_somerights}}
+\newif\ifcchref\cchreffalse
+\AtBeginDocument{
+  \@ifpackageloaded{hyperref}{\cchreftrue}{\cchreffalse}
+}
+\def\licensing{
+  \ifcchref
+    \href{http://creativecommons.org/licenses/by-sa/2.5/}{\usebox{\cclogo}}
+  \else
+    {\usebox{\cclogo}}
+  \fi
+}
+\newrobustcmd{\setlicensing}[2][]{
+  \def\@url{#1}
+  \sbox{\cclogo}{\includegraphics[height=\slidelogoheight]{#2}}
+  \ifx\@url\@empty
+    \def\licensing{{\usebox{\cclogo}}}
+  \else
+    \def\licensing{
+      \ifcchref
+      \href{#1}{\usebox{\cclogo}}
+      \else
+      {\usebox{\cclogo}}
+      \fi
+    }
+  \fi
+}
+%    \end{macrocode}
+% \end{macro} 
+%
+% \begin{macro}{\slidelabel}
+% Now, we set up the slide label for the |article| mode.\ednote{see that we can use the themes for the slides some day. This is all fake.}
+%    \begin{macrocode}
+\newrobustcmd\miko@slidelabel{
+  \vbox to \slidelogoheight{
+    \vss\hbox to \slidewidth
+    {\licensing\hfill\copyrightnotice\hfill\arabic{slide}\hfill\usebox{\slidelogo}}
+  }
+}
+%    \end{macrocode}
+% \end{macro}
+% \subsection{Frame Images}\label{sec:impl:frameimage}
+%
+% \begin{macro}{\frameimage}
+%   We have to make sure that the width is overwritten, for that we check the
+%   |\Gin@ewidth| macro from the |graphicx| package. We also add the |label| key. 
+%    \begin{macrocode}
+\def\Gin@mhrepos{}
+\define@key{Gin}{mhrepos}{\def\Gin@mhrepos{#1}}
+\define@key{Gin}{label}{\def\@currentlabel{\arabic{slide}}\label{#1}}
+\newrobustcmd\frameimage[2][]{
+  \stepcounter{slide}
+  \bool_if:NT \c_@@_frameimages_bool {
+    \def\Gin@ewidth{}\setkeys{Gin}{#1}
+    \bool_if:NF \c_@@_notes_bool { \vfill }
+    \begin{center}
+      \bool_if:NTF \c_@@_fiboxed_bool {
+        \fbox{
+          \ifx\Gin@ewidth\@empty
+            \ifx\Gin@mhrepos\@empty
+              \mhgraphics[width=\slidewidth,#1]{#2}
+            \else
+              \mhgraphics[width=\slidewidth,#1,mhrepos=\Gin@mhrepos]{#2}
+            \fi
+          \else% Gin@ewidth empty
+            \ifx\Gin@mhrepos\@empty
+              \mhgraphics[#1]{#2}
+            \else
+              \mhgraphics[#1,mhrepos=\Gin@mhrepos]{#2}
+            \fi
+          \fi% Gin@ewidth empty
+        }
+      }{
+        \ifx\Gin@ewidth\@empty
+          \ifx\Gin@mhrepos\@empty
+            \mhgraphics[width=\slidewidth,#1]{#2}
+          \else
+            \mhgraphics[width=\slidewidth,#1,mhrepos=\Gin@mhrepos]{#2}
+          \fi
+          \ifx\Gin@mhrepos\@empty
+            \mhgraphics[#1]{#2}
+          \else
+            \mhgraphics[#1,mhrepos=\Gin@mhrepos]{#2}
+          \fi
+        \fi% Gin@ewidth empty
+      }
+     \end{center}
+    \par\strut\hfill{\footnotesize Slide \arabic{slide}}%
+    \bool_if:NF \c_@@_notes_bool { \vfill }
+  }
+} % ifmks@sty@frameimages
+%    \end{macrocode}
+% \end{macro}
+% 
+% \subsection{Colors and Highlighting}\label{sec:impl:highlighting}
+%
+% We first specify sans serif fonts as the default. 
+%
+%    \begin{macrocode}
+\sffamily
+%    \end{macrocode}
+%
+% Now, we set up an infrastructure for highlighting phrases in slides. Note that we use
+% content-oriented macros for highlighting rather than directly using color markup. 
+% The first thing to to is to adapt the green so that it is dark enough for most beamers
+%    \begin{macrocode}
+\AddToHook{begindocument}{
+  \definecolor{green}{rgb}{0,.5,0}
+  \definecolor{purple}{cmyk}{.3,1,0,.17}
+}
+%    \end{macrocode}
+%
+% We customize the |\defemph|, |\symrefemph|, |\compemph|, and |\titleemph| macros with
+% colors. Furthermore we customize the |\__omtextlec| macro for the appearance of line end
+% comments in |\lec|.
+%
+%    \begin{macrocode}
+% \def\STpresent#1{\textcolor{blue}{#1}}
+\def\defemph#1{{\textcolor{magenta}{#1}}}
+\def\symrefemph#1{{\textcolor{cyan}{#1}}}
+\def\compemph#1{{\textcolor{blue}{#1}}}
+\def\titleemph#1{{\textcolor{blue}{#1}}}
+\def\__omtext_lec#1{(\textcolor{green}{#1})}
+%    \end{macrocode}
+%
+% I like to use the dangerous bend symbol for warnings, so we provide it here.
+% \begin{macro}{\textwarning}
+%   as the macro can be used quite often we put it into a box register, so that it is only
+%   loaded once. 
+%    \begin{macrocode}
+\pgfdeclareimage[width=.8em]{miko@small@dbend}{dangerous-bend}
+\def\smalltextwarning{
+  \pgfuseimage{miko@small@dbend}
+  \xspace
+}
+\pgfdeclareimage[width=1.2em]{miko@dbend}{dangerous-bend}
+\newrobustcmd\textwarning{
+  \raisebox{-.05cm}{\pgfuseimage{miko@dbend}}
+  \xspace
+}
+\pgfdeclareimage[width=2.5em]{miko@big@dbend}{dangerous-bend}
+\newrobustcmd\bigtextwarning{
+  \raisebox{-.05cm}{\pgfuseimage{miko@big@dbend}}
+  \xspace
+}
+%    \end{macrocode}
+% \end{macro}
+% 
+%    \begin{macrocode}
+\newrobustcmd\putgraphicsat[3]{
+  \begin{picture}(0,0)\put(#1){\includegraphics[#2]{#3}}\end{picture}
+}
+\newrobustcmd\putat[2]{
+  \begin{picture}(0,0)\put(#1){#2}\end{picture}
+}
+%    \end{macrocode}
+%
+% \subsection{Sectioning}
+%
+% If the |sectocframes| option is set, then we make section frames. We first define
+% counters for |part| and |chapter|, which |beamer.cls| does not have and we make the
+% |section| counter which it does dependent on |chapter|. 
+%    \begin{macrocode}
+\bool_if:NT \c_@@_sectocframes_bool {
+  \str_if_eq:VnTF \@@topsect{part}{
+    \newcounter{chapter}\counterwithin*{section}{chapter}
+  }{
+    \str_if_eq:VnT\@@topsect{chapter}{
+      \newcounter{chapter}\counterwithin*{section}{chapter}
+    }
+  }
+}
+%    \end{macrocode}
+%
+% We set the \DescribeMacro{\section@level}|\section@level| counter that governs
+% sectioning according to the class options. We also introduce the sectioning counters
+% accordingly. 
+%
+% \begin{macro}{\section@level}
+%    \begin{macrocode}
+\def\part@prefix{}
+\@ifpackageloaded{document-structure}{}{
+  \str_case:VnF \@@topsect {
+    {part}{
+      \int_set:Nn \l_document_structure_section_level_int {0}
+      \def\thesection{\arabic{chapter}.\arabic{section}}
+      \def\part@prefix{\arabic{chapter}.}
+    }
+    {chapter}{
+      \int_set:Nn \l_document_structure_section_level_int {1}
+      \def\thesection{\arabic{chapter}.\arabic{section}}
+      \def\part@prefix{\arabic{chapter}.}
+    }
+  }{
+    \int_set:Nn \l_document_structure_section_level_int {2}
+    \def\part@prefix{}
+  }
+}
+
+\bool_if:NF \c_@@_notes_bool { % only in slides
+%    \end{macrocode}
+% \end{macro}
+%
+% The new counters are used in the |omgroup| environment that choses the {\LaTeX}
+% sectioning macros according to |\section@level|. 
+% 
+% \begin{environment}{sfragment}
+%    \begin{macrocode}
+  \renewenvironment{sfragment}[2][]{
+    \__document_structure_omgroup_args:n { #1 }
+    \int_incr:N \l_document_structure_section_level_int
+    \bool_if:NT \c_@@_sectocframes_bool {
+      \stepcounter{slide}
+      \begin{frame}[noframenumbering]
+      \vfill\Large\centering
+      \red{
+        \ifcase\l_document_structure_section_level_int\or
+          \stepcounter{part}
+          \def\@@label{\omdoc@part@kw~\Roman{part}}
+          \def\currentsectionlevel{\omdoc@part@kw}
+        \or
+          \stepcounter{chapter}
+          \def\@@label{\omdoc@chapter@kw~\arabic{chapter}}
+          \def\currentsectionlevel{\omdoc@chapter@kw}
+        \or
+          \stepcounter{section}
+          \def\@@label{\part@prefix\arabic{section}}
+          \def\currentsectionlevel{\omdoc@section@kw}
+        \or
+          \stepcounter{subsection}
+          \def\@@label{\part@prefix\arabic{section}.\arabic{subsection}}
+          \def\currentsectionlevel{\omdoc@subsection@kw}
+        \or
+          \stepcounter{subsubsection}
+          \def\@@label{\part@prefix\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}
+          \def\currentsectionlevel{\omdoc@subsubsection@kw}
+        \or
+          \stepcounter{paragraph}
+          \def\@@label{\part@prefix\arabic{section}.\arabic{subsection}.\arabic{subsubsection}.\arabic{paragraph}}
+          \def\currentsectionlevel{\omdoc@paragraph@kw}
+        \else
+          \def\@@label{}
+          \def\currentsectionlevel{\omdoc@paragraph@kw}
+        \fi% end ifcase
+        \@@label%\sref@label@id\@@label
+        \quad #2%
+      }%
+      \vfill%
+      \end{frame}%
+    }
+    \str_if_empty:NF \l__document_structure_omgroup_id_str {
+      \stex_ref_new_doc_target:n\l__document_structure_omgroup_id_str
+    }
+  }{}
+}
+%    \end{macrocode}
+% \end{environment}
+%
+% We set up a |beamer| template for theorems like ams style, but without a block
+% environment.  
+%    \begin{macrocode}
+\def\inserttheorembodyfont{\normalfont}
+%\bool_if:NF \c_@@_notes_bool {
+%  \defbeamertemplate{theorem begin}{miko}
+%  {\inserttheoremheadfont\inserttheoremname\inserttheoremnumber
+%    \ifx\inserttheoremaddition\@empty\else\ (\inserttheoremaddition)\fi%
+%    \inserttheorempunctuation\inserttheorembodyfont\xspace}
+%  \defbeamertemplate{theorem end}{miko}{}
+%    \end{macrocode}
+% and we set it as the default one. 
+%    \begin{macrocode}
+%  \setbeamertemplate{theorems}[miko]
+%    \end{macrocode}
+% The following fixes an error I do not understand, this has something to do with
+% beamer compatibility, which has similar definitions but only up to 1. 
+%    \begin{macrocode}
+%  \expandafter\def\csname Parent2\endcsname{}
+%}
+
+\AddToHook{begindocument}{ % this does not work for some reasone
+  \setbeamertemplate{theorems}[ams style]
+}
+\bool_if:NT \c_@@_notes_bool {
+  \renewenvironment{columns}[1][]{%
+    \par\noindent%
+    \begin{minipage}%
+    \slidewidth\centering\leavevmode%
+  }{%
+    \end{minipage}\par\noindent%
+  }%
+  \newsavebox\columnbox%
+  \renewenvironment<>{column}[2][]{%
+    \begin{lrbox}{\columnbox}\begin{minipage}{#2}%
+  }{%
+    \end{minipage}\end{lrbox}\usebox\columnbox%
+  }%
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\bool_if:NTF \c_@@_noproblems_bool {
+  \newenvironment{problems}{}{}
+}{
+  \excludecomment{problems}
+}
+%    \end{macrocode}
+%
+% \subsection{Excursions}\label{sec:impl:excursions}
+%
+% \begin{macro}{\excursion}
+%  The excursion macros are very simple, we define a new internal macro |\excursionref| and
+%  use it in |\excursion|, which is just an |\inputref| that checks if the new macro is
+%  defined before formatting the file in the argument. 
+%    \begin{macrocode}
+\gdef\printexcursions{}
+\newcommand\excursionref[2]{% label, text
+  \bool_if:NT \c_@@_notes_bool {
+    \begin{sparagraph}[title=Excursion]
+      #2 \sref[fallback=the appendix]{#1}.
+    \end{sparagraph}
+  }
+}
+\newcommand\activate@excursion[2][]{
+  \gappto\printexcursions{\inputref[#1]{#2}}
+}
+\newcommand\excursion[4][]{% repos, label, path, text
+  \bool_if:NT \c_@@_notes_bool {
+    \activate@excursion[#1]{#3}\excursionref{#2}{#4}
+  }
+}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\excursiongroup}
+%    \begin{macrocode}
+\keys_define:nn{notesslides / excursiongroup }{
+  id        .str_set_x:N  = \l_@@_excursion_id_str,
+  intro     .tl_set:N     = \l_@@_excursion_intro_tl,
+  mhrepos   .str_set_x:N  = \l_@@_excursion_mhrepos_str
+}
+\cs_new_protected:Nn \_@@_excursion_args:n {
+  \tl_clear:N \l_@@_excursion_intro_tl
+  \str_clear:N \l_@@_excursion_id_str
+  \str_clear:N \l_@@_excursion_mhrepos_str
+  \keys_set:nn {notesslides / excursiongroup }{ #1 }
+}
+\newcommand\excursiongroup[1][]{
+  \_@@_excursion_args:n{ #1 }
+  \ifdefempty\printexcursions{}% only if there are excursions
+  {\begin{note}
+    \begin{sfragment}[#1]{Excursions}%
+      \ifdefempty\l_@@_excursion_intro_tl{}{
+        \inputref[\l_@@_excursion_mhrepos_str]{
+          \l_@@_excursion_intro_tl
+        }
+      }
+      \printexcursions%
+    \end{sfragment}
+  \end{note}}
+}
+\ifcsname beameritemnestingprefix\endcsname\else\def\beameritemnestingprefix{}\fi
+%</package>
+%    \end{macrocode}
+% \end{macro}
+%
+% \end{implementation}
+\endinput
+% \endinput
+% Local Variables:
+% mode: doctex
+% TeX-master: t
+% End:
+
+%  LocalWords:  bibfolder jobname.dtx omdoc.dtx mytwocolumns beamer.cls sectocframes rhd
+%  LocalWords:  frameimage twintoo atwin atwintoo scsys scshape ttfamily cnxlatex xspace
+%  LocalWords:  mathml omdoc beamerclass:on Kohlhase:smomdl noproblems frameimages exfig
+%  LocalWords:  frameimages fiboxed fiboxed topsect topsect Tantau:ugbc ifnotes ifnotes
+%  LocalWords:  noframenumbering allowframebreaks newpage inputref inputref inputref sref
+%  LocalWords:  setsource setsource setlicensing setlicensing CarRah:tpp99 mhframeimage
+%  LocalWords:  mhframeimage printexcursions excursionref excursionref excursiongroup
+%  LocalWords:  excursiongroup sec:impl nontheorem mks@cls,prefix mks@cls mks@sty,prefix
+%  LocalWords:  mks@sty 10pt,notheorems,xcolor dvipsnames,svgnames Hfootnote mdframed
+%  LocalWords:  beamerarticle noxcolor,noamsthm metakeys addmetakey usetheme beamertheme
+%  LocalWords:  bookmarks,bookmarksopen,bookmarksnumbered,breaklinks,hidelinks sproof
+%  LocalWords:  beamernotestheme slideframewidth allowdisplaybreaks framenumber sproof
+%  LocalWords:  miko@slidelabel inputref@preskip smallskip ninputref slidelogoheight
+%  LocalWords:  copyrightnotice cclogo cc_somerights ifcchref cchreffalse cchreftrue
+%  LocalWords:  Gin@ewidth mh@currentrepos mhrepos if@iswindows defemph notemph STpresent
+%  LocalWords:  smalltextwarning miko@dbend bigtextwarning counterwithin ifsectocframes
+%  LocalWords:  subsubsection mparagraph csname stex_ref_new_doc_target:n columnbox
+%  LocalWords:  inserttheorembodyfont defbeamertemplate inserttheoremheadfont mhexcursion
+%  LocalWords:  inserttheoremname inserttheoremnumber inserttheoremaddition srefaddidkey
+%  LocalWords:  inserttheoremaddition inserttheorempunctuation setbeamertemplate
+%  LocalWords:  mhexcursiongroup
-- 
cgit v1.2.3

