1 #\DeclareLyXModule{Standard Theorems (Numbered by Chapter)}
2 #\DeclareCategory{Maths}
4 #Numbers theorems and the like by chapter (i.e., the counter is reset at
5 #each chapter start). Use this module only with document classes that provide a chapter
8 #Requires: theorems-std
9 #Excludes: theorems-sec
11 # Author: Richard Kimberly Heck <rikiheck@lyx.org>
12 # Edited sep '22 by Udi Fogiel <udifoglle@gmail.com>
24 \def\lyx@reverse@two#1#2{#2#1}
26 \def\lyx@definition{definition}
27 \def\lyx@remark{remark}
28 \newcommand\theoremstyle[1]{%
30 \ifx\lyx@style\lyx@plain
31 \def\lyx@headfont{\bfseries}%
32 \def\lyx@bodyfont{\itshape}%
34 \ifx\lyx@style\lyx@definition
35 \def\lyx@headfont{\bfseries}%
36 \def\lyx@bodyfont{\upshape}%
38 \ifx\lyx@style\lyx@remark
39 \def\lyx@headfont{\itshape}%
40 \def\lyx@bodyfont{\upshape}%
46 \@begintheorem{\normalfont\csname lyx@\@firstoftwo#2@headfont\endcsname \@secondoftwo#2}{\begingroup\upshape\csname the#1\endcsname\endgroup.}\normalfont\csname lyx@\@firstoftwo#2@bodyfont\endcsname\ignorespaces
49 \@opargbegintheorem{\normalfont{\csname lyx@\@firstoftwo#2@headfont\endcsname \@secondoftwo#2}}{\begingroup\csname lyx@\@firstoftwo#2@headfont\endcsname\upshape\csname the#1\endcsname\endgroup}{#3\lyx@reverse@two{\begingroup\normalfont\csname lyx@\@firstoftwo#2@headfont\endcsname.\endgroup}}\normalfont\csname lyx@\@firstoftwo#2@bodyfont\endcsname\ignorespaces
51 \def\lyx@othm#1[#2]#3{\@othm{#1}[#2]{{#1}{#3}}}
52 \def\lyx@nthm#1#2{\@ifnextchar[{\@xnthm{#1}{{#1}{#2}}}{\@ynthm{#1}{{#1}{#2}}}}
53 \renewcommand\newtheorem[1]{%
54 \expandafter\let\csname lyx@#1@headfont\expandafter\endcsname\lyx@headfont
55 \expandafter\let\csname lyx@#1@bodyfont\expandafter\endcsname\lyx@bodyfont
56 \@ifnextchar[{\lyx@othm{#1}}{\lyx@nthm{#1}}}
57 \newcommand\lyx@starred@newtheorem[2]{\newtheorem{#1}{#2}\expandafter\def\csname the#1\endcsname{\unskip}}
58 \newcommand\lyx@reg@newtheorem[2]{\newtheorem{#1}[thm]{#2}}
59 \newcommand\lyx@newtheorem{\@ifstar{\lyx@starred@newtheorem}{\lyx@reg@newtheorem}}
61 \ifcsname c@chapter\endcsname
63 \newtheorem{thm}{\protect\theoremname}
65 \newtheorem{thm}{\protect\theoremname}[chapter]
68 \newtheorem{thm}{\protect\theoremname}