summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/stex/tex/etc/stexthm.sty
blob: c81b6358dfafa0931447f49d310f36a0859f53fc (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
\ProvidesExplPackage{stexthm}{2022/02/24}{3.0.0}{Default Typesetting for sTeX Statements}

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

\ExplSyntaxOn

\declaretheorem[parent=section]{theorem}
\stexpatchassertion[theorem]
{\ifx\sassertiontitle\@empty\begin{theorem}\else\exp_args:Nno\use:nn{\begin{theorem}[}\sassertiontitle]\fi}
{\end{theorem}}    

\declaretheorem[sibling=theorem]{observation}
\stexpatchassertion[observation]
{\ifx\sassertiontitle\@empty\begin{observation}\else\exp_args:Nno\use:nn{\begin{observation}[}\sassertiontitle]\fi}
{\end{observation}}

\declaretheorem[sibling=theorem]{corollary}
\stexpatchassertion[corollary]
{\ifx\sassertiontitle\@empty\begin{corollary}\else\exp_args:Nno\use:nn{\begin{corollary}[}\sassertiontitle]\fi}
{\end{corollary}}

\declaretheorem[sibling=theorem]{lemma}
\stexpatchassertion[lemma]
{\ifx\sassertiontitle\@empty\begin{lemma}\else\exp_args:Nno\use:nn{\begin{lemma}[}\sassertiontitle]\fi}
{\end{lemma}}
  
\declaretheorem[sibling=theorem]{axiom}
\stexpatchassertion[axiom]
{\ifx\sassertiontitle\@empty\begin{axiom}\else\exp_args:Nno\use:nn{\begin{axiom}[}\sassertiontitle]\fi}
{\end{axiom}}

\declaretheorem[sibling=theorem,style=remark]{remark}
\stexpatchassertion[remark]
{\ifx\sassertiontitle\@empty\begin{remark}\else\exp_args:Nno\use:nn{\begin{remark}[}\sassertiontitle]\fi}
{\end{remark}}
\stexpatchparagraph[remark]
{\ifx\sparagraphtitle\@empty\begin{remark}\else\exp_args:Nno\use:nn{\begin{remark}[}\sparagraphtitle]\fi}
{\end{remark}}

\declaretheorem[sibling=theorem,style=definition]{example}
\stexpatchexample
{\ifx\sexampletitle\@empty\begin{example}\else\exp_args:Nno\use:nn{\begin{example}[}\sexampletitle]\fi}
{\end{example}}

\declaretheorem[sibling=theorem,style=definition]{definition}
\stexpatchdefinition
{\ifx\sdefinitiontitle\@empty\begin{definition}\else\exp_args:Nno\use:nn{\begin{definition}[}\sdefinitiontitle]\fi}
    {\end{definition}}

\ExplSyntaxOff
  
\RequirePackage{xcolor}

\def\compemph#1{\ifcsname textcolor\endcsname\textcolor{blue}{#1}\else#1\fi}
\def\symrefemph#1{\ifcsname textcolor\endcsname\textcolor{blue}{#1}\else#1\fi}
\def\defemph#1{\ifcsname textcolor\endcsname\textcolor{blue}{\textbf{#1}}\else\textbf{#1}\fi}
\def\varemph#1{\ifcsname textcolor\endcsname\textcolor{gray}{#1}\else#1\fi}

\RequirePackage{pdfcomment}
\protected\def\compemph@uri#1#2{%
   \pdftooltip{%
     \srefsymuri{#2}{\compemph{#1}}%
   }{%
     URI:~\detokenize{#2}%
   }%
}
\protected\def\symrefemph@uri#1#2{%
   \pdftooltip{%
     \srefsymuri{#2}{\symrefemph{#1}}%
   }{%
     URI:~\detokenize{#2}%
   }%
 }
\protected\def\defemph@uri#1#2{%
   \pdftooltip{%
     \defemph{#1}%
   }{%
     URI:~\detokenize{#2}%
   }%
}
\protected\def\varemph@uri#1#2{%
   \pdftooltip{%
     \varemph{#1}%
   }{%
     Variable~\detokenize{#2}%
   }%
}