]> git.lyx.org Git - lyx.git/blob - lib/layouts/theorems-bytype.module
New Theorems Module. Contributed by Udicoudco <udifoglle@gmail.com> on the mailing...
[lyx.git] / lib / layouts / theorems-bytype.module
1 #\DeclareLyXModule{Standard Theorems (Numbered by Type)}
2 #\DeclareCategory{Maths}
3 #DescriptionBegin
4 #Defines some theorem environments for use with non-AMS classes. Contrary to the
5 #plain Theorem module, the different theorem types provided here each have a separate
6 #counter (e.g., theorem 1, theorem 2, lemma 1, proposition 1, theorem 3, lemma 2, ...,
7 #as opposed to theorem 1, theorem 2, lemma 3, proposition 4, ...).
8 #The numbering's scope is the whole document. For chapter- and section-wide numbering,
9 #use one of the 'within Sections'/'within Chapters' modules, respectively.
10 #DescriptionEnd
11 #Excludes: theorems-std | theorems-ams | theorems-ams-bytype
12
13 # Author: Paul Rubin <rubin@msu.edu> (hacked from Richard Kimberly Heck's theorems-std.module)
14 # Edited sep '22 by Udi Fogiel <udifoglle@gmail.com>
15
16 Format 99
17
18 Input theorems-counters-bytype.inc
19 Input theorems.inc
20 Input theorems-labels.inc
21 Input theorems-proof-std.inc
22
23 Style Theorem
24         Preamble
25                 \def\lyx@reverse@two#1#2{#2#1}
26                 \def\lyx@plain{plain}
27                 \def\lyx@definition{definition}
28                 \def\lyx@remark{remark}
29                 \newcommand\theoremstyle[1]{%
30                         \def\lyx@style{#1}%
31                         \ifx\lyx@style\lyx@plain
32                                 \def\lyx@headfont{\bfseries}%
33                                 \def\lyx@bodyfont{\itshape}%
34                         \else
35                                 \ifx\lyx@style\lyx@definition
36                                         \def\lyx@headfont{\bfseries}%
37                                         \def\lyx@bodyfont{\upshape}%
38                                 \else
39                                         \ifx\lyx@style\lyx@remark
40                                                 \def\lyx@headfont{\itshape}%
41                                                 \def\lyx@bodyfont{\upshape}%
42                                         \fi
43                                 \fi
44                         \fi
45                 }
46                 \def\@xthm#1#2{%
47                         \@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                 }
49                 \def\@ythm#1#2[#3]{%
50                         \@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                 }
52                 \def\lyx@othm#1[#2]#3{\@othm{#1}[#2]{{#1}{#3}}}
53                 \def\lyx@nthm#1#2{\@ifnextchar[{\@xnthm{#1}{{#1}{#2}}}{\@ynthm{#1}{{#1}{#2}}}}
54                 \renewcommand\newtheorem[1]{%
55                         \expandafter\let\csname lyx@#1@headfont\expandafter\endcsname\lyx@headfont
56                         \expandafter\let\csname lyx@#1@bodyfont\expandafter\endcsname\lyx@bodyfont
57                         \@ifnextchar[{\lyx@othm{#1}}{\lyx@nthm{#1}}}
58                 \newcommand\lyx@starred@newtheorem[2]{\newtheorem{#1}{#2}\expandafter\def\csname the#1\endcsname{\unskip}}
59                 \newcommand\lyx@reg@newtheorem[2]{\newtheorem{#1}{#2}}
60                 \newcommand\lyx@newtheorem{\@ifstar{\lyx@starred@newtheorem}{\lyx@reg@newtheorem}}
61                 \theoremstyle{plain}
62                 \newtheorem{thm}{\protect\theoremname}
63         EndPreamble
64 End