Skip to content

Commit

Permalink
feat: add support for thmtools package
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexaraWu committed Mar 22, 2024
1 parent 54194e9 commit ca64c68
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions sjtutex/source/sjtutex.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -5827,6 +5827,54 @@
}
% \end{macrocode}
%
% \changes{unreleased}{2024/03/22}{添加 \pkg{thmtools} 宏包支持。}
% \subsubsection{\pkg{thmtools} 宏包}
%
% 使用 \pkg{tocloft} 包设置 \tn{listoftheorems} 的样式。
% \begin{macrocode}
\ctex_at_end_package:nn { thmtools }
{
\newlistentry { thm } { loe } { 0 }
\newcounter { loedepth }
\setcounter { loedepth } { 1 }
\skip_set:Nn \cftthmnumwidth { 2.3 em }
\define@key { thmt-listof } { numwidth }
{ \skip_set:Nn \cftthmnumwidth {#1} }
\cs_set:Npn \thmtlo@newentry
{ \cs_set_eq:cN { l@ \thmt@envname } \l@thm }
\cs_set:Npn \thmtlo@chaptervspacehack { }
\RenewDocumentCommand \listoftheorems { s O{ } }
{
\group_begin:
\setlisttheoremstyle {#2}
\IfBooleanTF {#1}
{ \SJTU@head* { \listtheoremname } }
{ \SJTU@head { \listtheoremname } }
\cs_set:Npn \contentsline ##1
{ \use:c { thmt@contentsline@ ##1 } {##1} }
\clist_map_inline:Nn \thmt@allenvs
{
\tl_set:Nn \thmt@envname {##1}
\thmtlo@newentry
}
\@fileswfalse
\AddToHook { enddocument / afterlastpage }
{
\if@filesw
\@ifundefined { tf@loe }
{
\expandafter\newwrite\csname tf@loe\endcsname
\immediate\openout \csname tf@loe\endcsname \jobname.loe\relax
} { }
\fi
}
\cs_set:Npn \makebox [##1][##2]##3 { \, ##3 }
\@starttoc { loe }
\group_end:
}
}
% \end{macrocode}
%
% \subsubsection{\pkg{algorithm} 宏包和 \pkg{algorithm2e} 宏包}
%
% \begin{macrocode}
Expand Down

0 comments on commit ca64c68

Please sign in to comment.