1 #\DeclareLyXModule{Standard Theorems (Numbered by Section)}
2 #\DeclareCategory{Maths}
4 #Numbers theorems and the like by section (i.e., the counter is reset at
7 #Requires: theorems-std
8 #Excludes: theorems-chap
10 # Author: Richard Kimberly Heck <rikiheck@lyx.org>
11 # Edited sep '22 by Udi Fogiel <udifoglle@gmail.com>
23 \def\lyx@reverse@two#1#2{#2#1}
25 \def\lyx@definition{definition}
26 \def\lyx@remark{remark}
27 \newcommand\theoremstyle[1]{%
29 \ifx\lyx@style\lyx@plain
30 \def\lyx@headfont{\bfseries}%
31 \def\lyx@bodyfont{\itshape}%
33 \ifx\lyx@style\lyx@definition
34 \def\lyx@headfont{\bfseries}%
35 \def\lyx@bodyfont{\upshape}%
37 \ifx\lyx@style\lyx@remark
38 \def\lyx@headfont{\itshape}%
39 \def\lyx@bodyfont{\upshape}%
45 \@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
48 \@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
50 \def\lyx@othm#1[#2]#3{\@othm{#1}[#2]{{#1}{#3}}}
51 \def\lyx@nthm#1#2{\@ifnextchar[{\@xnthm{#1}{{#1}{#2}}}{\@ynthm{#1}{{#1}{#2}}}}
52 \renewcommand\newtheorem[1]{%
53 \expandafter\let\csname lyx@#1@headfont\expandafter\endcsname\lyx@headfont
54 \expandafter\let\csname lyx@#1@bodyfont\expandafter\endcsname\lyx@bodyfont
55 \@ifnextchar[{\lyx@othm{#1}}{\lyx@nthm{#1}}}
56 \newcommand\lyx@starred@newtheorem[2]{\newtheorem{#1}{#2}\expandafter\def\csname the#1\endcsname{\unskip}}
57 \newcommand\lyx@reg@newtheorem[2]{\newtheorem{#1}[thm]{#2}}
58 \newcommand\lyx@newtheorem{\@ifstar{\lyx@starred@newtheorem}{\lyx@reg@newtheorem}}
60 \ifcsname c@section\endcsname
62 \newtheorem{thm}{\protect\theoremname}
64 \newtheorem{thm}{\protect\theoremname}[section]
67 \newtheorem{thm}{\protect\theoremname}