I'm using LyX with "Theorems (AMS, numbered by type)" and "Theorems (AMS-extended, numbered by type)" modules. I would like to have the following output:

Axiom 1. Lorem.

Axiom 1'. Ipsum.

Is there a way to do this using LyX modules + ERT? In this link (Custom enumeration for axioms or hypothesis), someone made this in pure TeX. Since I'm a begginer, I don't know how to use this to solve my problem. Maybe the solution is to edit LyX's theorem module file, but I have no idea how to do this. In this other link (How to make "claim" environments look like "theorem" environment?) there's an example of editing LyX module files to get what you want.


Add the following in your Local Layout of LyX (Document > Settings... > Local Layout):

#Defines Axiomp (primed axioms)
#Requires: theorems-ams-extended
#Category: theorems

Format 35

Requires    amsmath

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

Style Axiomp
    CopyStyle             Theorem
    DependsOn               Theorem
    LatexName             axp
    LabelString           "Axiom \theaxp."

The click validate to add Axiomp to your list of styles. While your display may resemble

enter image description here

your output should result in

enter image description here

If you wish to have more control over the numbering, then you can add the following to your Document > Settings > LaTeX Preamble:


\def\@@thm#1#2#3{% modified from original \@thm
  \thm@headpunct{.}% add period after heading
  \thm@headsep 5\p@ plus\p@ minus\p@\relax
  #1% style overrides
  \@topsep \thm@preskip               % used by thm head
  \@topsepadd \thm@postskip           % used by \@endparenv
    \def\@tempa{\@oparg{\@@begintheorem{#3}{\csname the#2\endcsname}}[]}%

  \deferred@thm@head{\the\thm@headfont \thm@indent
    \thmheadnl % possibly a newline.

It modifies the theorem environment associated with primed axioms (axp) to reroute to a specialized \@@thm and \@@begintheorem constructions. Input of the form

enter image description here

yields as output

enter image description here

The use of an ERT for the optional argument is required, as is mentioned in the LyX wiki How to add optional arguments to environments:

Many LaTeX environments accept optional arguments that influence their behavior. The theorem environment, for example, accepts an optional argument that is typeset after the theorem number, often used for the name of the theorem or to give credit to its discoverer. In LaTeX, this would be written thus: \begin{theorem}[Cohen, 1961] or \begin{theorem}[Schröder-Bernstein Theorem], with results like these:

Theorem 1.1 (Cohen, 1961).
Theorem 1.2 (Schröder-Bernstein Theorem).

LyX offers no obvious way to do this, but in fact it is quite simple. All you need to do is enter the optional argument as ERT immediately following the appearance of "Theorem 1.2", or whatever, in LyX. It works because the optional argument follows the environment declaration.

  • 1
    +1 Nice. @LuizMMB note that anything you can do in a local layout you can also copy to a module. Local layouts are more portable (if you send to someone) because you do not have to remember to send the module. Modules however have the advantage that you can have a central module and then use it in many documents. See Help > Customization for more information. – scottkosty Nov 30 '13 at 20:24
  • Werner, thanks. I tried to explain my problem in simple terms but, because of this, I left some important information out. I'm sorry. Actually, I want to have the following output: Axiom 6. Text. (paragraph) Normal text. (paragraph) Axiom 7. Text. (paragraph) Normal text. (paragraph) Axiom 6'. Text. / With your code, I got the following: Axiom 6. Text. (paragraph) Normal text. (paragraph) Axiom 7. Text. (paragraph) Normal text. (paragraph) Axiom 2'. Text. / (Don't worry about starting the axiom counting from 6. I'm just describing the output that I want of part of the document.) – LuizMMB Dec 2 '13 at 16:38
  • 1
    @LuizMMB: I've updated my answer to allow for ad-hoc numbering of primed axioms. – Werner Mar 29 '14 at 0:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.