mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
42c2a25fb8
I've modified all the non-AMS theorem modules so they would be independent of packages. currently the code support \theoremstyle, but only with definition, plain and remark. I'v added a new theorem module that support the thmtools \listoftheorems. I've modified the syntax of all theorem modules, such that it would be easier to create a new one, or maintaining the ones that exists. Instead of using \newtheorem in the preamble of a lyaout, I wrote \lyx@newtheorem, and in each module I've defiened \lyx@newtheorem as fitted. This way, there is only need in the files thorems-base, and theorems-extended, instead of an .inc file for each module. I've added theorems-labels.inc, a file that suppose to be included in a "Numbered by type" module, to change the Label and the LabelCounter of the layouts in theorems-base.inc. Note that in this configuration, all non-AMS modules will clash with the AMS ones, and so as the proof versions. theorems-proof-std.inc suppose to be in the non-AMS while theorems-proof.inc should be included only in AMS variants.
65 lines
2.4 KiB
Plaintext
65 lines
2.4 KiB
Plaintext
#\DeclareLyXModule{Standard Theorems}
|
|
#\DeclareCategory{Maths}
|
|
#DescriptionBegin
|
|
#Defines some theorem environments for use with non-AMS classes. By default,
|
|
#the theorems are numbered consecutively throughout the document. This can be
|
|
#changed by loading one of the 'Theorems (Numbered by ...)' modules.
|
|
#DescriptionEnd
|
|
#Excludes: theorems-ams | theorems-ams-bytype | theorems-bytype
|
|
|
|
# Author: Richard Kimberly Heck <rikiheck@lyx.org>
|
|
# Edited sep '22 by Udi Fogiel <udifoglle@gmail.com>
|
|
|
|
Format 99
|
|
|
|
Counter theorem
|
|
GuiName Theorem
|
|
LaTeXName thm
|
|
End
|
|
|
|
Input theorems.inc
|
|
Input theorems-proof-std.inc
|
|
|
|
Style Theorem
|
|
Preamble
|
|
\def\lyx@reverse@two#1#2{#2#1}
|
|
\def\lyx@plain{plain}
|
|
\def\lyx@definition{definition}
|
|
\def\lyx@remark{remark}
|
|
\newcommand\theoremstyle[1]{%
|
|
\def\lyx@style{#1}%
|
|
\ifx\lyx@style\lyx@plain
|
|
\def\lyx@headfont{\bfseries}%
|
|
\def\lyx@bodyfont{\itshape}%
|
|
\else
|
|
\ifx\lyx@style\lyx@definition
|
|
\def\lyx@headfont{\bfseries}%
|
|
\def\lyx@bodyfont{\upshape}%
|
|
\else
|
|
\ifx\lyx@style\lyx@remark
|
|
\def\lyx@headfont{\itshape}%
|
|
\def\lyx@bodyfont{\upshape}%
|
|
\fi
|
|
\fi
|
|
\fi
|
|
}
|
|
\def\@xthm#1#2{%
|
|
\@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
|
|
}
|
|
\def\@ythm#1#2[#3]{%
|
|
\@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
|
|
}
|
|
\def\lyx@othm#1[#2]#3{\@othm{#1}[#2]{{#1}{#3}}}
|
|
\def\lyx@nthm#1#2{\@ifnextchar[{\@xnthm{#1}{{#1}{#2}}}{\@ynthm{#1}{{#1}{#2}}}}
|
|
\renewcommand\newtheorem[1]{%
|
|
\expandafter\let\csname lyx@#1@headfont\expandafter\endcsname\lyx@headfont
|
|
\expandafter\let\csname lyx@#1@bodyfont\expandafter\endcsname\lyx@bodyfont
|
|
\@ifnextchar[{\lyx@othm{#1}}{\lyx@nthm{#1}}}
|
|
\newcommand\lyx@starred@newtheorem[2]{\newtheorem{#1}{#2}\expandafter\def\csname the#1\endcsname{\unskip}}
|
|
\newcommand\lyx@reg@newtheorem[2]{\newtheorem{#1}[thm]{#2}}
|
|
\newcommand\lyx@newtheorem{\@ifstar{\lyx@starred@newtheorem}{\lyx@reg@newtheorem}}
|
|
\theoremstyle{plain}
|
|
\newtheorem{thm}{\protect\theoremname}
|
|
EndPreamble
|
|
End
|