diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/stex/extensions/notesslides.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/stex/extensions/notesslides.dtx | 379 |
1 files changed, 101 insertions, 278 deletions
diff --git a/Master/texmf-dist/source/latex/stex/extensions/notesslides.dtx b/Master/texmf-dist/source/latex/stex/extensions/notesslides.dtx index d99109ee228..ff06827660f 100644 --- a/Master/texmf-dist/source/latex/stex/extensions/notesslides.dtx +++ b/Master/texmf-dist/source/latex/stex/extensions/notesslides.dtx @@ -11,7 +11,7 @@ % \iffalse % %<*driver> -\providecommand\bibfolder{../../lib/bib} +\def\bibfolder#1{../../lib/bib/#1} \input{../../doc/stex-docheader} \begin{document} @@ -19,7 +19,6 @@ \end{document} %</driver> % \fi -% ^^A\changes{v0.1}{2005/12/06}{Initial Version} % % \GetFileInfo{notesslides.cls} % \MakeShortVerb{\|} @@ -59,227 +58,8 @@ % \fi % % \begin{documentation}\label{pkg:notesslides:doc} +% \changes{3.1.0}{2022/02/28}{Added \detokenize{\libusetheme}} % -% 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} @@ -296,39 +76,52 @@ % \begin{macrocode} %<*cls> %<@@=notesslides> -\ProvidesExplClass{notesslides}{2022/02/26}{3.0.1}{notesslides Class} +\ProvidesExplClass{notesslides}{2022/05/24}{3.1.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} - } - }, + class .str_set_x:N = \c_@@_class_str, notes .bool_set:N = \c_@@_notes_bool , slides .code:n = { \bool_set_false:N \c_@@_notes_bool }, + docopt .str_set_x:N = \c_@@_docopt_str, unknown .code:n = { - \PassOptionsToClass{\CurrentOption}{document-structure} + \PassOptionsToPackage{\CurrentOption}{document-structure} \PassOptionsToClass{\CurrentOption}{beamer} \PassOptionsToPackage{\CurrentOption}{notesslides} + \PassOptionsToPackage{\CurrentOption}{stex} } } \ProcessKeysOptions{ notesslides / cls } + +\str_if_empty:NF \c_@@_class_str { + \PassOptionsToPackage{class=\c_@@_class_str}{document-structure} +} + +\exp_args:No \str_if_eq:nnT\c_@@_class_str{book}{ + \PassOptionsToPackage{defaulttopsect=part}{notesslides} +} +\exp_args:No \str_if_eq:nnT\c_@@_class_str{report}{ + \PassOptionsToPackage{defaulttopsect=part}{notesslides} +} + +\RequirePackage{stex} +\stex_html_backend:T { + \bool_set_true:N\c_@@_notes_bool +} + \bool_if:NTF \c_@@_notes_bool { \PassOptionsToPackage{notes=true}{notesslides} + \message{notesslides.cls:~Formatting~course~materials~in~notes~mode} }{ \PassOptionsToPackage{notes=false}{notesslides} + \message{notesslides.cls:~Formatting~course~materials~in~slides~mode} } %</cls> % \end{macrocode} % now we do the same for the |notesslides| package. % \begin{macrocode} %<*package> -\ProvidesExplPackage{notesslides}{2022/02/26}{3.0.1}{notesslides Package} +\ProvidesExplPackage{notesslides}{2022/05/24}{3.1.0}{notesslides Package} \RequirePackage{l3keys2e} \keys_define:nn{notesslides / pkg}{ @@ -346,6 +139,12 @@ } } \ProcessKeysOptions{ notesslides / pkg } + +\RequirePackage{stex} +\stex_html_backend:T { + \bool_set_true:N\c_@@_notes_bool +} + \newif\ifnotes \bool_if:NTF \c_@@_notes_bool { \notestrue @@ -362,6 +161,7 @@ }{ \str_set_eq:NN \@@topsect \c_@@_topsect_str } +\PassOptionsToPackage{topsect=\@@topsect}{document-structure} %</package> % \end{macrocode} % @@ -370,15 +170,19 @@ % \begin{macrocode} %<*cls> \bool_if:NTF \c_@@_notes_bool { - \LoadClass{document-structure} + \str_if_empty:NT \c_@@_class_str { + \str_set:Nn \c_@@_class_str {article} + } + \exp_after:wN\LoadClass\exp_after:wN[\c_@@_docopt_str] + {\c_@@_class_str} }{ \LoadClass[10pt,notheorems,xcolor={dvipsnames,svgnames}]{beamer} \newcounter{Item} \newcounter{paragraph} \newcounter{subparagraph} \newcounter{Hfootnote} - \RequirePackage{document-structure} } +\RequirePackage{document-structure} % \end{macrocode} % now it only remains to load the |notesslides| package that does all the rest. % \begin{macrocode} @@ -425,6 +229,16 @@ \bool_if:NT \c_@@_notes_bool { \renewcommand\usetheme[2][]{\usepackage[#1]{beamernotestheme#2}} } + + +\NewDocumentCommand \libusetheme {O{} m} { + \bool_if:NTF \c_@@_notes_bool { + \libusepackage[#1]{beamernotestheme#2} + }{ + \libusepackage[#1]{beamertheme#2} + } +} + % \end{macrocode} % We define the sizes of slides in the notes. Somehow, we cannot get by with the same % here. @@ -488,6 +302,7 @@ t .code:n = { \_@@_do_yes_param:Nn \l_@@_frame_t_bool { #1 } }, + unknown .code:n = {} } \cs_new_protected:Nn \_@@_frame_args:n { \str_clear:N \l_@@_frame_label_str @@ -517,7 +332,7 @@ \def\itemize@outer{outer} \def\itemize@inner{inner} \renewcommand\newpage{\addtocounter{framenumber}{1}} - \newcommand\metakeys@show@keys[2]{\marginnote{{\scriptsize ##2}}} + %\newcommand\metakeys@show@keys[2]{\marginnote{{\scriptsize ##2}}} \renewenvironment{itemize}{ \ifx\itemize@level\itemize@outer \def\itemize@label{$\rhd$} @@ -538,9 +353,16 @@ % \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 + \stex_html_backend:TF { + \begin{stex_annotate_env}{frame}{}\vbox\bgroup + \mdf@patchamsthm + }{ + \begin{mdframed}[linewidth=\slideframewidth,skipabove=1ex,skipbelow=1ex,userdefinedwidth=\slidewidth,align=center]\sf + } }{ - \medskip\miko@slidelabel\end{mdframed} + \stex_html_backend:TF { + \miko@slidelabel\egroup\end{stex_annotate_env} + }{\medskip\miko@slidelabel\end{mdframed}} } % \end{macrocode} % \end{environment} @@ -548,7 +370,10 @@ % 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} + \renewcommand{\frametitle}[1]{ + \stex_document_title:n { #1 } + {\Large\bf\sf\color{blue}{#1}}\medskip + } } % \end{macrocode} % \end{macro} @@ -652,15 +477,31 @@ % \begin{macrocode} \newlength{\slidelogoheight} +\RequirePackage{graphicx} + +\define@key{Gin}{mhrepos}{\def\Gin@mhrepos{#1}} +\providecommand\mhgraphics[2][]{ + \def\Gin@mhrepos{}\setkeys{Gin}{#1} + \includegraphics[#1]{\mhpath\Gin@mhrepos{#2}} +} + + + \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}} + \setlength{\slidelogoheight}{.25cm} +} +\ifcsname slidelogo\endcsname\else + \newsavebox{\slidelogo} + \sbox{\slidelogo}{\sTeX} +\fi +\newrobustcmd{\setslidelogo}[2][]{ + \tl_if_empty:nTF{#1}{ + \sbox{\slidelogo}{\includegraphics[height=\slidelogoheight]{#2}} + }{ + \sbox{\slidelogo}{\mhgraphics[height=\slidelogoheight,mhrepos=#1]{#2}} + } } % \end{macrocode} % \end{macro} @@ -845,12 +686,14 @@ % 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}{ +\stex_html_backend:F { + \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} + } } } } @@ -885,13 +728,13 @@ % \end{macrocode} % \end{macro} % -% The new counters are used in the |omgroup| environment that choses the {\LaTeX} +% The new counters are used in the |sfragment| 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 } + \__document_structure_sfragment_args:n { #1 } \int_incr:N \l_document_structure_section_level_int \bool_if:NT \c_@@_sectocframes_bool { \stepcounter{slide} @@ -900,11 +743,11 @@ \red{ \ifcase\l_document_structure_section_level_int\or \stepcounter{part} - \def\@@label{\omdoc@part@kw~\Roman{part}} + \def\@@label{{\omdoc@part@kw}~\Roman{part}} \def\currentsectionlevel{\omdoc@part@kw} \or \stepcounter{chapter} - \def\@@label{\omdoc@chapter@kw~\arabic{chapter}} + \def\@@label{{\omdoc@chapter@kw}~\arabic{chapter}} \def\currentsectionlevel{\omdoc@chapter@kw} \or \stepcounter{section} @@ -932,8 +775,8 @@ \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 + \str_if_empty:NF \l__document_structure_sfragment_id_str { + \stex_ref_new_doc_target:n\l__document_structure_sfragment_id_str } }{} } @@ -1048,6 +891,7 @@ % \end{macro} % % \end{implementation} +% \ifinfulldoc\else\printbibliography\fi \endinput % \endinput % Local Variables: @@ -1055,24 +899,3 @@ % 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 |