\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}%
   }%
}
