4

I am using the following environment to write axioms in my thesis

\theoremstyle{definition}  
\newtheorem{myax}{Axiom}

As expected, if I write

\beging{myax}[Axiom of Choice]
\end{myax}

I get

Axiom 1(Axiom of Choice)

I was wondering if I could display bold the text in [ ], hiding the rest (Axiom 1)

Thanks in advance

I am using the folllowing code

\usepackage{amsthm}

\theoremstyle{plain}
\newtheorem{myth}{Theorem}[section]
\newtheorem{myprop}[myth]{Proposition}
\newtheorem{mylemma}[myth]{Lemma}

\theoremstyle{definition}
\newtheorem{mydef}{Definition}[section]
\newtheorem{myax}{Axiom}

\theoremstyle{remark}
\newtheorem{myrmk}{Remark}[section]
\newtheorem{myex}{Example}[section]

Code with ntheorem

\usepackage[amsmath,thmmarks]{ntheorem}
\theoremheaderfont{\bfseries\upshape}
\theorembodyfont{\itshape}
\theoremseparator{. }
%%%%%%%%%
\theoremstyle{emptybreak}
\theorembodyfont{\upshape}
\setlength{\labelsep}{0pt}
\newtheorem{myax}
%%%%%%%%%%
\theoremstyle{plain}
\newtheorem{myth}{Theorem}[section]
\newtheorem{myprop}[myth]{Proposition}
\newtheorem{mylemma}[myth]{Lemma}
%%%%%%%%%%
\theoremstyle{plain}
\theorembodyfont{\upshape}
\newtheorem{mydef}{Definition}[section]
%%%%%%%%%%%%%%%%%    
\makeatletter
\newtheoremstyle{remark}
{\item[\hskip\labelsep\theorem@headerfont ##1\ \textup{##2}\theorem@separator]}
{\item[\hskip\labelsep \theorem@headerfont ##1\ \textup{##2}\ (##3)\theorem@separator]}
\makeatother
\theoremstyle{remark}
\theoremheaderfont{\itshape}
\newtheorem{myrmk}{Remark}[section]
\newtheorem{myex}{Example}[section]
%%%%%%%%%%%%%%%%%    
\theoremstyle{nonumberplain}
\theoremheaderfont{\itshape}
\theorembodyfont{\normalfont}
\theoresymbol{\ensuremath\square}
\newtheorem{proof}{Proof}

\usepackage{cleveref}
\crefname{myth}{Theorem}
\crefalias{Myth}{myth}
\crefname{myprop}{Proposition}
\crefalias{Myprop}{myprop}
\crefname{mylemma}{Lemma}
\crefalias{Mylemma}{mylemma}
\crefname{mydef}{Definition}
\crefalias{Mydef}{mydef}
\crefname{myrmk}{Remark}
\crefalias{Myrmk}{myrmk}
\crefname{myex}{Example}
\crefalias{Myex}{myex}
\crefname{myax}{Axiom}
\crefalias{Myax}{myax}

\begin{document}
\begin{myth}
 My theorem.
\end{myth}
\end{document}
0

4 Answers 4

2

It is very easy with ntheorem which defines the empty and emptybreakstyles. These styles define no counter nor header: only the optional argument is printed.

\documentclass[11pt]{article}
\usepackage{ntheorem}
\theoremstyle{empty}
\theoremheaderfont{\bfseries\upshape} 
\theorembodyfont{\itshape}
\setlength{\labelsep}{0pt}
\newtheorem{named}{}

\theoremstyle{emptybreak}
\newtheorem{namedbreak}{}

\begin{document}

\begin{named}[Axiom of choice. ] If $X$ is a set of nonempty sets, there exists a function $f$ on $X$ such that, for any $A\in X$, one has $f(A)\in A$.
\end{named}

\begin{namedbreak}[Dr Faustroll’s axiom]
  God is the tangential point of $0$ and $\infty$.
\end{namedbreak}

\end{document}

enter image description here

Edit: To have the same layout with ntheorem as with the basic styles of amsthm, use this in the preamble:

\usepackage{ntheorem}

\theoremheaderfont{\bfseries\upshape}
\theorembodyfont{\itshape}
\theoremseparator{. }

%%%%%%%%%
\theoremstyle{empty}
\setlength{\labelsep}{0pt}
\newtheorem{named}{}

\theoremstyle{emptybreak}
\newtheorem{namedbreak}{}
%%%%%%%%%%
\theoremstyle{plain}

\newtheorem{myth}{Theorem}[section]
\newtheorem{myprop}[myth]{Proposition}
\newtheorem{mylemma}[myth]{Lemma}

\theoremstyle{definition}
\theorembodyfont{\upshape}
\newtheorem{mydef}{Definition}[section]

%%%%%%%%%%%%%%%%%    
\makeatletter
 \newtheoremstyle{remark}%
{\item[\hskip\labelsep \theorem@headerfont ##1\ \textup{##2}\theorem@separator]}%
{\item[\hskip\labelsep \theorem@headerfont ##1\ \textup{##2}\ (##3)\theorem@separator]}
\makeatother
\theoremstyle{remark}
\theoremheaderfont{\itshape}
\newtheorem{myrmk}{Remark}[section]
\newtheorem{myex}{Example}[section]

Edit: I cleaned your last code and made it fully functional. In particular, when you declare a theorem structure, say mytheorem, with the empty style, you have to write \newtheorem{mytheorem}{}(with a last empty argument).

\documentclass[11pt]{article}
\usepackage{amsmath, amssymb}
\usepackage[amsmath,thref, thmmarks]{ntheorem}%
\theoremheaderfont{\normalfont\bfseries}
\theoremseparator{. }
%%%%%%%%%
\theoremstyle{emptybreak}
\theorembodyfont{\normalfont}
\setlength{\labelsep}{0pt}
\newtheorem{myax}{}
%%%%%%%%%
\theoremstyle{plain}
\theorembodyfont{\itshape}
\newtheorem{myth}{Theorem}[section]
\newtheorem{myprop}[myth]{Proposition}
\newtheorem{mylemma}[myth]{Lemma}
%%%%%%%%%%%
\theorembodyfont{\normalfont}
\newtheorem{mydef}{Definition}[section]
%%%%%%%%%%%%%%%%%%
\makeatletter
\newtheoremstyle{remark}
{\item[\hskip\labelsep\theorem@headerfont ##1\ \textup{##2}\theorem@separator]}
{\item[\hskip\labelsep \theorem@headerfont ##1\ \textup{##2}\ (##3)\theorem@separator]}
\makeatother
\theoremstyle{remark}
\theoremheaderfont{\itshape}
\newtheorem{myrmk}{Remark}[section]
\newtheorem{myex}{Example}[section]
%%%%%%%%%%%%%%%%%
\theoremstyle{nonumberplain}
\theoremsymbol{\ensuremath\square}
\newtheorem{proof}{Proof}
%%%%%%%%%%%%%%%%%%%%%
\usepackage{cleveref}
\crefname{myth}{Theorem}{Theorems}
\crefalias{Myth}{myth}
\crefname{myprop}{Proposition}{Propositions}
\crefalias{Myprop}{myprop}
\crefname{mylemma}{Lemma}{Lemmas}
\crefalias{Mylemma}{mylemma}
\crefname{mydef}{Definition}{Definitions}
\crefalias{Mydef}{mydef}
\crefname{myrmk}{Remark}{Remarks}
\crefalias{Myrmk}{myrmk}
\crefname{myex}{Example}{Examples}
\crefalias{Myex}{myex}
\crefname{myax}{Axiom}{Axioms}
\crefalias{Myax}{myax}

\begin{document}

\begin{mydef}
 \textbf{Egotist}, n. A person of low taste, more interested in him\-self than in me.
\end{mydef}
\begin{myth}
 My theorem.
\end{myth}

\begin{proof}
 \[ \text{Fiddle dee dee!} \]
\end{proof}

\end{document}

enter image description here

13
  • Actually I thought yours was the solution but I am having some problems: if I use \ntheorem together with \amsthm there is a conflict. I tried to change everything to \ntheorem, following the package intrsuction, but all of my code is written in \amsthm: the compiler signals somethig like 270 errors! The code I am using is the one I added to the question: do you know how to replace it? Commented Aug 31, 2019 at 21:22
  • 1
    In general, it's not very hard, but may take some time verifying all layout details. I'll look at your code and make some tests before I propose a code.
    – Bernard
    Commented Aug 31, 2019 at 21:32
  • @Sebastiano: Actually I did click on the button, but I forgot to check there was a blank line inserted at the beginning of the code. Thanks!
    – Bernard
    Commented Aug 31, 2019 at 22:01
  • @FrancescoBilotta: I've added a code to obtain the same layout as amsthm. I has to define a remark style, as the header font being italic resulted in remarks numbers also being italic. I didn't define a proof environment, as you didn't define one, but if you need it, feel free to ask.
    – Bernard
    Commented Aug 31, 2019 at 22:38
  • @FrancescoBilotta: You can achive what you want via amsthm too: see, for example, Theorem without numbering.
    – GuM
    Commented Sep 1, 2019 at 0:05
4

You can do it with amsthm (better than ntheorem, in my opinion).

\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{xparse}
\usepackage{hyperref}
\usepackage{cleveref}

\newtheorem{inneraxiom}{Axiom}
\newtheorem*{inneraxiomnonumber}{\axiomname}
\providecommand{\axiomname}{}

\makeatletter
\NewDocumentEnvironment{axiom}{o}
 {%
  \IfNoValueTF{#1}
    {\inneraxiom}% no optional argument, nothing special
    {% optional argument
     \renewcommand{\axiomname}{#1}% set \axiomname to #1
     \def\@currentlabel{#1}% for \ref
     \inneraxiomnonumber% start the unnumbered environment
    }%
 }
 {\IfNoValueTF{#1}{\endinneraxiom}{\endinneraxiomnonumber}}
\makeatother

\begin{document}

\begin{axiom}\label{axiom:standard}
This is a standard axiom.
\end{axiom}

\begin{axiom}[Francesco's axiom]\label{axiom:francesco}
All axioms are useful.
\end{axiom}

\cref{axiom:standard}

\ref{axiom:francesco}

\end{document}

It makes little sense to use \cref for named axioms.

enter image description here

3

amsthm provides a starred version of \newtheorem that substitutes the specified argument for the usual numbered heading. So this definition would produce the heading you want:

\theoremstyle{definition}
\newtheorem*{axch}{Axiom of Choice}

Of course, the heading is now fixed, so if a different "specific" heading is wanted, a separate \newtheorem* is needed.

This is described on page 3 of the amsthm user guide (texdoc amsthdoc).

2

Seeing that this question has been reopened, I’ve thought that, after all, I could elaborate on this comment and offer a solution that relies only on the amsthm package.

As Barbara Beeton has already remarked in her answer, the *-form of the \newtheorem command does not create a counter associated with the environment being defined, and so yields theorems (or lemmas, propositions, definitions…) that are not numbered, but are labeled with the text specified in the second argument of the \newtheorem* command, unadorned. For example, it is typical to see in a paper the following declaration:

\newtheorem*{MT}{Main Theorem}

This creates an environment named MT that one uses to state the main result of the paper:

\begin{MT}
    My research deserves to be funded.
\end{MT}

As already noted by Barbara, this has the drawback (but is it really a drawback?) that you need to define a different environment for each “named” theorem (or axiom, or…) that you want to mention.

Bernard asks in a comment whether it is possible to define — using only amsthm’s features — an environment for a “generic” unnumbered theorem, that uses, for the label, not the text specified in the second argument of the \newtheorem* command, but the contents of the optional argument of the environment itself, i.e., the argument meant to pass an “optional note” for the theorem header. The answer is affirmative, but you need to define a new “theorem style” by means of the \newtheoremstyle declaration.

The \newtheoremstyle command is described in Subsection 4.3 of the manual of the amsthm package. In its ninth argument you can indicate how the header that labels the theorem/axiom/… is built from the following three pieces:

  1. The theorem’s name (e.g., “Theorem”, “Lemma”, “Axiom”…): this is the text specified in the second argument of the \newtheorem (or \newtheorem*) command.

  2. The theorem’s number: this is the current value of the counter associated to the environment (more precisely, it is the expansion of, say, \theaxiom, if axiom is the name of the counter, which is the same as that of the environment).

  3. The theorem’s optional note: these are the contents of the optional argument of the environment.

More precisely (quoting from amsclass.dtx), the ninth argument of \newtheoremstyle

…is interpreted as the replacement text for an internal three-argument function \thmhead, i.e., as if you were defining

\renewcommand{\thmhead}[3]{...#1...#2...#3...}

but omitting the initial \renewcommand{\thmhead}[3]. The three arguments that will be supplied to \thmhead are the name, number, and optional note component.

For more information, see the file amsclass.dtx. The above information suffices to see that, for example,

\newtheoremstyle{emptyplain}
    {}          % default space above
    {}          % default space below
    {\itshape}  % body font
    {}          % no indent
    {\bfseries} % theorem head font
    {.}         % punctuation after theorem head
    { }         % space after theorem head (normal interword space)
    {#3}        % using "\thmnote{#3}" is redundant, isn't it?
\theoremstyle{emptyplain}
\newtheorem*{namedaxiom}{}

does what Bernard asked for: it defines a “generic unnumbered theorem-like” environment that uses, for the the theorem head, the sheer contents of the optional note.

MWE that recaps all what we have being saying:

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{amsmath}
\usepackage{amsthm}

% I deem axioms should typeset like plain theorems...
% \theoremstyle{definition}
\newtheorem{axiom}{Axiom}
\newtheorem*{AC} {Axiom of Choice}
\newtheorem*{GCH}{Generalized Continuum Hypothesis}

\newtheoremstyle{emptyplain}
    {}          % default space above
    {}          % default space below
    {\itshape}  % body font
    {}          % no indent
    {\bfseries} % theorem head font
    {.}         % punctuation after theorem head
    { }         % space after theorem head (normal interword space)
    {#3}        % using "\thmnote{#3}" is redundant, isn't it?
\theoremstyle{emptyplain}
\newtheorem*{namedaxiom}{}



\begin{document}

A few ``generic'' axioms:

\begin{axiom}[Union set]
    If $x$ and~$y$ are sets, then $x\cup y$ is also a set.
\end{axiom}

\begin{axiom}[Power set]
    If $x$ is a set, then $\wp(x)$ is also a set.
\end{axiom}

A named axiom:

\begin{AC}
    Blah blah blah\ldots
\end{AC}

Another one:

\begin{GCH}[a.k.a.\ Cantor's Aleph Hypothesis]
    For every ordinal~$\alpha$,
    \[ \aleph_{\alpha+1} = 2^{\aleph_{\alpha}} \]
\end{GCH}

With the \texttt{emptyplain} theorem style
(and a statement that spans two lines,
so you can check that there are no stray spaces):

\begin{namedaxiom}[Francesco's Axiom of Axioms]
    All axioms are important, but some axioms are more important than others.
\end{namedaxiom}

\begin{axiom}[benchmark]
    This is an axiom.
\end{axiom}

But:

\begin{namedaxiom}
    This axiom is not correctly typeset.
\end{namedaxiom}

\end{document}

The output is:

Output of the code

You must log in to answer this question.

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