]> git.lyx.org Git - lyx.git/blob - lib/layouts/theorems-std.module
New Theorems Module. Contributed by Udicoudco <udifoglle@gmail.com> on the mailing...
[lyx.git] / lib / layouts / theorems-std.module
1 #\DeclareLyXModule{Standard Theorems}
2 #\DeclareCategory{Maths}
3 #DescriptionBegin
4 #Defines some theorem environments for use with non-AMS classes. By default, 
5 #the theorems are numbered consecutively throughout the document. This can be
6 #changed by loading one of the 'Theorems (Numbered by ...)' modules.
7 #DescriptionEnd
8 #Excludes: theorems-ams | theorems-ams-bytype | theorems-bytype
9
10 # Author: Richard Kimberly Heck <rikiheck@lyx.org>
11 # Edited sep '22 by Udi Fogiel <udifoglle@gmail.com>
12
13 Format 99
14
15 Counter theorem
16         GuiName Theorem
17         LaTeXName thm
18 End
19
20 Input theorems.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}[thm]{#2}}
60                 \newcommand\lyx@newtheorem{\@ifstar{\lyx@starred@newtheorem}{\lyx@reg@newtheorem}}
61                 \theoremstyle{plain}
62                 \newtheorem{thm}{\protect\theoremname}
63         EndPreamble
64 End