summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/didactic/LICENSE416
-rw-r--r--Master/texmf-dist/doc/latex/didactic/ProvideSemanticEnv.tex7
-rw-r--r--Master/texmf-dist/doc/latex/didactic/README.md44
-rw-r--r--Master/texmf-dist/doc/latex/didactic/didactic.pdfbin0 -> 264041 bytes
-rw-r--r--Master/texmf-dist/doc/latex/didactic/hello.py7
-rw-r--r--Master/texmf-dist/doc/latex/didactic/idea.tex4
-rw-r--r--Master/texmf-dist/doc/latex/didactic/lightblock.tex3
-rw-r--r--Master/texmf-dist/source/latex/didactic/Makefile34
-rw-r--r--Master/texmf-dist/source/latex/didactic/didactic.dtx1156
-rw-r--r--Master/texmf-dist/source/latex/didactic/didactic.ins58
-rw-r--r--Master/texmf-dist/tex/latex/didactic/didactic.sty468
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds3
-rw-r--r--Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/didactic.tlpsrc0
15 files changed, 2201 insertions, 2 deletions
diff --git a/Master/texmf-dist/doc/latex/didactic/LICENSE b/Master/texmf-dist/doc/latex/didactic/LICENSE
new file mode 100644
index 00000000000..1b57559a832
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/didactic/LICENSE
@@ -0,0 +1,416 @@
+The LaTeX Project Public License
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+LPPL Version 1.3c 2008-05-04
+
+Copyright 1999 2002-2008 LaTeX3 Project
+ Everyone is allowed to distribute verbatim copies of this
+ license document, but modification of it is not allowed.
+
+
+PREAMBLE
+========
+
+The LaTeX Project Public License (LPPL) is the primary license under
+which the LaTeX kernel and the base LaTeX packages are distributed.
+
+You may use this license for any work of which you hold the copyright
+and which you wish to distribute. This license may be particularly
+suitable if your work is TeX-related (such as a LaTeX package), but
+it is written in such a way that you can use it even if your work is
+unrelated to TeX.
+
+The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE',
+below, gives instructions, examples, and recommendations for authors
+who are considering distributing their works under this license.
+
+This license gives conditions under which a work may be distributed
+and modified, as well as conditions under which modified versions of
+that work may be distributed.
+
+We, the LaTeX3 Project, believe that the conditions below give you
+the freedom to make and distribute modified versions of your work
+that conform with whatever technical specifications you wish while
+maintaining the availability, integrity, and reliability of
+that work. If you do not see how to achieve your goal while
+meeting these conditions, then read the document `cfgguide.tex'
+and `modguide.tex' in the base LaTeX distribution for suggestions.
+
+
+DEFINITIONS
+===========
+
+In this license document the following terms are used:
+
+ `Work'
+ Any work being distributed under this License.
+
+ `Derived Work'
+ Any work that under any applicable law is derived from the Work.
+
+ `Modification'
+ Any procedure that produces a Derived Work under any applicable
+ law -- for example, the production of a file containing an
+ original file associated with the Work or a significant portion of
+ such a file, either verbatim or with modifications and/or
+ translated into another language.
+
+ `Modify'
+ To apply any procedure that produces a Derived Work under any
+ applicable law.
+
+ `Distribution'
+ Making copies of the Work available from one person to another, in
+ whole or in part. Distribution includes (but is not limited to)
+ making any electronic components of the Work accessible by
+ file transfer protocols such as FTP or HTTP or by shared file
+ systems such as Sun's Network File System (NFS).
+
+ `Compiled Work'
+ A version of the Work that has been processed into a form where it
+ is directly usable on a computer system. This processing may
+ include using installation facilities provided by the Work,
+ transformations of the Work, copying of components of the Work, or
+ other activities. Note that modification of any installation
+ facilities provided by the Work constitutes modification of the Work.
+
+ `Current Maintainer'
+ A person or persons nominated as such within the Work. If there is
+ no such explicit nomination then it is the `Copyright Holder' under
+ any applicable law.
+
+ `Base Interpreter'
+ A program or process that is normally needed for running or
+ interpreting a part or the whole of the Work.
+
+ A Base Interpreter may depend on external components but these
+ are not considered part of the Base Interpreter provided that each
+ external component clearly identifies itself whenever it is used
+ interactively. Unless explicitly specified when applying the
+ license to the Work, the only applicable Base Interpreter is a
+ `LaTeX-Format' or in the case of files belonging to the
+ `LaTeX-format' a program implementing the `TeX language'.
+
+
+
+CONDITIONS ON DISTRIBUTION AND MODIFICATION
+===========================================
+
+1. Activities other than distribution and/or modification of the Work
+are not covered by this license; they are outside its scope. In
+particular, the act of running the Work is not restricted and no
+requirements are made concerning any offers of support for the Work.
+
+2. You may distribute a complete, unmodified copy of the Work as you
+received it. Distribution of only part of the Work is considered
+modification of the Work, and no right to distribute such a Derived
+Work may be assumed under the terms of this clause.
+
+3. You may distribute a Compiled Work that has been generated from a
+complete, unmodified copy of the Work as distributed under Clause 2
+above, as long as that Compiled Work is distributed in such a way that
+the recipients may install the Compiled Work on their system exactly
+as it would have been installed if they generated a Compiled Work
+directly from the Work.
+
+4. If you are the Current Maintainer of the Work, you may, without
+restriction, modify the Work, thus creating a Derived Work. You may
+also distribute the Derived Work without restriction, including
+Compiled Works generated from the Derived Work. Derived Works
+distributed in this manner by the Current Maintainer are considered to
+be updated versions of the Work.
+
+5. If you are not the Current Maintainer of the Work, you may modify
+your copy of the Work, thus creating a Derived Work based on the Work,
+and compile this Derived Work, thus creating a Compiled Work based on
+the Derived Work.
+
+6. If you are not the Current Maintainer of the Work, you may
+distribute a Derived Work provided the following conditions are met
+for every component of the Work unless that component clearly states
+in the copyright notice that it is exempt from that condition. Only
+the Current Maintainer is allowed to add such statements of exemption
+to a component of the Work.
+
+ a. If a component of this Derived Work can be a direct replacement
+ for a component of the Work when that component is used with the
+ Base Interpreter, then, wherever this component of the Work
+ identifies itself to the user when used interactively with that
+ Base Interpreter, the replacement component of this Derived Work
+ clearly and unambiguously identifies itself as a modified version
+ of this component to the user when used interactively with that
+ Base Interpreter.
+
+ b. Every component of the Derived Work contains prominent notices
+ detailing the nature of the changes to that component, or a
+ prominent reference to another file that is distributed as part
+ of the Derived Work and that contains a complete and accurate log
+ of the changes.
+
+ c. No information in the Derived Work implies that any persons,
+ including (but not limited to) the authors of the original version
+ of the Work, provide any support, including (but not limited to)
+ the reporting and handling of errors, to recipients of the
+ Derived Work unless those persons have stated explicitly that
+ they do provide such support for the Derived Work.
+
+ d. You distribute at least one of the following with the Derived Work:
+
+ 1. A complete, unmodified copy of the Work;
+ if your distribution of a modified component is made by
+ offering access to copy the modified component from a
+ designated place, then offering equivalent access to copy
+ the Work from the same or some similar place meets this
+ condition, even though third parties are not compelled to
+ copy the Work along with the modified component;
+
+ 2. Information that is sufficient to obtain a complete,
+ unmodified copy of the Work.
+
+7. If you are not the Current Maintainer of the Work, you may
+distribute a Compiled Work generated from a Derived Work, as long as
+the Derived Work is distributed to all recipients of the Compiled
+Work, and as long as the conditions of Clause 6, above, are met with
+regard to the Derived Work.
+
+8. The conditions above are not intended to prohibit, and hence do not
+apply to, the modification, by any method, of any component so that it
+becomes identical to an updated version of that component of the Work as
+it is distributed by the Current Maintainer under Clause 4, above.
+
+9. Distribution of the Work or any Derived Work in an alternative
+format, where the Work or that Derived Work (in whole or in part) is
+then produced by applying some process to that format, does not relax or
+nullify any sections of this license as they pertain to the results of
+applying that process.
+
+10. a. A Derived Work may be distributed under a different license
+ provided that license itself honors the conditions listed in
+ Clause 6 above, in regard to the Work, though it does not have
+ to honor the rest of the conditions in this license.
+
+ b. If a Derived Work is distributed under a different license, that
+ Derived Work must provide sufficient documentation as part of
+ itself to allow each recipient of that Derived Work to honor the
+ restrictions in Clause 6 above, concerning changes from the Work.
+
+11. This license places no restrictions on works that are unrelated to
+the Work, nor does this license place any restrictions on aggregating
+such works with the Work by any means.
+
+12. Nothing in this license is intended to, or may be used to, prevent
+complete compliance by all parties with all applicable laws.
+
+
+NO WARRANTY
+===========
+
+There is no warranty for the Work. Except when otherwise stated in
+writing, the Copyright Holder provides the Work `as is', without
+warranty of any kind, either expressed or implied, including, but not
+limited to, the implied warranties of merchantability and fitness for a
+particular purpose. The entire risk as to the quality and performance
+of the Work is with you. Should the Work prove defective, you assume
+the cost of all necessary servicing, repair, or correction.
+
+In no event unless required by applicable law or agreed to in writing
+will The Copyright Holder, or any author named in the components of the
+Work, or any other party who may distribute and/or modify the Work as
+permitted above, be liable to you for damages, including any general,
+special, incidental or consequential damages arising out of any use of
+the Work or out of inability to use the Work (including, but not limited
+to, loss of data, data being rendered inaccurate, or losses sustained by
+anyone as a result of any failure of the Work to operate with any other
+programs), even if the Copyright Holder or said author or said other
+party has been advised of the possibility of such damages.
+
+
+MAINTENANCE OF THE WORK
+=======================
+
+The Work has the status `author-maintained' if the Copyright Holder
+explicitly and prominently states near the primary copyright notice in
+the Work that the Work can only be maintained by the Copyright Holder
+or simply that it is `author-maintained'.
+
+The Work has the status `maintained' if there is a Current Maintainer
+who has indicated in the Work that they are willing to receive error
+reports for the Work (for example, by supplying a valid e-mail
+address). It is not required for the Current Maintainer to acknowledge
+or act upon these error reports.
+
+The Work changes from status `maintained' to `unmaintained' if there
+is no Current Maintainer, or the person stated to be Current
+Maintainer of the work cannot be reached through the indicated means
+of communication for a period of six months, and there are no other
+significant signs of active maintenance.
+
+You can become the Current Maintainer of the Work by agreement with
+any existing Current Maintainer to take over this role.
+
+If the Work is unmaintained, you can become the Current Maintainer of
+the Work through the following steps:
+
+ 1. Make a reasonable attempt to trace the Current Maintainer (and
+ the Copyright Holder, if the two differ) through the means of
+ an Internet or similar search.
+
+ 2. If this search is successful, then enquire whether the Work
+ is still maintained.
+
+ a. If it is being maintained, then ask the Current Maintainer
+ to update their communication data within one month.
+
+ b. If the search is unsuccessful or no action to resume active
+ maintenance is taken by the Current Maintainer, then announce
+ within the pertinent community your intention to take over
+ maintenance. (If the Work is a LaTeX work, this could be
+ done, for example, by posting to comp.text.tex.)
+
+ 3a. If the Current Maintainer is reachable and agrees to pass
+ maintenance of the Work to you, then this takes effect
+ immediately upon announcement.
+
+ b. If the Current Maintainer is not reachable and the Copyright
+ Holder agrees that maintenance of the Work be passed to you,
+ then this takes effect immediately upon announcement.
+
+ 4. If you make an `intention announcement' as described in 2b. above
+ and after three months your intention is challenged neither by
+ the Current Maintainer nor by the Copyright Holder nor by other
+ people, then you may arrange for the Work to be changed so as
+ to name you as the (new) Current Maintainer.
+
+ 5. If the previously unreachable Current Maintainer becomes
+ reachable once more within three months of a change completed
+ under the terms of 3b) or 4), then that Current Maintainer must
+ become or remain the Current Maintainer upon request provided
+ they then update their communication data within one month.
+
+A change in the Current Maintainer does not, of itself, alter the fact
+that the Work is distributed under the LPPL license.
+
+If you become the Current Maintainer of the Work, you should
+immediately provide, within the Work, a prominent and unambiguous
+statement of your status as Current Maintainer. You should also
+announce your new status to the same pertinent community as
+in 2b) above.
+
+
+WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE
+======================================================
+
+This section contains important instructions, examples, and
+recommendations for authors who are considering distributing their
+works under this license. These authors are addressed as `you' in
+this section.
+
+Choosing This License or Another License
+----------------------------------------
+
+If for any part of your work you want or need to use *distribution*
+conditions that differ significantly from those in this license, then
+do not refer to this license anywhere in your work but, instead,
+distribute your work under a different license. You may use the text
+of this license as a model for your own license, but your license
+should not refer to the LPPL or otherwise give the impression that
+your work is distributed under the LPPL.
+
+The document `modguide.tex' in the base LaTeX distribution explains
+the motivation behind the conditions of this license. It explains,
+for example, why distributing LaTeX under the GNU General Public
+License (GPL) was considered inappropriate. Even if your work is
+unrelated to LaTeX, the discussion in `modguide.tex' may still be
+relevant, and authors intending to distribute their works under any
+license are encouraged to read it.
+
+A Recommendation on Modification Without Distribution
+-----------------------------------------------------
+
+It is wise never to modify a component of the Work, even for your own
+personal use, without also meeting the above conditions for
+distributing the modified component. While you might intend that such
+modifications will never be distributed, often this will happen by
+accident -- you may forget that you have modified that component; or
+it may not occur to you when allowing others to access the modified
+version that you are thus distributing it and violating the conditions
+of this license in ways that could have legal implications and, worse,
+cause problems for the community. It is therefore usually in your
+best interest to keep your copy of the Work identical with the public
+one. Many works provide ways to control the behavior of that work
+without altering any of its licensed components.
+
+How to Use This License
+-----------------------
+
+To use this license, place in each of the components of your work both
+an explicit copyright notice including your name and the year the work
+was authored and/or last substantially modified. Include also a
+statement that the distribution and/or modification of that
+component is constrained by the conditions in this license.
+
+Here is an example of such a notice and statement:
+
+ %% pig.dtx
+ %% Copyright 2008 M. Y. Name
+ %
+ % 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
+ % https://www.latex-project.org/lppl.txt
+ % and version 1.3c or later is part of all distributions of LaTeX
+ % version 2008 or later.
+ %
+ % This work has the LPPL maintenance status `maintained'.
+ %
+ % The Current Maintainer of this work is M. Y. Name.
+ %
+ % This work consists of the files pig.dtx and pig.ins
+ % and the derived file pig.sty.
+
+Given such a notice and statement in a file, the conditions
+given in this license document would apply, with the `Work' referring
+to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being
+generated from `pig.dtx' using `pig.ins'), the `Base Interpreter'
+referring to any `LaTeX-Format', and both `Copyright Holder' and
+`Current Maintainer' referring to the person `M. Y. Name'.
+
+If you do not want the Maintenance section of LPPL to apply to your
+Work, change `maintained' above into `author-maintained'.
+However, we recommend that you use `maintained', as the Maintenance
+section was added in order to ensure that your Work remains useful to
+the community even when you can no longer maintain and support it
+yourself.
+
+Derived Works That Are Not Replacements
+---------------------------------------
+
+Several clauses of the LPPL specify means to provide reliability and
+stability for the user community. They therefore concern themselves
+with the case that a Derived Work is intended to be used as a
+(compatible or incompatible) replacement of the original Work. If
+this is not the case (e.g., if a few lines of code are reused for a
+completely different task), then clauses 6b and 6d shall not apply.
+
+
+Important Recommendations
+-------------------------
+
+ Defining What Constitutes the Work
+
+ The LPPL requires that distributions of the Work contain all the
+ files of the Work. It is therefore important that you provide a
+ way for the licensee to determine which files constitute the Work.
+ This could, for example, be achieved by explicitly listing all the
+ files of the Work near the copyright notice of each file or by
+ using a line such as:
+
+ % This work consists of all files listed in manifest.txt.
+
+ in that place. In the absence of an unequivocal list it might be
+ impossible for the licensee to determine what is considered by you
+ to comprise the Work and, in such a case, the licensee would be
+ entitled to make reasonable conjectures as to which files comprise
+ the Work.
+
diff --git a/Master/texmf-dist/doc/latex/didactic/ProvideSemanticEnv.tex b/Master/texmf-dist/doc/latex/didactic/ProvideSemanticEnv.tex
new file mode 100644
index 00000000000..0b436a35083
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/didactic/ProvideSemanticEnv.tex
@@ -0,0 +1,7 @@
+\ProvideSemanticEnv{idea}[purpleblock]{Idea}[%
+ numbered=no,style=definition
+ ]{idea}{ideas}{Idea}{Ideas}
+\ProvideTranslation{swedish}{idea}{idé}
+\ProvideTranslation{swedish}{ideas}{idéerna}
+\ProvideTranslation{swedish}{Idea}{Idé}
+\ProvideTranslation{swedish}{Ideas}{Idéerna}
diff --git a/Master/texmf-dist/doc/latex/didactic/README.md b/Master/texmf-dist/doc/latex/didactic/README.md
new file mode 100644
index 00000000000..f55168d205e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/didactic/README.md
@@ -0,0 +1,44 @@
+# didactic
+
+This package provides macros and environments useful for writing teaching
+material. It provides more semantic environments on top of the standard
+`definition`, `theorem`, and friends: for instance, `exercise`, `activity` and
+`question`. These are suitably colour coded when used with Beamer. They occur
+as "normal" text in handouts produced by `beamerarticle` (same style as
+`definition` usually has).
+
+It also provides macros for typesetting code listings and output side by side.
+
+Finally, it modifies the appearance of `beamer` (Berlin based theme) and
+`memoir` (Tufte style layout), if loaded. It's designed to be used with
+`beamer` to produce slides and `beamerarticle` with `memoir` to produce notes,
+and handouts from the same source.
+
+## Installation
+
+To use the package, you only need to install `didactic.sty` in a place where
+your LaTeX distribution can find it. For a local installation, you can put it
+in the same directory as your document, or in `~/texmf/tex/latex/didactic/`.
+
+Actually, for the latter, you can simply do the following:
+
+```bash
+mkdir -p ~/texmf/tex/latex
+cd ~/texmf/tex/latex
+git clone https://github.com/dbosk/didactic.git
+cd didactic
+make all
+```
+
+That will build both `didactic.sty` and `didactic.pdf`. The documentation is
+located in `didactic.pdf`.
+
+
+## Maintainer
+
+The was authored by Daniel Bosk <daniel+ctan@bosk.se>, who is also the
+maintainer.
+
+## License
+
+This package is licensed under the LPPL 1.3c or later.
diff --git a/Master/texmf-dist/doc/latex/didactic/didactic.pdf b/Master/texmf-dist/doc/latex/didactic/didactic.pdf
new file mode 100644
index 00000000000..3c219334adb
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/didactic/didactic.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/didactic/hello.py b/Master/texmf-dist/doc/latex/didactic/hello.py
new file mode 100644
index 00000000000..4034830401a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/didactic/hello.py
@@ -0,0 +1,7 @@
+"""A Hello World example in Python 3"""
+
+def main():
+ print("Hello, world!")
+
+if __name__ == "__main__":
+ main()
diff --git a/Master/texmf-dist/doc/latex/didactic/idea.tex b/Master/texmf-dist/doc/latex/didactic/idea.tex
new file mode 100644
index 00000000000..e6ea88ae62d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/didactic/idea.tex
@@ -0,0 +1,4 @@
+\begin{idea}[These blocks]\label{theidea}
+ The idea of these blocks is to be able to use them in both slides and text.
+ This way, we can focus on writing just one version of the content.
+\end{idea}
diff --git a/Master/texmf-dist/doc/latex/didactic/lightblock.tex b/Master/texmf-dist/doc/latex/didactic/lightblock.tex
new file mode 100644
index 00000000000..83f4577bf7f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/didactic/lightblock.tex
@@ -0,0 +1,3 @@
+\begin{lightblock}{green}{Title}
+ This is the body.
+\end{lightblock}
diff --git a/Master/texmf-dist/source/latex/didactic/Makefile b/Master/texmf-dist/source/latex/didactic/Makefile
new file mode 100644
index 00000000000..a317f1b7534
--- /dev/null
+++ b/Master/texmf-dist/source/latex/didactic/Makefile
@@ -0,0 +1,34 @@
+LATEX?=latex
+PDFLATEX?=pdflatex
+LATEXFLAGS=-shell-escape
+PYTHONTEX=python3 $(shell which pythontex) --interpreter python:python3
+
+.PHONY: all
+all: didactic.sty didactic.pdf didactic.tar.gz
+
+SRC+= didactic.dtx hello.py idea.tex lightblock.tex ProvideSemanticEnv.tex
+
+didactic.pdf: ${SRC} didactic.sty
+ ${PDFLATEX} ${LATEXFLAGS} $<
+ ${PYTHONTEX} didactic
+ ${PDFLATEX} ${LATEXFLAGS} $<
+ ${PDFLATEX} ${LATEXFLAGS} $<
+
+didactic.sty: didactic.ins
+ ${LATEX} ${LATEXFLAGS} $<
+
+didactic.tar.gz: ${SRC} didactic.ins LICENSE Makefile README.md didactic.pdf
+ tar -czf $@ --transform "s|^|didactic/|" $^
+
+.PHONY: clean
+clean:
+ ${RM} didactic.sty didactic.pdf
+ ${RM} didactic.log
+ ${RM} didactic.aux didactic.glo didactic.idx didactic.log
+ ${RM} didactic.out didactic.pdf
+ ${RM} didactic.pytxcode didactic.pytxmcr didactic.pytxpyg
+ ${RM} didactic.tar.gz didactic.toc didactic.unq
+ ${RM} pythontex_data.pkl
+ ${RM} -R _minted-didactic
+ ${RM} $(wildcard py_default_default_*.stdout)
+ ${RM} -R pythontex-files-didactic
diff --git a/Master/texmf-dist/source/latex/didactic/didactic.dtx b/Master/texmf-dist/source/latex/didactic/didactic.dtx
new file mode 100644
index 00000000000..5429b8bf614
--- /dev/null
+++ b/Master/texmf-dist/source/latex/didactic/didactic.dtx
@@ -0,0 +1,1156 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2019--2020, 2022, 2024 by Daniel Bosk <daniel@bosk.se>
+% -------------------------------------------------------
+%
+% This file may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3c
+% of this license or (at your option) any later version.
+% The latest version of this license is in:
+%
+% http://www.latex-project.org/lppl.txt
+%
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% \fi
+%
+% \iffalse
+%<*driver>
+\ProvidesFile{didactic.dtx}
+%</driver>
+%<package>\NeedsTeXFormat{LaTeX2e}
+%<package>\ProvidesPackage{didactic}
+%<*package>
+ [2024/04/07 v1.6 didactic]
+%</package>
+%<package>\RequirePackage{xparse}
+%<package>\RequirePackage{xkeyval}
+%<package>\RequirePackage{xstring}
+%<package>\RequirePackage{pythontex}
+%<package>\RequirePackage{minted}
+%<package>\RequirePackage{babel}
+%<package>\RequirePackage{translations}
+%<package>\RequirePackage{amsthm}
+%<package>\RequirePackage{thmtools}
+%<package>\PassOptionsToPackage{unq}{unique}
+%<package>\RequirePackage{unique}
+%
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage[utf8]{inputenc}
+\usepackage[swedish,british]{babel}
+\usepackage{pythontex}
+\usepackage[notheorems]{beamerarticle}
+\usepackage[marginparmargin=left]{didactic}
+\usepackage{lipsum}
+\usepackage{hyperref}
+\usepackage{cleveref}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\begin{document}
+ \DocInput{didactic.dtx}
+ \PrintChanges
+ %\PrintIndex
+\end{document}
+%</driver>
+% \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 \~}
+%
+%
+% \changes{v1.0}{2019/01/29}{Initial version}
+% \changes{v1.1}{2019/03/26}{Adds summary environment}
+% \changes{v1.2}{2019/10/26}{Adds lightblock, darkblock and coloured blocks}
+% \changes{v1.3}{2019/01/29}{Renames to didactic; adds tools for code examples}
+% \changes{v1.4}{2023/03/20}{%
+% Adds settings for memoir and beamer, contrasting code examples,
+% translations.
+% }
+% \changes{v1.5}{2023/03/25}{Adds |\ProvideSemanticEnv|}
+% \changes{v1.6}{2024/04/07}{%
+% Sets beamer bibliography item correctly.
+% Adds |fullwidth| environment, handles margins better.
+% Adds |sidecaption| environment and |\flushscap| command.
+% }
+%
+% \GetFileInfo{didactic.dtx}
+%
+% \DoNotIndex{\newcommand,\newenvironment}
+%
+%
+% \title{The \textsf{didactic} package\thanks{This document
+% corresponds to \textsf{didactic}~\fileversion, dated \filedate.
+% Licensed under the terms of LPPL, version 1.3c or later.}}
+% \author{Daniel Bosk\\\texttt{daniel@bosk.se}}
+%
+% \maketitle
+%
+% \tableofcontents
+%
+% \section{Introduction}
+%
+% This package introduces some environments that are useful for writing
+% teaching material.
+% It also provides a few settings for |beamer| and |memoir| to make the
+% resulting document more readable.
+%
+% \section{Usage}
+%
+% The package automatically detects if |beamer| or |memoir| is loaded and
+% customizes the document accordingly.
+% \DescribeEnv{nobeamer}
+% \DescribeEnv{noarticle}
+% \DescribeEnv{nomemoir}
+% That can be prevented, however, by using the |nobeamer| or |nomemoir|
+% options.
+% The |noarticle| is to prevent the article versions of the (|beamer|)
+% environments to be defined.
+%
+% \DescribeEnv{notheorems}
+% The package also provides a few environments for |beamer| and |article| mode.
+% Particularly, it can define theorems and definitions, which might be defined
+% also by other packages.
+% To prevent this, use the |notheorems| option.
+%
+% \DescribeEnv{inner}
+% \DescribeEnv{outer}
+% \DescribeEnv{top}
+% \DescribeEnv{bottom}
+% When the package customizes |memoir| it sets the inner and outer margins to
+% fit margin notes better.
+% The |inner| and |outer| options can be used to set the inner and outer
+% margins to be used.
+% The |top| and |bottom| options can be used to set the top and bottom margins.
+%
+% \subsection{Beamer blocks and semantic environments for papers}
+%
+% \DescribeEnv{assumption}
+% \DescribeEnv{idea}
+% \DescribeEnv{question}
+% \DescribeEnv{exercise}
+% \DescribeEnv{activity}
+% \DescribeEnv{remark}
+% These environments provides wrappers around Beamer's |block| environment.
+% The idea is to complement the blocks provided by Beamer, such as |theorem|,
+% |definition| and |example|, with some more useful blocks.
+% Each of them provides a block with an appropriate title and optional subtitle
+% and is of a suitable colour.
+% For instance, consider the following.
+% \input{idea.tex}
+% That can be produced by the following code.
+% \inputminted[linenos]{latex}{idea.tex}
+%
+% \DescribeMacro{\ProvideSemanticEnv}
+% We can create new such block environments, that work both with |beamer| and
+% without, by using the |\ProvideSemanticEnv| command.
+% This command takes five arguments:
+% \begin{enumerate}
+% \item the name of the environment,
+% \item the name of the block environment to use (optional),
+% \item the title of the block,
+% \item options to pass to |thmtools| (optional),
+% \item the key of the translation of the refname of the block,
+% \item the key of the translation of the refnames of the block.
+% \item the key of the translation of the Refname of the block,
+% \item the key of the translation of the Refnames of the block.
+% \end{enumerate}
+% For example, the |idea| block above was created by the following code:
+% \inputminted{latex}{ProvideSemanticEnv.tex}
+%
+% \DescribeEnv{lightblock}
+% \DescribeEnv{darkblock}
+% We provide two shades of boxes, light coloured and dark coloured boxes.
+% These can be used to create boxes of various colours easily.
+% These two environments take two mandatory arguments: the first one is a
+% colour, the second is the title.
+%
+% In the text (not slides) the blocks are not coloured.
+% For instance, consider the following.
+% \input{lightblock.tex}
+% That can be produced by the following code.
+% \inputminted[linenos]{latex}{lightblock.tex}
+%
+% \DescribeEnv{blackblock}
+% \DescribeEnv{whiteblock}
+% \DescribeEnv{bwblock}
+% For instance, we provide a black block, white block and a black-white block.
+% These take only one mandatory argument: a title.
+%
+% \DescribeEnv{redblock}
+% \DescribeEnv{blueblock}
+% \DescribeEnv{purpleblock}
+% \DescribeEnv{greenblock}
+% \DescribeEnv{yellowblock}
+% \DescribeEnv{orangeblock}
+% We also provide a few predefined blocks in various common colours.
+% They all take a title as mandatory argument.
+%
+% \subsection{Tools for code examples}
+%
+% We also provide two commands for working with code examples: |lstexample| and
+% |runpython|.
+%
+% \DescribeMacro{\lstexample}
+% The |\lstexample| command allows us to typeset the source code of the
+% example.
+% For instance, |\lstexample{python}{hello.py}| produces the following:
+% \lstexample{python}{hello.py}
+%
+% We can also pass optional arguments directly to |minted| that is used to
+% typeset the code.
+% \begin{example}
+% |\lstexample[linenos,highlightlines=4]{python}{hello.py}| produces the
+% following.
+% \lstexample[linenos,highlightlines=4]{python}{hello.py}
+% \end{example}
+%
+% \DescribeMacro{\runpython}
+% We can also run the example code and include its output using the
+% |\runpython| macro.
+% \begin{example}
+% For instance, |\runpython{hello.py}| produces the following.
+% \runpython{hello.py}
+% \end{example}
+%
+% \DescribeMacro{\codebycode}
+% The |\codebycode| command is simply two |\lstexample| commands side by side:
+% |\codebycode[opt1]{lang1}{file1}[opt2]{lang2}{file2}|.
+% \codebycode
+% [breaklines,linenos]{python}{hello.py}
+% [breaklines,linenos,highlightlines=4]{python}{hello.py}
+%
+% \DescribeMacro{\runbyrun}
+% We can also put the output side by side using
+% |\runbyrun{hello.py}{hello.py}|.
+% \runbyrun{hello.py}{hello.py}
+%
+% \subsection{Adding margin notes of different kinds}
+%
+% \DescribeMacro{\indentedmarginpar}
+% We want to be able to put quite some content in the margins.
+% For this reason we want to have indented paragraphs in the margin notes.
+% We can use the |\indentedmarginpar{text}| command to do this.
+% For instance, consider the output in the margin.
+% \indentedmarginpar{%
+% This is an example of an indented margin paragraph.
+%
+% It can contain multiple paragraphs.
+% }
+%
+% \DescribeMacro{\newnotetype}
+% \DescribeMacro{\ltnote}
+% We also want to be able to use titled notes of different kinds.
+% We can use the |\newnotetype[fmtcmd]{type}{title}| command to define a new
+% type of note.
+% For instance |\ltnote| is defined as
+% \begin{center}
+% |\newnotetype{\ltnote}{\GetTranslationWarn{Learning theory}}|.
+% \end{center}
+% \ltnote{This is an example of a learning theory note.}
+%
+% We can also change the formatting of the title.
+% |\newnotetype[\textbf]{\bfnote}{Bold note}| and
+% |\bfnote{This is a bold note.}| gives us the note in the margin.
+% \newnotetype[\textbf]{\bfnote}{Bold note}
+% \bfnote{This is a bold note.}
+% \ltnote{Another example of a learning theory note.}
+%
+% \StopEventually{}
+%
+% \section{Implementation}
+%
+% Let's start with the options.
+%
+% \subsection{Options}
+%
+% We have a few negative options, that is, if specified we don't want to do
+% them.
+% This means that we'll need to use conditionals.
+% So each option definition consists first of a |\newif| then setting it to
+% true, and finnally, a |\DeclareOption|.
+% The body of the |\DeclareOption| then sets the |\if| to false.
+% After all the options are declared we'll use |\ProcessOptions|.
+% After that we can have all code actually doing the work, all wrapped in |\if|
+% statements.
+%
+% \begin{environment}{nobeamer}
+% \begin{environment}{nobeamertheme}
+% \begin{environment}{noarticle}
+% This option is used to disable the |beamer| specific parts of the package.
+% Meaning that we don't customize |beamer| even when we find that it is loaded.
+% \begin{macrocode}
+\newif\if@didactic@beamer
+\@ifclassloaded{beamer}{\@didactic@beamertrue}{\@didactic@beamerfalse}
+\DeclareOptionX{nobeamer}{\@didactic@beamerfalse}
+\newif\if@didactic@article
+\@ifclassloaded{beamer}{\@didactic@articlefalse}{\@didactic@articletrue}
+\newif\if@didactic@beamertheme
+\@didactic@beamerthemetrue
+\DeclareOptionX{nobeamertheme}{\@didactic@beamerthemefalse}
+\DeclareOptionX{noarticle}{\@didactic@articlefalse}
+% \end{macrocode}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+%
+% \begin{environment}{nomemoir}
+% This option is used to disable the |memoir| specific parts of the package.
+% Meaning that we don't customize |memoir| even when we find that it is loaded.
+% \begin{macrocode}
+\newif\if@didactic@memoir
+\@ifclassloaded{memoir}{\@didactic@memoirtrue}{\@didactic@memoirfalse}
+\DeclareOptionX{nomemoir}{\@didactic@memoirfalse}
+% \end{macrocode}
+% \end{environment}
+%
+% \begin{environment}{notheorems}
+% This option is used to disable defining the usual environments provided by
+% |amsmath|: definition, theorem, etc.
+% \begin{macrocode}
+\newif\if@didactic@theorems
+\@didactic@theoremstrue
+\DeclareOptionX{notheorems}{\@didactic@theoremsfalse}
+% \end{macrocode}
+% \end{environment}
+%
+% \begin{environment}{inner}
+% \begin{environment}{outer}
+% \begin{environment}{top}
+% \begin{environment}{bottom}
+% We also have some key--value options to control the margins.
+% \begin{macrocode}
+\newcommand\@didactic@margin@inner{20mm}
+\newcommand\@didactic@margin@outer{70mm}
+\newcommand\@didactic@margin@top{25mm}
+\newcommand\@didactic@margin@bottom{40mm}
+\DeclareOptionX{inner}[25mm]{\renewcommand\@didactic@margin@inner{#1}}
+\DeclareOptionX{outer}[65mm]{\renewcommand\@didactic@margin@outer{#1}}
+\DeclareOptionX{top}[25mm]{\renewcommand\@didactic@margin@top{#1}}
+\DeclareOptionX{bottom}[40mm]{\renewcommand\@didactic@margin@bottom{#1}}
+% \end{macrocode}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+%
+% \begin{environment}{marginparmargin}
+% We also have an option to set the marginpar margin.
+% We simply pass this on to |memoir| and keep a record ourselves too.
+% We know that the default in |memoir| is |outer|.
+% \begin{macrocode}
+\newcommand\@didactic@marginparmargin{outer}
+\DeclareOptionX{marginparmargin}{%
+ \renewcommand\@didactic@marginparmargin{#1}
+ \@ifclassloaded{memoir}{%
+ \marginparmargin{#1}
+ \strictpagechecktrue
+ \checkandfixthelayout
+ }{}
+}
+% \end{macrocode}
+% \end{environment}
+%
+% Now that we've declared the options we can process them.
+% \begin{macrocode}
+\ProcessOptionsX\relax
+% \end{macrocode}
+%
+% \subsection{Customizing \texttt{beamer}}
+%
+% If |beamer| is loaded we want to customize it.
+% However, only if the user hasn't disabled this with the |nobeamer| option.
+% \begin{macrocode}
+\if@didactic@beamer
+% \end{macrocode}
+
+% If we use |beamer| we want to use the Berlin theme.
+% This theme guides the viewer very nicely, how must is left and where we are
+% in the presentation.
+% (The same is true for the presenter.)
+% \begin{macrocode}
+\if@didactic@beamertheme
+ \usetheme{Berlin}
+% \end{macrocode}
+% However, we want to customize the footline.
+% We want to add two lines in the footline.
+% We want to add the author (left) and institute (right) to the first line.
+% Then we add the title (left) and page number (right) to the bottom line.
+% \begin{macrocode}
+ \setbeamertemplate{footline}%{miniframes theme}
+ {%
+ \begin{beamercolorbox}[colsep=1.5pt]{upper separation line foot}
+ \end{beamercolorbox}
+ \begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
+ leftskip=.3cm,rightskip=.3cm plus1fil]{author in head/foot}%
+ \leavevmode{\usebeamerfont{author in head/foot}\insertshortauthor}%
+ \hfill%
+ {\usebeamerfont{institute in head/foot}%
+ \usebeamercolor[fg]{institute in head/foot}\insertshortinstitute}%
+ \end{beamercolorbox}%
+ \begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
+ leftskip=.3cm,rightskip=.3cm plus1fil]{title in head/foot}%
+ {\usebeamerfont{title in head/foot}\insertshorttitle}%
+ \hfill%
+ \insertframenumber%
+ \end{beamercolorbox}%
+ \begin{beamercolorbox}[colsep=1.5pt]{lower separation line foot}
+ \end{beamercolorbox}
+ }
+% \end{macrocode}
+%
+% We also want to set the transparency of the covered items.
+% We also want to set the bibliography item to text, we need this to get proper
+% references (not icons) in the bibliography.
+% (We need that for certain bibliography styles.)
+% \begin{macrocode}
+ \setbeamercovered{transparent}
+ \setbeamertemplate{bibliography item}{\relax}
+\fi
+% \end{macrocode}
+%
+% Finally, we want to add a table of contents at the beginning of each section
+% and subsection.
+% We want these to be shaded, so that the current section is highlighted.
+% We also want to hide the subsections of the other sections.
+% \begin{macrocode}
+\AtBeginSection[]{%
+ \begin{frame}<beamer>
+ \tableofcontents[currentsection,
+ subsectionstyle=show/show/hide]
+ \end{frame}
+}
+\AtBeginSubsection[]{%
+ \begin{frame}<beamer>
+ \tableofcontents[currentsection,
+ subsectionstyle=show/shaded/hide]
+ \end{frame}
+}
+\fi% end \if@didactic@beamer
+% \end{macrocode}
+%
+% \subsection{Customizing \texttt{memoir}}
+%
+% If |memoir| is loaded we want to customize it.
+% However, only if the user hasn't disabled this with the |nomemoir| option.
+% \begin{macrocode}
+\if@didactic@memoir
+% \end{macrocode}
+%
+% We want to set up |memoir| to use the Tufte style.
+% This means that we want to put a lot of text in the margin.
+% We'll use margin notes and put all the footnotes in the margin.
+% We also want to use footnotes for references so that they also appear in the
+% margin.
+%
+% We want to use the |marginfix| package to fix the margin notes.
+% \begin{macrocode}
+\RequirePackage{marginfix}
+\setlrmarginsandblock{\@didactic@margin@inner}
+ {\@didactic@margin@outer}
+ {*}
+\setulmarginsandblock{\@didactic@margin@top}
+ {\@didactic@margin@bottom}
+ {*}
+
+\footnotesinmargin
+
+\RequirePackage{ragged2e}
+\renewcommand{\sidefootform}{\RaggedRight}
+\renewcommand{\foottextfont}{\footnotesize\RaggedRight}
+
+\setmpjustification{\RaggedRight}{\RaggedRight}
+
+% margin figure and caption typeset ragged against text block
+\setfloatadjustment{marginfigure}{\mpjustification}
+\setmarginfloatcaptionadjustment{figure}{\captionstyle{\mpjustification}}
+
+% side captions
+% https://tex.stackexchange.com/a/275626/17418
+\sidecapmargin{outer}
+\setsidecappos{t}
+\checkandfixthelayout
+\setsidecaps{\marginparsep}{\marginparwidth}
+\renewcommand{\sidecapstyle}{%
+ \captionstyle{\RaggedRight}
+}
+
+% From https://tex.stackexchange.com/a/324757/17418
+% Palatino for main text and math
+\RequirePackage[osf,sc]{mathpazo}
+% Helvetica for sans serif
+% (scaled to match size of Palatino)
+\RequirePackage[scaled=0.90]{helvet}
+% Bera Mono for monospaced
+% (scaled to match size of Palatino)
+\RequirePackage[scaled=0.85]{beramono}
+\setlxvchars\setxlvchars
+\checkandfixthelayout
+\nouppercaseheads
+% \end{macrocode}
+%
+% We also want to adapt the citation commands of a few packages to use
+% footnotes.
+% For these, we check if the package is loaded, if it is, we do the changes.
+% We don't load the packages ourselves, we assume the user has done that.
+% This also means that the |didactic| package should be loaded last.
+% \begin{macrocode}
+\@ifpackageloaded{biblatex}{%
+ \ExecuteBibliographyOptions{%
+ autocite=footnote,
+ singletitle=false,
+ %style=verbose,
+ %citestyle=verbose,
+ maxbibnames=99,
+ isbn=false,doi=false,url=false
+ }
+ % from https://tex.stackexchange.com/a/374059/17418
+ \DeclareCiteCommand{\fullauthorcite}
+ {\usebibmacro{prenote}}
+ {\usedriver
+ {\setcounter{maxnames}{99}% use up to 99 authors
+ \DeclareNameAlias{sortname}{default}}
+ {\thefield{entrytype}}}
+ {\multicitedelim}
+ {\usebibmacro{postnote}}
+}{}
+\@ifpackageloaded{csquotes}{%
+ \SetCiteCommand{\footcite}
+}{}
+% \end{macrocode}
+%
+% And that concludes the |memoir| part.
+% \begin{macrocode}
+\fi% end \if@didactic@memoir
+% \end{macrocode}
+%
+% \subsection{A side-caption environment for \texttt{beamer}}
+%
+% \begin{environment}{sidecaption}
+% When using |memoir|, we can use the |sidecaption| environment to put the
+% caption in the margin.
+% However, when using |beamer| we don't have this environment, so we need to
+% provide it with a suitable behaviour.
+% It's suitable to just translate it to a normal caption, as usually used in
+% |beamer|.
+% \begin{macrocode}
+\ProvideDocumentEnvironment{sidecaption}{omo+b}{%
+ #4
+ \caption{#2\IfValueT{#3}{\label{#3}}}
+}{\relax}
+% \end{macrocode}
+% \end{environment}
+%
+% \begin{macro}{\flushscap}
+% We also want to provide a command to flush a figure towards the caption.
+% \begin{macrocode}
+\NewDocumentCommand{\flushscap}{O{\centering}}{%
+ \@ifclassloaded{memoir}{%
+ \ifscapmargleft%
+ \flushleft%
+ \else%
+ \flushright%
+ \fi%
+ }{%
+ #1%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{More semantic environments}
+%
+% We want to provide a set of environments (blocks) for |beamer|.
+% We want the names of the blocks to be translated.
+% We'll use the |translations| package for this.
+% That way we get the language used through the normal use of |babel|.
+%
+% We also want to have the same environments for the article mode, but in a
+% nicer format that the default of |beamerarticle|.
+% For instance, instead of
+% \begin{block}{Example}
+% This is an example.
+% \end{block}
+% we want something like
+% \begin{example}
+% This is an example.
+% \end{example}
+%
+% This means that we'll need to do one thing if |beamer| is loaded and another
+% if |beamerarticle| is loaded---or rather, when |beamer| is not loaded, we
+% should be able to use this without |beamer| and |beamerarticle|.
+%
+% We want to provide environments like this one:
+% \begin{exercise}\label{exercise}
+% This is an exercise.
+% \end{exercise}
+% \begin{exercise}\label{anotherexercise}
+% This is another exercise.
+% \end{exercise}
+% We can use |\cref| to refer to them, getting something like \cref{exercise} or
+% \cref{exercise,anotherexercise}.
+%
+% We also want it to work with different languages, provided there is a
+% translation.
+% We do Swedish here.
+%
+% \selectlanguage{swedish}
+% Vi kan också skapa exempel på svenska.
+% \begin{exercise}\label{exempel}
+% Detta är ett exempel.
+% \end{exercise}
+% \begin{exercise}\label{ytterligareexempel}
+% Detta är ytterligare ett exempel.
+% \end{exercise}
+% Vi kan referera till dem med |\cref|, vilket ger något som \cref{exempel}
+% eller \cref{exempel,ytterligareexempel}.
+% \selectlanguage{british}
+%
+% Let's also add another idea, but in Swedish.
+%
+% \selectlanguage{swedish}
+% \begin{idea}\label{ide}
+% Detta är en idé.
+% \end{idea}
+% Då har vi \cref{ide}, men vi hade även tidigare \cref{theidea}.
+% Tillsammans är de \cref{ide,theidea}.
+% \selectlanguage{british}
+%
+% We can also refer to them in English, \cref{ide} and \cref{theidea}
+% separately and together as \cref{ide,theidea}.
+%
+% \begin{macro}{\ProvideSemanticEnv}
+% We provide a command to create such environments.
+% This way we just run this command in the preamble, if |beamer| is loaded it
+% creates the block environments for |beamer|, otherwise it creates the
+% environments for the article.
+%
+% It can be used like this:
+% \begin{center}
+% |\ProvideSemanticEnv{test}[alertblock]{Test}[style=definition]|\\
+% \qquad|{test}{tests}{Test}{Tests}|
+% \end{center}
+% \begin{macrocode}
+\ProvideDocumentCommand{\ProvideSemanticEnv}{m o m o mmmm}{%
+ \@ifundefined{#1}{%
+ \@ifclassloaded{beamer}{% beamer
+% \end{macrocode}
+% For |beamer| we want to use the |block| environment, or one of the coloured
+% blocks that we provide below.
+% We let the second argument (optional) be the name of the block environment to
+% use.
+% This will be the easiest way to set the colour of the block.
+%
+% Lastly, we let the third argument be the title of the block.
+% This is the English title and also the key used to translate the title of the
+% block.
+% \begin{macrocode}
+ \IfValueTF{#2}{%
+ \ProvideDocumentEnvironment{#1}{o}{%
+ \begin{#2}{\GetTranslationWarn{#3}\IfValueT{##1}{: ##1}}
+ }{%
+ \end{#2}
+ }
+ }{%
+ \ProvideDocumentEnvironment{#1}{o}{%
+ \begin{block}{\GetTranslationWarn{#3}\IfValueT{##1}{: ##1}}
+ }{%
+ \end{block}
+ }
+ }
+% \end{macrocode}
+%
+% If we don't use |beamer|, we want to use the |thmtools| package to define the
+% environments.
+% The fourth argument (optional), will be passed as options to
+% |\declaretheorem|.
+% The fifth to eighth arguments are the keys of (meaning English) translations
+% of the refnames of the block.
+% \begin{macrocode}
+ }{% not beamer
+ \IfValueTF{#4}{%
+ \declaretheorem[
+ name=\GetTranslationWarn{#3},
+ refname={{\GetTranslationWarn{#5}},{\GetTranslationWarn{#6}}},
+ Refname={{\GetTranslationWarn{#7}},{\GetTranslationWarn{#8}}},
+ #4
+ ]{#1}
+ }{%
+ \declaretheorem[
+ style=definition,
+ name=\GetTranslationWarn{#3},
+ refname={{\GetTranslationWarn{#5}},{\GetTranslationWarn{#6}}},
+ Refname={{\GetTranslationWarn{#7}},{\GetTranslationWarn{#8}}}
+ ]{#1}
+ }
+ }
+% \end{macrocode}
+%
+% Since the |refname| and |Refname| options of |thmtools| doesn't seem to work
+% we will add the necessary |\crefname| and |\Crefname| commands at the
+% beginning of the document, for both |beamer| and non-|beamer| case.
+% \begin{macrocode}
+ \AtBeginDocument{%
+ \@ifpackageloaded{cleveref}{%
+ \crefname{#1}
+ {\GetTranslationWarn{#5}}
+ {\GetTranslationWarn{#6}}
+ \Crefname{#1}
+ {\GetTranslationWarn{#7}}
+ {\GetTranslationWarn{#8}}
+ }{%
+ \relax
+ }
+ }
+ }{\relax} % \@ifundefined{#1}
+} % \ProvideSemanticEnv
+% \end{macrocode}
+% \end{macro}
+% \begin{environment}{assumption}
+% \begin{environment}{idea}
+% \begin{environment}{question}
+% \begin{environment}{exercise}
+% \begin{environment}{activity}
+% \begin{environment}{remark}
+% \begin{environment}{summary}
+% Then let's define some useful environments.
+% \begin{macrocode}
+\ProvideSemanticEnv{assumption}[alertblock]{Assumption}
+ {assumption}{assumptions}{Assumption}{Assumptions}
+\ProvideSemanticEnv{idea}[greenblock]{Idea}
+ {idea}{ideas}{Idea}{Ideas}
+\ProvideSemanticEnv{question}[orangeblock]{Question}
+ {question}{questions}{Question}{Questions}
+\ProvideSemanticEnv{exercise}[yellowblock]{Exercise}
+ {exercise}{exercises}{Exercise}{Exercises}
+\ProvideSemanticEnv{activity}[yellowblock]{Activity}
+ {activity}{activities}{Activity}{Activities}
+\ProvideSemanticEnv{remark}[alertblock]{Remark}[%
+ numbered=no,style=remark
+ ]{remark}{remarks}{Remark}{Remarks}
+\ProvideSemanticEnv{summary}[block]{Summary}[%
+ numbered=no,style=remark
+ ]{summary}{summaries}{Summary}{Summaries}
+% \end{macrocode}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+%
+% We also want to provide the normal environments for theorems and definitions
+% and such.
+% \begin{macrocode}
+\if@didactic@theorems
+ \ProvideSemanticEnv{definition}[block]{Definition}
+ {definition}{definitions}{Definition}{Definitions}
+ \ProvideSemanticEnv{theorem}[block]{Theorem}[%
+ numbered=unless unique,style=theorem
+ ]{theorem}{theorems}{Theorem}{Theorems}
+ \ProvideSemanticEnv{corollary}[block]{Corollary}[%
+ numbered=unless unique,style=theorem
+ ]{corollary}{corollaries}{Corollary}{Corollaries}
+ \ProvideSemanticEnv{lemma}[block]{Lemma}[%
+ numbered=unless unique,style=theorem
+ ]{lemma}{lemmas}{Lemma}{Lemmas}
+ \ProvideSemanticEnv{proof}[block]{Proof}[%
+ numbered=no,style=proof
+ ]{proof}{proofs}{Proof}{Proofs}
+ \ProvideSemanticEnv{solution}[block]{Solution}[%
+ numbered=no,style=proof
+ ]{solution}{solutions}{Solution}{Solutions}
+ \ProvideSemanticEnv{example}[exampleblock]{Example}
+ {example}{examples}{Example}{Examples}
+\fi
+% \end{macrocode}
+%
+%
+% \subsection{Translations}
+%
+% We also want to provide translations for the environments.
+% We want to provide those even if none of the packages above are loaded.
+% \begin{macrocode}
+\ProvideTranslation{swedish}{Assumption}{Antagande}
+\ProvideTranslation{swedish}{Assumptions}{Antagandena}
+\ProvideTranslation{swedish}{assumption}{antagande}
+\ProvideTranslation{swedish}{assumptions}{antagandena}
+\ProvideTranslation{swedish}{Idea}{Idé}
+\ProvideTranslation{swedish}{Ideas}{Idéerna}
+\ProvideTranslation{swedish}{idea}{idé}
+\ProvideTranslation{swedish}{ideas}{idéerna}
+\ProvideTranslation{swedish}{Question}{Fråga}
+\ProvideTranslation{swedish}{Questions}{Frågor}
+\ProvideTranslation{swedish}{question}{fråga}
+\ProvideTranslation{swedish}{questions}{frågor}
+\ProvideTranslation{swedish}{Exercise}{Övningsuppgift}
+\ProvideTranslation{swedish}{Exercises}{Övningsuppgifterna}
+\ProvideTranslation{swedish}{exercise}{övningsuppgift}
+\ProvideTranslation{swedish}{exercises}{övningsuppgifterna}
+\ProvideTranslation{swedish}{Activity}{Aktivitet}
+\ProvideTranslation{swedish}{Activities}{Aktiviteter}
+\ProvideTranslation{swedish}{activity}{aktivitet}
+\ProvideTranslation{swedish}{activities}{aktiviteter}
+\ProvideTranslation{swedish}{Note}{Anmärkning}
+\ProvideTranslation{swedish}{Notes}{Anmärkningar}
+\ProvideTranslation{swedish}{note}{anmärkning}
+\ProvideTranslation{swedish}{notes}{anmärkningar}
+\ProvideTranslation{swedish}{Remark}{Anmärkning}
+\ProvideTranslation{swedish}{Remarks}{Anmärkningar}
+\ProvideTranslation{swedish}{remark}{anmärkning}
+\ProvideTranslation{swedish}{remarks}{anmärkningar}
+\ProvideTranslation{swedish}{Summary}{Sammanfattning}
+\ProvideTranslation{swedish}{Summaries}{Sammanfattningar}
+\ProvideTranslation{swedish}{summary}{sammanfattning}
+\ProvideTranslation{swedish}{summaries}{sammanfattningar}
+\ProvideTranslation{swedish}{definition}{definition}
+\ProvideTranslation{swedish}{definitions}{definitionerna}
+\ProvideTranslation{swedish}{Definition}{Definition}
+\ProvideTranslation{swedish}{Definitions}{Definitionerna}
+\ProvideTranslation{swedish}{theorem}{sats}
+\ProvideTranslation{swedish}{theorems}{satserna}
+\ProvideTranslation{swedish}{Theorem}{Sats}
+\ProvideTranslation{swedish}{Theorems}{Satserna}
+\ProvideTranslation{swedish}{corollary}{följdsats}
+\ProvideTranslation{swedish}{Corollary}{Följdsats}
+\ProvideTranslation{swedish}{corollaries}{följdsatser}
+\ProvideTranslation{swedish}{Corollaries}{Följdsatser}
+\ProvideTranslation{swedish}{lemma}{hjälpsats}
+\ProvideTranslation{swedish}{lemmas}{hjälpsatserna}
+\ProvideTranslation{swedish}{Lemma}{Hjälpsats}
+\ProvideTranslation{swedish}{Lemmas}{Hjälpsatserna}
+\ProvideTranslation{swedish}{proof}{bevis}
+\ProvideTranslation{swedish}{Proof}{Bevis}
+\ProvideTranslation{swedish}{proofs}{bevisen}
+\ProvideTranslation{swedish}{Proofs}{Bevisen}
+\ProvideTranslation{swedish}{Solution}{Lösningsförslag}
+\ProvideTranslation{swedish}{Solutions}{Lösningsförslagen}
+\ProvideTranslation{swedish}{solution}{lösningsförslag}
+\ProvideTranslation{swedish}{solutions}{lösningsförslagen}
+\ProvideTranslation{swedish}{Example}{Exempel}
+\ProvideTranslation{swedish}{Examples}{Exempelen}
+\ProvideTranslation{swedish}{example}{exempel}
+\ProvideTranslation{swedish}{examples}{exempelen}
+% \end{macrocode}
+%
+%
+% \subsection{Coloured blocks}
+%
+% \begin{environment}{lightblock}
+% \begin{environment}{darkblock}
+% \begin{environment}{blackblock}
+% \begin{environment}{whiteblock}
+% \begin{environment}{bwblock}
+% \begin{environment}{redblock}
+% \begin{environment}{blueblock}
+% \begin{environment}{purpleblock}
+% \begin{environment}{greenblock}
+% \begin{environment}{yellowblock}
+% \begin{environment}{orangeblock}
+% Now we have the coloured blocks.
+% These we want to define even if |beamer| is not loaded, but for this we need
+% |beamerarticle| instead.
+% \begin{macrocode}
+\ProvideDocumentEnvironment{lightblock}{mm}{%
+ \setbeamercolor{block body}{bg=#1!10,fg=black}
+ \setbeamercolor{block title}{bg=#1,fg=black}
+ \setbeamercolor{local structure}{fg=#1}
+ \begin{block}{#2}
+}{%
+ \end{block}
+}
+\ProvideDocumentEnvironment{darkblock}{mm}{%
+ \setbeamercolor{block body}{bg=#1!10,fg=black}
+ \setbeamercolor{block title}{bg=#1,fg=white}
+ \setbeamercolor{local structure}{fg=#1}
+ \begin{block}{#2}
+}{%
+ \end{block}
+}
+\ProvideDocumentEnvironment{blackblock}{m}
+{\begin{darkblock}{black}{#1}}
+{\end{darkblock}}
+\ProvideDocumentEnvironment{whiteblock}{m}{%
+ \setbeamercolor{block body}{bg=white!10,fg=black}
+ \setbeamercolor{block title}{bg=white,fg=black}
+ \setbeamercolor{local structure}{fg=black}
+ \begin{block}{#1}
+}{%
+ \end{block}
+}
+\ProvideDocumentEnvironment{bwblock}{m}{%
+ \setbeamercolor{block body}{bg=white!10,fg=black}
+ \setbeamercolor{block title}{bg=black,fg=white}
+ \setbeamercolor{local structure}{fg=black}
+ \begin{block}{#1}
+}{%
+ \end{block}
+}
+\ProvideDocumentEnvironment{redblock}{m}
+{\begin{darkblock}{red}{#1}}
+{\end{darkblock}}
+\ProvideDocumentEnvironment{blueblock}{m}
+{\begin{darkblock}{blue}{#1}}
+{\end{darkblock}}
+\ProvideDocumentEnvironment{purpleblock}{m}
+{\begin{darkblock}{purple}{#1}}
+{\end{darkblock}}
+\ProvideDocumentEnvironment{greenblock}{m}
+{\begin{lightblock}{green}{#1}}
+{\end{lightblock}}
+\ProvideDocumentEnvironment{yellowblock}{m}
+{\begin{lightblock}{yellow}{#1}}
+{\end{lightblock}}
+\ProvideDocumentEnvironment{orangeblock}{m}
+{\begin{lightblock}{orange}{#1}}
+{\end{lightblock}}
+% \end{macrocode}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+%
+% \subsection{Adding margin notes of different kinds}
+%
+% We want to add titled margin notes.
+% These margin notes should use indentation since they might contains several
+% paragraphs.
+%
+% \begin{macro}{\indentedmarginpar}
+% We start with the indented margin notes.
+% They simply take a text as argument and typeset it in the margin:
+% |\indentedmarginpar{this is the text}|.
+% \indentedmarginpar{this is the text}
+% \begin{macrocode}
+% Gives us indentation in the margin notes.
+% Adapted from https://tex.stackexchange.com/a/257171
+\NewDocumentCommand{\indentedmarginpar}{+m}{%
+ \@ifclassloaded{memoir}{\strictpagecheck}{\relax}%
+ \marginpar{%
+ \setlength{\parindent}{1.0em}\footnotesize
+ \@afterindentfalse\@afterheading #1
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\newnotetype}
+% Now, let's add a command to add margin notes with a title.
+% The |\newnotetype{\titlenote}{Title]| command creates a new command
+% |\titlenote| that takes a text as argument and typesets it in the margin with
+% the title |Title|: |\titlenote{this is the text}|.
+% \newnotetype{\titlenote}{Title}
+% \titlenote{this is the text}
+% \begin{macrocode}
+\NewDocumentCommand{\newnotetype}{omm}{%
+ \IfValueTF{#1}
+ {\NewDocumentCommand{#2}{+m}{%
+ \indentedmarginpar{#1{#3:} ##1}%
+ }}
+ {\NewDocumentCommand{#2}{+m}{%
+ \indentedmarginpar{\emph{#3:} ##1}%
+ }}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ltnote}
+% We provide a few different types of margin notes.
+% That way we can also include translations for them.
+% \begin{macrocode}
+\ProvideTranslation{swedish}{Learning theory}{Lärandeteori}
+\newnotetype{\ltnote}{\GetTranslationWarn{Learning theory}}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \subsection{Listing and running code examples}
+%
+% Let's turn our focus to |\lstexample| and |\runpython|.
+% We want to make it easy to typeset and print the output of example Python
+% programs in slides and texts.
+% We want to use PythonTeX to automatically run the code and typeset the source
+% code using |minted|.
+%
+% These are the same for both |beamer| and article mode.
+%
+% \begin{macro}{\lstexample}
+% The first part is easy.
+% To typeset the source file we simply need to use the minted package.
+% We provide an optional argument to pass options to minted.
+% \begin{macrocode}
+\NewDocumentCommand{\lstexample}{omm}{%
+ \IfValueTF{#1}
+ {\inputminted[escapeinside=||,#1]{#2}{#3}}
+ {\inputminted[escapeinside=||]{#2}{#3}}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\runpython}
+% Now, for the second part, printing the output, we do this in two steps.
+% First, we create a function using PythonTeX that runs a Python program and
+% prints it output.
+% We can use it like |\runpython{hello.py}| to run the program in |hello.py|.
+% The output is printed in verbatim mode.
+% Alternatively we could use |\runpython[opt]{hello.py}| to pass |opt| to the
+% underlying |fancyvrb| environment.
+%
+% Let's create that function in PythonTeX to run the example program file.
+% We simply execute it with Python 3 and capture its output.
+% Then we print the output to stdout, which is then captured by PythonTeX.
+% We use |pytex.add_dependencies| to add the file as a dependency to rerun the
+% code when necessary.
+% \begin{macrocode}
+\begin{pycode}
+import subprocess
+
+def run_module(m):
+ result = subprocess.run(["python3", m], capture_output=True)
+ print(result.stdout.decode("utf8").strip())
+ pytex.add_dependencies(m)
+
+def mintedoutput(m, opt):
+ if opt:
+ print(r'\begin{minted}[{}]{{text}}'.format(opt))
+ else:
+ print(r'\begin{minted}{text}')
+ run_module(m)
+ print(r'\end{minted}')
+\end{pycode}
+% \end{macrocode}
+%
+% Then we simply create a command that run that function with the file as
+% argument.
+% Then print the output in verbatim mode.
+% \begin{macrocode}
+\NewDocumentCommand{\runpython}{om}{%
+ \setpythontexautoprint{false}%
+ \pyc{run_module("#2")}%
+ \printpythontex[verbatim]%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Contrasting code examples}
+%
+% Sometimes we want to contrast two code examples side by side.
+% \begin{macro}{\textbytext}
+% For example |\textbytext{\lipsum[1]}{\lipsum[1]}| should typeset the two
+% examples side by side.
+% \textbytext{\lipsum[1]}{\lipsum[1]}
+% If we use the |memoir| class and our settings (|\if@didactic@memoir|), we
+% want to use the |adjustwidth| environment to expand the text block to better
+% fit them.
+% Otherwise we use the standard text block.
+%
+% To do this we first add a |fullwidth| environment\footnote{%
+% Similarly to \url{https://tex.stackexchange.com/a/350944/17418}.
+% }.
+% We can get the |adjustwidth| environment from the |changepage| package
+% whenever |memoir| isn't used.
+% \begin{macrocode}
+\RequirePackage{changepage}
+\newlength{\@didactic@textbytext@oldcolumnwidth}
+\NewDocumentEnvironment{fullwidth}{+b}{%
+ \setlength{\@didactic@textbytext@oldcolumnwidth}{\columnwidth}
+ \setlength{\columnwidth}{\textwidth+2em+\marginparwidth+\marginparsep}
+ \IfStrEqCase{\@didactic@marginparmargin}{%
+ {inner}{\begin{adjustwidth*}{-\marginparwidth-\marginparsep}{-2em}}
+ {left}{\begin{adjustwidth}{-\marginparwidth-\marginparsep}{-2em}}
+ {outer}{\begin{adjustwidth*}{-2em}{-\marginparwidth-\marginparsep}}
+ {right}{\begin{adjustwidth}{-2em}{-\marginparwidth-\marginparsep}}
+ }[\relax]
+ #1
+ \IfStrEqCase{\@didactic@marginparmargin}{%
+ {inner}{\end{adjustwidth*}}
+ {left}{\end{adjustwidth}}
+ {outer}{\end{adjustwidth*}}
+ {right}{\end{adjustwidth}}
+ }[\relax]
+ \setlength{\columnwidth}{\@didactic@textbytext@oldcolumnwidth}
+}{\relax}
+% \end{macrocode}
+%
+% Now to the |\textbytext| command.
+% We simply set up a |tabularx| environment with two columns and use it inside
+% a |fullwidth| environment.
+% \begin{macrocode}
+\NewDocumentCommand{\textbytext}{+m+m}{%
+ \begin{fullwidth}
+ \begin{tabularx}{\columnwidth}{XX}
+ #1 & #2
+ \end{tabularx}
+ \end{fullwidth}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\codebycode}
+% When we deal with code, we deal with verbatim data.
+% The easiest way to deal with this is to simply keep the code in files and
+% supply the file names to |\inputminted|.
+% The |\codebycode| command is simply two |\inputminted| commands side by side:
+% |\codebycode[opt1]{lang1}{file1}[opt2]{lang2}{file2}|.
+% \codebycode
+% [breaklines,linenos]{python}{hello.py}
+% [breaklines,linenos]{python}{hello.py}
+%
+% This gives us the following implementation.
+% We can reuse |\textbytext| to typeset the two examples side by side.
+% \begin{macrocode}
+\RequirePackage{tabularx}
+\RequirePackage{minted}
+\NewDocumentCommand{\codebycode}{ommomm}{%
+ \textbytext{%
+ \IfValueTF{#1}
+ {\lstexample[#1]{#2}{#3}}
+ {\lstexample{#2}{#3}}%
+ }{%
+ \IfValueTF{#4}
+ {\lstexample[#4]{#5}{#6}}
+ {\lstexample{#5}{#6}}%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\runbyrun}
+% We also want to typeset the runs (|\runpython|).
+% We can use |\textbytext| to typeset the two outputs side by side.
+% \begin{macrocode}
+\NewDocumentCommand{\runbyrun}{mm}{%
+ \textbytext{\runpython{#1}}{\runpython{#2}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \Finale
+\endinput
diff --git a/Master/texmf-dist/source/latex/didactic/didactic.ins b/Master/texmf-dist/source/latex/didactic/didactic.ins
new file mode 100644
index 00000000000..089f31cd002
--- /dev/null
+++ b/Master/texmf-dist/source/latex/didactic/didactic.ins
@@ -0,0 +1,58 @@
+%%
+%% Copyright (C) 2019 by Daniel Bosk <dbosk@kth.se>
+%%
+%% This file may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License, either version 1.3c of this license
+%% or (at your option) any later version. The latest version of this
+%% license is in:
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% and version 1.3 or later is part of all distributions of LaTeX version
+%% 2005/12/01 or later.
+%%
+
+\input docstrip.tex
+\keepsilent
+
+\usedir{tex/latex/didactic}
+
+\preamble
+
+This is a generated file.
+
+Copyright (C) 2019 by Daniel Bosk <dbosk@kth.se>
+
+This file may be distributed and/or modified under the conditions of
+the LaTeX Project Public License, either version 1.3c of this license
+or (at your option) any later version. The latest version of this
+license is in:
+
+ http://www.latex-project.org/lppl.txt
+
+and version 1.3 or later is part of all distributions of LaTeX version
+2005/12/01 or later.
+
+\endpreamble
+
+\generate{\file{didactic.sty}{\from{didactic.dtx}{package}}}
+
+\obeyspaces
+\Msg{*************************************************************}
+\Msg{* *}
+\Msg{* To finish the installation you have to move the following *}
+\Msg{* file into a directory searched by TeX: *}
+\Msg{* *}
+\Msg{* didactic.sty *}
+\Msg{* *}
+\Msg{* To produce the documentation run the file *}
+\Msg{* *}
+\Msg{* didactic.dtx *}
+\Msg{* *}
+\Msg{* through LaTeX. *}
+\Msg{* *}
+\Msg{* Happy TeXing! *}
+\Msg{* *}
+\Msg{*************************************************************}
+
+\endbatchfile
diff --git a/Master/texmf-dist/tex/latex/didactic/didactic.sty b/Master/texmf-dist/tex/latex/didactic/didactic.sty
new file mode 100644
index 00000000000..599a3f76144
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/didactic/didactic.sty
@@ -0,0 +1,468 @@
+%%
+%% This is file `didactic.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% didactic.dtx (with options: `package')
+%%
+%% This is a generated file.
+%%
+%% Copyright (C) 2019 by Daniel Bosk <dbosk@kth.se>
+%%
+%% This file may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License, either version 1.3c of this license
+%% or (at your option) any later version. The latest version of this
+%% license is in:
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% and version 1.3 or later is part of all distributions of LaTeX version
+%% 2005/12/01 or later.
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{didactic}
+ [2024/04/07 v1.6 didactic]
+\RequirePackage{xparse}
+\RequirePackage{xkeyval}
+\RequirePackage{xstring}
+\RequirePackage{pythontex}
+\RequirePackage{minted}
+\RequirePackage{babel}
+\RequirePackage{translations}
+\RequirePackage{amsthm}
+\RequirePackage{thmtools}
+\PassOptionsToPackage{unq}{unique}
+\RequirePackage{unique}
+\newif\if@didactic@beamer
+\@ifclassloaded{beamer}{\@didactic@beamertrue}{\@didactic@beamerfalse}
+\DeclareOptionX{nobeamer}{\@didactic@beamerfalse}
+\newif\if@didactic@article
+\@ifclassloaded{beamer}{\@didactic@articlefalse}{\@didactic@articletrue}
+\newif\if@didactic@beamertheme
+\@didactic@beamerthemetrue
+\DeclareOptionX{nobeamertheme}{\@didactic@beamerthemefalse}
+\DeclareOptionX{noarticle}{\@didactic@articlefalse}
+\newif\if@didactic@memoir
+\@ifclassloaded{memoir}{\@didactic@memoirtrue}{\@didactic@memoirfalse}
+\DeclareOptionX{nomemoir}{\@didactic@memoirfalse}
+\newif\if@didactic@theorems
+\@didactic@theoremstrue
+\DeclareOptionX{notheorems}{\@didactic@theoremsfalse}
+\newcommand\@didactic@margin@inner{20mm}
+\newcommand\@didactic@margin@outer{70mm}
+\newcommand\@didactic@margin@top{25mm}
+\newcommand\@didactic@margin@bottom{40mm}
+\DeclareOptionX{inner}[25mm]{\renewcommand\@didactic@margin@inner{#1}}
+\DeclareOptionX{outer}[65mm]{\renewcommand\@didactic@margin@outer{#1}}
+\DeclareOptionX{top}[25mm]{\renewcommand\@didactic@margin@top{#1}}
+\DeclareOptionX{bottom}[40mm]{\renewcommand\@didactic@margin@bottom{#1}}
+\newcommand\@didactic@marginparmargin{outer}
+\DeclareOptionX{marginparmargin}{%
+ \renewcommand\@didactic@marginparmargin{#1}
+ \@ifclassloaded{memoir}{%
+ \marginparmargin{#1}
+ \strictpagechecktrue
+ \checkandfixthelayout
+ }{}
+}
+\ProcessOptionsX\relax
+\if@didactic@beamer
+
+\if@didactic@beamertheme
+ \usetheme{Berlin}
+ \setbeamertemplate{footline}%{miniframes theme}
+ {%
+ \begin{beamercolorbox}[colsep=1.5pt]{upper separation line foot}
+ \end{beamercolorbox}
+ \begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
+ leftskip=.3cm,rightskip=.3cm plus1fil]{author in head/foot}%
+ \leavevmode{\usebeamerfont{author in head/foot}\insertshortauthor}%
+ \hfill%
+ {\usebeamerfont{institute in head/foot}%
+ \usebeamercolor[fg]{institute in head/foot}\insertshortinstitute}%
+ \end{beamercolorbox}%
+ \begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
+ leftskip=.3cm,rightskip=.3cm plus1fil]{title in head/foot}%
+ {\usebeamerfont{title in head/foot}\insertshorttitle}%
+ \hfill%
+ \insertframenumber%
+ \end{beamercolorbox}%
+ \begin{beamercolorbox}[colsep=1.5pt]{lower separation line foot}
+ \end{beamercolorbox}
+ }
+ \setbeamercovered{transparent}
+ \setbeamertemplate{bibliography item}{\relax}
+\fi
+\AtBeginSection[]{%
+ \begin{frame}<beamer>
+ \tableofcontents[currentsection,
+ subsectionstyle=show/show/hide]
+ \end{frame}
+}
+\AtBeginSubsection[]{%
+ \begin{frame}<beamer>
+ \tableofcontents[currentsection,
+ subsectionstyle=show/shaded/hide]
+ \end{frame}
+}
+\fi% end \if@didactic@beamer
+\if@didactic@memoir
+\RequirePackage{marginfix}
+\setlrmarginsandblock{\@didactic@margin@inner}
+ {\@didactic@margin@outer}
+ {*}
+\setulmarginsandblock{\@didactic@margin@top}
+ {\@didactic@margin@bottom}
+ {*}
+
+\footnotesinmargin
+
+\RequirePackage{ragged2e}
+\renewcommand{\sidefootform}{\RaggedRight}
+\renewcommand{\foottextfont}{\footnotesize\RaggedRight}
+
+\setmpjustification{\RaggedRight}{\RaggedRight}
+
+\setfloatadjustment{marginfigure}{\mpjustification}
+\setmarginfloatcaptionadjustment{figure}{\captionstyle{\mpjustification}}
+
+\sidecapmargin{outer}
+\setsidecappos{t}
+\checkandfixthelayout
+\setsidecaps{\marginparsep}{\marginparwidth}
+\renewcommand{\sidecapstyle}{%
+ \captionstyle{\RaggedRight}
+}
+
+\RequirePackage[osf,sc]{mathpazo}
+\RequirePackage[scaled=0.90]{helvet}
+\RequirePackage[scaled=0.85]{beramono}
+\setlxvchars\setxlvchars
+\checkandfixthelayout
+\nouppercaseheads
+\@ifpackageloaded{biblatex}{%
+ \ExecuteBibliographyOptions{%
+ autocite=footnote,
+ singletitle=false,
+ %style=verbose,
+ %citestyle=verbose,
+ maxbibnames=99,
+ isbn=false,doi=false,url=false
+ }
+ % from https://tex.stackexchange.com/a/374059/17418
+ \DeclareCiteCommand{\fullauthorcite}
+ {\usebibmacro{prenote}}
+ {\usedriver
+ {\setcounter{maxnames}{99}% use up to 99 authors
+ \DeclareNameAlias{sortname}{default}}
+ {\thefield{entrytype}}}
+ {\multicitedelim}
+ {\usebibmacro{postnote}}
+}{}
+\@ifpackageloaded{csquotes}{%
+ \SetCiteCommand{\footcite}
+}{}
+\fi% end \if@didactic@memoir
+\ProvideDocumentEnvironment{sidecaption}{omo+b}{%
+ #4
+ \caption{#2\IfValueT{#3}{\label{#3}}}
+}{\relax}
+\NewDocumentCommand{\flushscap}{O{\centering}}{%
+ \@ifclassloaded{memoir}{%
+ \ifscapmargleft%
+ \flushleft%
+ \else%
+ \flushright%
+ \fi%
+ }{%
+ #1%
+ }%
+}
+\ProvideDocumentCommand{\ProvideSemanticEnv}{m o m o mmmm}{%
+ \@ifundefined{#1}{%
+ \@ifclassloaded{beamer}{% beamer
+ \IfValueTF{#2}{%
+ \ProvideDocumentEnvironment{#1}{o}{%
+ \begin{#2}{\GetTranslationWarn{#3}\IfValueT{##1}{: ##1}}
+ }{%
+ \end{#2}
+ }
+ }{%
+ \ProvideDocumentEnvironment{#1}{o}{%
+ \begin{block}{\GetTranslationWarn{#3}\IfValueT{##1}{: ##1}}
+ }{%
+ \end{block}
+ }
+ }
+ }{% not beamer
+ \IfValueTF{#4}{%
+ \declaretheorem[
+ name=\GetTranslationWarn{#3},
+ refname={{\GetTranslationWarn{#5}},{\GetTranslationWarn{#6}}},
+ Refname={{\GetTranslationWarn{#7}},{\GetTranslationWarn{#8}}},
+ #4
+ ]{#1}
+ }{%
+ \declaretheorem[
+ style=definition,
+ name=\GetTranslationWarn{#3},
+ refname={{\GetTranslationWarn{#5}},{\GetTranslationWarn{#6}}},
+ Refname={{\GetTranslationWarn{#7}},{\GetTranslationWarn{#8}}}
+ ]{#1}
+ }
+ }
+ \AtBeginDocument{%
+ \@ifpackageloaded{cleveref}{%
+ \crefname{#1}
+ {\GetTranslationWarn{#5}}
+ {\GetTranslationWarn{#6}}
+ \Crefname{#1}
+ {\GetTranslationWarn{#7}}
+ {\GetTranslationWarn{#8}}
+ }{%
+ \relax
+ }
+ }
+ }{\relax} % \@ifundefined{#1}
+} % \ProvideSemanticEnv
+\ProvideSemanticEnv{assumption}[alertblock]{Assumption}
+ {assumption}{assumptions}{Assumption}{Assumptions}
+\ProvideSemanticEnv{idea}[greenblock]{Idea}
+ {idea}{ideas}{Idea}{Ideas}
+\ProvideSemanticEnv{question}[orangeblock]{Question}
+ {question}{questions}{Question}{Questions}
+\ProvideSemanticEnv{exercise}[yellowblock]{Exercise}
+ {exercise}{exercises}{Exercise}{Exercises}
+\ProvideSemanticEnv{activity}[yellowblock]{Activity}
+ {activity}{activities}{Activity}{Activities}
+\ProvideSemanticEnv{remark}[alertblock]{Remark}[%
+ numbered=no,style=remark
+ ]{remark}{remarks}{Remark}{Remarks}
+\ProvideSemanticEnv{summary}[block]{Summary}[%
+ numbered=no,style=remark
+ ]{summary}{summaries}{Summary}{Summaries}
+\if@didactic@theorems
+ \ProvideSemanticEnv{definition}[block]{Definition}
+ {definition}{definitions}{Definition}{Definitions}
+ \ProvideSemanticEnv{theorem}[block]{Theorem}[%
+ numbered=unless unique,style=theorem
+ ]{theorem}{theorems}{Theorem}{Theorems}
+ \ProvideSemanticEnv{corollary}[block]{Corollary}[%
+ numbered=unless unique,style=theorem
+ ]{corollary}{corollaries}{Corollary}{Corollaries}
+ \ProvideSemanticEnv{lemma}[block]{Lemma}[%
+ numbered=unless unique,style=theorem
+ ]{lemma}{lemmas}{Lemma}{Lemmas}
+ \ProvideSemanticEnv{proof}[block]{Proof}[%
+ numbered=no,style=proof
+ ]{proof}{proofs}{Proof}{Proofs}
+ \ProvideSemanticEnv{solution}[block]{Solution}[%
+ numbered=no,style=proof
+ ]{solution}{solutions}{Solution}{Solutions}
+ \ProvideSemanticEnv{example}[exampleblock]{Example}
+ {example}{examples}{Example}{Examples}
+\fi
+\ProvideTranslation{swedish}{Assumption}{Antagande}
+\ProvideTranslation{swedish}{Assumptions}{Antagandena}
+\ProvideTranslation{swedish}{assumption}{antagande}
+\ProvideTranslation{swedish}{assumptions}{antagandena}
+\ProvideTranslation{swedish}{Idea}{Idé}
+\ProvideTranslation{swedish}{Ideas}{Idéerna}
+\ProvideTranslation{swedish}{idea}{idé}
+\ProvideTranslation{swedish}{ideas}{idéerna}
+\ProvideTranslation{swedish}{Question}{Fråga}
+\ProvideTranslation{swedish}{Questions}{Frågor}
+\ProvideTranslation{swedish}{question}{fråga}
+\ProvideTranslation{swedish}{questions}{frågor}
+\ProvideTranslation{swedish}{Exercise}{Övningsuppgift}
+\ProvideTranslation{swedish}{Exercises}{Övningsuppgifterna}
+\ProvideTranslation{swedish}{exercise}{övningsuppgift}
+\ProvideTranslation{swedish}{exercises}{övningsuppgifterna}
+\ProvideTranslation{swedish}{Activity}{Aktivitet}
+\ProvideTranslation{swedish}{Activities}{Aktiviteter}
+\ProvideTranslation{swedish}{activity}{aktivitet}
+\ProvideTranslation{swedish}{activities}{aktiviteter}
+\ProvideTranslation{swedish}{Note}{Anmärkning}
+\ProvideTranslation{swedish}{Notes}{Anmärkningar}
+\ProvideTranslation{swedish}{note}{anmärkning}
+\ProvideTranslation{swedish}{notes}{anmärkningar}
+\ProvideTranslation{swedish}{Remark}{Anmärkning}
+\ProvideTranslation{swedish}{Remarks}{Anmärkningar}
+\ProvideTranslation{swedish}{remark}{anmärkning}
+\ProvideTranslation{swedish}{remarks}{anmärkningar}
+\ProvideTranslation{swedish}{Summary}{Sammanfattning}
+\ProvideTranslation{swedish}{Summaries}{Sammanfattningar}
+\ProvideTranslation{swedish}{summary}{sammanfattning}
+\ProvideTranslation{swedish}{summaries}{sammanfattningar}
+\ProvideTranslation{swedish}{definition}{definition}
+\ProvideTranslation{swedish}{definitions}{definitionerna}
+\ProvideTranslation{swedish}{Definition}{Definition}
+\ProvideTranslation{swedish}{Definitions}{Definitionerna}
+\ProvideTranslation{swedish}{theorem}{sats}
+\ProvideTranslation{swedish}{theorems}{satserna}
+\ProvideTranslation{swedish}{Theorem}{Sats}
+\ProvideTranslation{swedish}{Theorems}{Satserna}
+\ProvideTranslation{swedish}{corollary}{följdsats}
+\ProvideTranslation{swedish}{Corollary}{Följdsats}
+\ProvideTranslation{swedish}{corollaries}{följdsatser}
+\ProvideTranslation{swedish}{Corollaries}{Följdsatser}
+\ProvideTranslation{swedish}{lemma}{hjälpsats}
+\ProvideTranslation{swedish}{lemmas}{hjälpsatserna}
+\ProvideTranslation{swedish}{Lemma}{Hjälpsats}
+\ProvideTranslation{swedish}{Lemmas}{Hjälpsatserna}
+\ProvideTranslation{swedish}{proof}{bevis}
+\ProvideTranslation{swedish}{Proof}{Bevis}
+\ProvideTranslation{swedish}{proofs}{bevisen}
+\ProvideTranslation{swedish}{Proofs}{Bevisen}
+\ProvideTranslation{swedish}{Solution}{Lösningsförslag}
+\ProvideTranslation{swedish}{Solutions}{Lösningsförslagen}
+\ProvideTranslation{swedish}{solution}{lösningsförslag}
+\ProvideTranslation{swedish}{solutions}{lösningsförslagen}
+\ProvideTranslation{swedish}{Example}{Exempel}
+\ProvideTranslation{swedish}{Examples}{Exempelen}
+\ProvideTranslation{swedish}{example}{exempel}
+\ProvideTranslation{swedish}{examples}{exempelen}
+\ProvideDocumentEnvironment{lightblock}{mm}{%
+ \setbeamercolor{block body}{bg=#1!10,fg=black}
+ \setbeamercolor{block title}{bg=#1,fg=black}
+ \setbeamercolor{local structure}{fg=#1}
+ \begin{block}{#2}
+}{%
+ \end{block}
+}
+\ProvideDocumentEnvironment{darkblock}{mm}{%
+ \setbeamercolor{block body}{bg=#1!10,fg=black}
+ \setbeamercolor{block title}{bg=#1,fg=white}
+ \setbeamercolor{local structure}{fg=#1}
+ \begin{block}{#2}
+}{%
+ \end{block}
+}
+\ProvideDocumentEnvironment{blackblock}{m}
+{\begin{darkblock}{black}{#1}}
+{\end{darkblock}}
+\ProvideDocumentEnvironment{whiteblock}{m}{%
+ \setbeamercolor{block body}{bg=white!10,fg=black}
+ \setbeamercolor{block title}{bg=white,fg=black}
+ \setbeamercolor{local structure}{fg=black}
+ \begin{block}{#1}
+}{%
+ \end{block}
+}
+\ProvideDocumentEnvironment{bwblock}{m}{%
+ \setbeamercolor{block body}{bg=white!10,fg=black}
+ \setbeamercolor{block title}{bg=black,fg=white}
+ \setbeamercolor{local structure}{fg=black}
+ \begin{block}{#1}
+}{%
+ \end{block}
+}
+\ProvideDocumentEnvironment{redblock}{m}
+{\begin{darkblock}{red}{#1}}
+{\end{darkblock}}
+\ProvideDocumentEnvironment{blueblock}{m}
+{\begin{darkblock}{blue}{#1}}
+{\end{darkblock}}
+\ProvideDocumentEnvironment{purpleblock}{m}
+{\begin{darkblock}{purple}{#1}}
+{\end{darkblock}}
+\ProvideDocumentEnvironment{greenblock}{m}
+{\begin{lightblock}{green}{#1}}
+{\end{lightblock}}
+\ProvideDocumentEnvironment{yellowblock}{m}
+{\begin{lightblock}{yellow}{#1}}
+{\end{lightblock}}
+\ProvideDocumentEnvironment{orangeblock}{m}
+{\begin{lightblock}{orange}{#1}}
+{\end{lightblock}}
+\NewDocumentCommand{\indentedmarginpar}{+m}{%
+ \@ifclassloaded{memoir}{\strictpagecheck}{\relax}%
+ \marginpar{%
+ \setlength{\parindent}{1.0em}\footnotesize
+ \@afterindentfalse\@afterheading #1
+ }%
+}
+\NewDocumentCommand{\newnotetype}{omm}{%
+ \IfValueTF{#1}
+ {\NewDocumentCommand{#2}{+m}{%
+ \indentedmarginpar{#1{#3:} ##1}%
+ }}
+ {\NewDocumentCommand{#2}{+m}{%
+ \indentedmarginpar{\emph{#3:} ##1}%
+ }}%
+}
+\ProvideTranslation{swedish}{Learning theory}{Lärandeteori}
+\newnotetype{\ltnote}{\GetTranslationWarn{Learning theory}}
+\NewDocumentCommand{\lstexample}{omm}{%
+ \IfValueTF{#1}
+ {\inputminted[escapeinside=||,#1]{#2}{#3}}
+ {\inputminted[escapeinside=||]{#2}{#3}}
+}
+\begin{pycode}
+import subprocess
+
+def run_module(m):
+ result = subprocess.run(["python3", m], capture_output=True)
+ print(result.stdout.decode("utf8").strip())
+ pytex.add_dependencies(m)
+
+def mintedoutput(m, opt):
+ if opt:
+ print(r'\begin{minted}[{}]{{text}}'.format(opt))
+ else:
+ print(r'\begin{minted}{text}')
+ run_module(m)
+ print(r'\end{minted}')
+\end{pycode}
+\NewDocumentCommand{\runpython}{om}{%
+ \setpythontexautoprint{false}%
+ \pyc{run_module("#2")}%
+ \printpythontex[verbatim]%
+}
+\RequirePackage{changepage}
+\newlength{\@didactic@textbytext@oldcolumnwidth}
+\NewDocumentEnvironment{fullwidth}{+b}{%
+ \setlength{\@didactic@textbytext@oldcolumnwidth}{\columnwidth}
+ \setlength{\columnwidth}{\textwidth+2em+\marginparwidth+\marginparsep}
+ \IfStrEqCase{\@didactic@marginparmargin}{%
+ {inner}{\begin{adjustwidth*}{-\marginparwidth-\marginparsep}{-2em}}
+ {left}{\begin{adjustwidth}{-\marginparwidth-\marginparsep}{-2em}}
+ {outer}{\begin{adjustwidth*}{-2em}{-\marginparwidth-\marginparsep}}
+ {right}{\begin{adjustwidth}{-2em}{-\marginparwidth-\marginparsep}}
+ }[\relax]
+ #1
+ \IfStrEqCase{\@didactic@marginparmargin}{%
+ {inner}{\end{adjustwidth*}}
+ {left}{\end{adjustwidth}}
+ {outer}{\end{adjustwidth*}}
+ {right}{\end{adjustwidth}}
+ }[\relax]
+ \setlength{\columnwidth}{\@didactic@textbytext@oldcolumnwidth}
+}{\relax}
+\NewDocumentCommand{\textbytext}{+m+m}{%
+ \begin{fullwidth}
+ \begin{tabularx}{\columnwidth}{XX}
+ #1 & #2
+ \end{tabularx}
+ \end{fullwidth}
+}
+\RequirePackage{tabularx}
+\RequirePackage{minted}
+\NewDocumentCommand{\codebycode}{ommomm}{%
+ \textbytext{%
+ \IfValueTF{#1}
+ {\lstexample[#1]{#2}{#3}}
+ {\lstexample{#2}{#3}}%
+ }{%
+ \IfValueTF{#4}
+ {\lstexample[#4]{#5}{#6}}
+ {\lstexample{#5}{#6}}%
+ }%
+}
+\NewDocumentCommand{\runbyrun}{mm}{%
+ \textbytext{\runpython{#1}}{\runpython{#2}}%
+}
+\endinput
+%%
+%% End of file `didactic.sty'.
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index 664c3899c12..437bc7734b1 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -265,7 +265,7 @@ my @TLP_working = qw(
dejavu dejavu-otf
delim delimseasy delimset delimtxt democodetools denisbdoc derivative dhua
diabetes-logbook diadia diagbox diagmac2 dialogl diagnose dice dichokey
- dickimaw dictsym didec diffcoeff digestif digiconfigs
+ dickimaw dictsym didactic didec diffcoeff digestif digiconfigs
dijkstra dimnum din1505
dinat dinbrief dingbat directory dirtree dirtytalk disser ditaa dithesis
dk-bib dlfltxb
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index e3fb4c4d971..6d821c7f689 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -2148,7 +2148,8 @@ $standardtex
'dehyph', '.',
'dehyph-exptl','de.*-x-.*\.tex|\.pat',
'dialogl', '[^c]\.sty|listout\.tex', # not dialogl-doc.sty
- 'didec', 'didec\.sty', # not didec.doc.sty
+ 'didactic', '\.sty', # not .py
+ 'didec', 'didec\.sty', # not didec.doc.sty
'din1505', 'NULL', # no tex files, only natbib.cfg, would be system-wide
'dirtree', '\.tex|' . $standardtex,
'digestif', 'NULL', # script
diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
index 1b6ed19a2f3..cfb86231920 100644
--- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
@@ -367,6 +367,7 @@ depend diagbox
depend diagnose
depend dialogl
depend dichokey
+depend didactic
depend didec
depend dimnum
depend dinbrief
diff --git a/Master/tlpkg/tlpsrc/didactic.tlpsrc b/Master/tlpkg/tlpsrc/didactic.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/didactic.tlpsrc