add more test files

This commit is contained in:
Maximilian Keßler 2022-01-17 10:27:22 +01:00
parent 9768ba00ee
commit 77c8dc4717
2 changed files with 298 additions and 0 deletions

View file

@ -0,0 +1,216 @@
\documentclass{article}
\usepackage{amsmath}
\usepackage{mdframed}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{mkessler-hypersetup}
\usepackage{verbatim}
\usepackage{mkessler-refproof}
\def\cname#1{\texttt{$\backslash$#1}}
\NewDocumentEnvironment{remark}{!s o}
\newcounter{all}
\declaretheorem[sibling = all]{definition}
\declaretheorem[sibling = all, name = Theorem ]{intntheorem}
\declaretheorem[sibling = all, name = Theorem*]{intstheorem}
\declaretheorem[sibling = all, name = Theorem$^{\dagger}$]{intdtheorem}
\declaretheorem[sibling = all, parent = section ]{testthm}
\declaretheorem[sibling = all, parent = section ]{lemma}
\NewDocumentEnvironment{theorem}{ !s !t+ }
{
\IfBooleanTF{#1}
{
\begin{intstheorem}
}
{
\IfBooleanTF{#2}
{
\begin{intdtheorem}
}
{
\begin{intntheorem}
}
}
}
{
\IfBooleanTF{#1}
{
\end{intstheorem}
}
{
\IfBooleanTF{#2}
{
\end{intdtheorem}
}
{
\end{intntheorem}
}
}
}
\addtotheorempreheadhook{test}
\addtotheorempostheadhook{test}
\begin{document}
\section{What we need}
\subsection{Groups / classes of theorems}
These share some properties and are controlled via options.
Things an environment should change dynamically:
\begin{itemize}
\item parent, sibling
\item title: variants with * or $^{\dagger}$
\end{itemize}
\subsection{Greater Syntax for theorems}
Expand the \cname{NewDocumentEnvironment}-like syntax to theorems as well.
\subsection{Example Code}
\begin{verbatim}
\NewTheoremGroup { all }
[
]
\NewTheoremGroup { big }
[
thmtools = { sibling = insection }
]
\NewTheoremGroup { dagger }
[
postname = { $\dagger$ },
thmtools = { sibling = insubsection }
]
\NewTheoremGroup { small }
[
thmtools = { sibling = insubsection }
]
\NewTheoremGroup { star }
[
thmtools = { sibling = insubsection },
postname = { * }
]
\NewTheoremGroup { starred }
[
thmtools = { numbered = no }
]
\DeclareTheoremVariants { theorem } { !s !t+ o}
{
\AddTheoremToGroup { big }
\IfBooleanT {#1} { \AddTheoremToGroup{star} }
\IfBooleanT {#2} { \AddTheoremToGroup{daggered} }
}
\end{verbatim}
\subsection{Syntax}
\begin{verbatim}
\NewTheoremGroup {<name>}
[
thmtools = {<options passed to thmtools>},
prename = <inserted before name>,
postname = <inserted after name>,
mapname = <applied to name as function>,
]
\NewGroupedTheorem
[
thmtools = {<options passed to thmtools>},
group = {<comma separated list of groups}
]
{<name>}
\NewDocumentTheorem{<name>}{<signature>}
{
any legal xparse code that issues the commands
\AddTheoremToGroup{<groupname>}
and
\PassToThmtools{<comma separated list>}
\PassAsOptionalArgument{<token list>}
}
\end{verbatim}
Last case: For the powerset of the mentioned theorems, generate internal theorem variants,
that are part of the corresponding groups, where in the document, the signature will be
calling the corresponding theorem variant automatically.
A typical declaration would thus be:
\begin{verbatim}
\NewDocumentTheorem{theorem}{ !s !t+ o}
{
\IfBooleanT{#1}{ \AddTheoremToGroup{star} }
\IfBooleanT{#2}{ \AddTheoremToGroup{dagger} }
\PassAsOptionalArgument{#3}
}
\end{verbatim}
\section{Testing}
\begin{theorem}\label{normal}
test
\end{theorem}
\begin{theorem}*\label{star}
\end{theorem}
\begin{theorem}+[comment]\label{dagger}
test
\end{theorem}
\def\foo#1.#2ab#3.\end{foo: #1 #2 #3}
\foo 1.2ab3.\end
\section{test}\label{sec}
\section*{test}
\phantomsection\label{sec2}
\autoref{sec}
\autoref{sec2}
\begin{theorem}
\end{theorem}
\autoref{test}
\begin{theorem}[test]
bla
\end{theorem}
\begin{definition}
\end{definition}
normal:~\autoref{normal}, star:~\autoref{star}, dagger:~\autoref{dagger}
\begin{testthm}
\end{testthm}
\begin{lemma}
bla
\end{lemma}
\end{document}

View file

@ -0,0 +1,82 @@
\documentclass{article}
\ExplSyntaxOn
\clist_new:N \copied_clist
\seq_new:N \saved_seq
%remove left -> push on stack
% call recursive
% add left to 'extra'
% call recursive
% remove left from 'extra'
% add from stack to left
\cs_generate_variant:Nn \clist_remove_all:Nn { N V }
\cs_new:Npn \clist_use_powerset_aux:Nn #1 #2
{
\clist_if_empty:NTF \copied_clist
{
#2
}
{
\clist_get:NN \copied_clist \l_tmpa_tl % gets first element of copied list into local
\seq_push:NV \saved_seq \l_tmpa_tl % pushes local value onto stack
\clist_pop:NN \copied_clist { \l_tmpa_tl } % removes from copied list
\clist_use_powerset_aux:Nn #1 {#2}
\seq_get:NN \saved_seq \l_tmpa_tl
\clist_put_left:NV #1 \l_tmpa_tl
\clist_use_powerset_aux:Nn #1 {#2}
\seq_get:NN \saved_seq \l_tmpa_tl
\clist_remove_all:NV #1 \l_tmpa_tl
\clist_push:NV \copied_clist \l_tmpa_tl
\seq_pop:NN \saved_seq \l_tmpa_tl
}
}
\cs_new:Npn \clist_use_powerset:Nn #1 #2
{
\clist_set_eq:NN \copied_clist #1
\clist_clear:N #1
\clist_remove_duplicates:N \copied_clist
\clist_use_powerset_aux:Nn #1 {#2}
\clist_set_eq:NN #1 \copied_clist
}
\clist_new:N \test_clist
\tl_set:Nn \test_clist {1,2,3,4,5,6,7,8,9}
\def\foo {
\clist_use_powerset:Nn \test_clist
{
% reached~end:~
% \clist_use:Nn \test_clist {,} \newline
\stepcounter{testval}
}
\test_clist
}
\ExplSyntaxOff
\begin{document}
\newcounter{testval}
\noindent \foo
\thetestval
\end{document}