summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/stex/tex/etc/stexthm.sty
blob: 4b89af5b393e3218a8ec46915b72231b5c0464fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
\ProvidesExplPackage{stexthm}{2023/03/19}{3.3.0}{Default Typesetting for sTeX Statements}

\RequirePackage{stex}
\RequirePackage{amsthm}
\RequirePackage{thmtools}

\ExplSyntaxOn

\cs_new_protected:Nn \_@@_stex_patch_env:nnn {
  \cs_if_exist:cF {#1}{
    \declaretheorem[#2]{#1}
  }
  \clist_map_inline:nn{#3}{
    \use:c{stexstyle##1}[#1]{
      \tl_if_empty:NTF\thistitle{
        \begin{#1}
      }{
        \begin{#1}[\thistitle]
      }
    }{ \end{#1} }
  }
}

\_@@_stex_patch_env:nnn{theorem}{parent=section}{assertion}
\_@@_stex_patch_env:nnn{observation}{sibling=theorem}{assertion}
\_@@_stex_patch_env:nnn{corollary}{sibling=theorem}{assertion}
\_@@_stex_patch_env:nnn{lemma}{sibling=theorem}{assertion}
\_@@_stex_patch_env:nnn{axiom}{sibling=theorem}{assertion}
\_@@_stex_patch_env:nnn{remark}{sibling=theorem}{assertion,paragraph}

\cs_if_exist:cF {example}{
  \declaretheorem[sibling=theorem,style=definition]{example}
}
\stexstyleexample{
  \tl_if_empty:NTF\thistitle{
    \begin{example}
  }{
    \begin{example}[\thistitle]
  }
}{
    \end{example}
}

\cs_if_exist:cF {definition}{
  \declaretheorem[sibling=theorem,style=definition]{definition}
}
\stexstyledefinition{
  \tl_if_empty:NTF\thistitle{
    \begin{definition}
  }{
    \begin{definition}[\thistitle]
  }
}{
    \end{definition}
}

\ExplSyntaxOff