0

Lyx/Latex beginner here. I'm using Lyx with an AMS article document class.

How do I add a new type of math environment such as Axiom? They have Theorem, Definition, Proposition, etc. but I want axiom, and I want it to be numbered (and possibly also a non-numbered version). I'd like it to popup in the environment menu in the top left under Reasoning just like Theorem and Definition do.

This answer does something related but it is a bit more involved than this and I can't figure out how to isolate the simple part from the other things they are doing there.

Thanks!

1
  • 2
    It is easy enough to just add \newtheorem{axiom}[theorem]{Axiom} \newtheorem*{axiom}{Axiom} to the preamble (Document -> Settings -> LaTeX preamble). But LyX does not seem to generate a nice interface for it. (NB: I don't use LyX as I have other requirements)
    – daleif
    Apr 27, 2022 at 15:39

1 Answer 1

0

Actually it seems I was able to get this to work by adapting the other answer, though I don't really understand it. Here's what I used.

#\DeclareLyXModule{Other}
#DescriptionBegin
#Defines Axiomp (primed axioms)
#DescriptionEnd
#Requires: theorems-ams-extended
#Category: theorems

Format 66

Requires    amsmath

# The environments defined (regular and starred) are :
# - Axiomp

Style Axiomp
    CopyStyle             Theorem
    DependsOn               Theorem
    LatexName             axp
    LabelString           "Axiom"
    Preamble
      \usepackage{etoolbox}
      \theoremstyle{plain}
      \newtheorem{axp}{\protect\axiomname}
      \makeatletter
      \makeatother
    EndPreamble
    LangPreamble
      \providecommand{\axiomname}{_(Axiom)}
    EndLangPreamble
    BabelPreamble
      \addto\captions$$lang{\renewcommand{\axiomname}{_(Axiom)}}
    EndBabelPreamble
End
2
  • Could you explain how I can change this in order to add numbering as well? To fit the numbering of the other environments (such as 'Theorem')
    – GSofer
    Aug 4, 2022 at 5:58
  • Note that \usepackage{etoolbox},\makeatletter and \makeatother are redundant and you don't need them in the preamble. They served a purpose in the linked solution, but not anymore.
    – Udi Fogiel
    Aug 4, 2022 at 15:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .