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
|
%% ****************************************************************************************************
%% Copyright 2024 by Mingyu Hsia <xiamyphys@gmail.com> *
%% *
%% This work may be distributed and/or modified under * ***** * * *
%% the conditions of the LaTeX Project Public License * ** * * *** * * *
%% * * ** * * * ** *
%% http://www.latex-project.org/lppl.txt * * * * ***** ** *
%% * * ** * * * * *
%% either version 1.3c of this license or any later ***** ** * * *** * * *
%% version. *
%% *
%% This work has the LPPL maintenance status `maintained'. *
%% *
%% The Current Maintainer of this work is Mingyu Hsia. *
%% *
%% This work consists of the files thmlist.sty, *
%% and README.md. *
%% available at https://github.com/xiamyphys/thmlist *
%% ****************************************************************************************************
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\ProvidesPackage{thmlist}[2024/03/26/ v0.1b Package for creating amsthm environments quickly.]
\DeclareOptionX{amscounter}{\gdef\@amscounter{#1}}
\DeclareOptionX{mdfcounter}{\gdef\@mdfcounter{#1}}
\ExecuteOptionsX{amscounter=section}
\ExecuteOptionsX{mdfcounter=section}
\DeclareOptionX{amsstyle}{\gdef\@amsstyle{#1}}
\DeclareOptionX{mdfstyle}{\gdef\@mdfstyle{#1}}
\ExecuteOptionsX{amsstyle=definition}
\ExecuteOptionsX{mdfstyle=mdempty}
\DeclareOptionX{thmfont}{\gdef\@thmfont{#1}}
\ExecuteOptionsX{thmfont=\sffamily}
\DeclareOptionX*{\PackageWarning{thmlist}{`\CurrentOption' ignored}}
\ProcessOptionsX\relax
\RequirePackage{amsthm,mdframed,listofitems,pgffor}
\def\th@definition{\thm@notefont{}\normalfont}
\theoremstyle{\@amsstyle}\mdfdefinestyle{mdempty}{}
\setsepchar{;/,}\ignoreemptyitems
\def\mdflist#1{\gdef\@mdflist{#1}}
\def\amslist#1{\gdef\@amslist{#1}}
\AtBeginDocument{%
\ifcsname @mdflist\endcsname
\readlist*\mdflist{\@mdflist}
\def\@mdfnum{\listlen\mdflist[1]}
\foreach \x in {1,...,\@mdfnum}{%
\expandafter\xdef\csname\x\x\endcsname{\noexpand
\newmdtheoremenv[linecolor=\mdflist[3,\x],style=\@mdfstyle]{\mdflist[1,\x]}
{\noexpand\color{\mdflist[3,\x]}\noexpand\@thmfont{\mdflist[2,\x]}}[\@mdfcounter]}\csname\x\x\endcsname}
\fi
\ifcsname @amslist\endcsname
\readlist*\amslist{\@amslist}
\def\@amsnum{\listlen\amslist[1]}
\foreach \x in {1,...,\@amsnum}{%
\expandafter\xdef\csname\x\x\endcsname{\noexpand
\newtheorem{\amslist[1,\x]}
{\noexpand\color{\amslist[3,\x]}\noexpand\@thmfont{\amslist[2,\x]}}[\@amscounter]}\csname\x\x\endcsname}
\fi
}
|