1

I want to do something like this:

\begin{theorem}[Actual name of theorem]
This theorem states that...
\end{theorem}

and it should render:

Actual name of theorem. This theorem states that...

I changed the name of theorem by creating a theorem-like environment, but I want to do this one in line, without creating a new environment.

2

It is unclear from the question whether no new environment is to be created, on the one hand, or whether multiple new environments, one for each separate named theorem, are to be created.

Assuming the latter, perhaps something like this?

\documentclass{book}

\usepackage{amsthm}
\usepackage{thmtools}

\declaretheorem[name=Theorem,numberwithin=chapter]{theorem}

\makeatletter
\declaretheoremstyle[
  headfont=\bfseries,
  headindent=-0.25em,
  postheadspace=0.5em,
  notefont=\bfseries, 
  notebraces={}{},
  headformat=\NOTE\thmt@space\NUMBER,
  bodyfont=\mdseries\itshape,
  spaceabove=12pt,spacebelow=12pt,
]{namedthmstyle}
\makeatother

\declaretheorem[
  style=namedthmstyle,
  name=Theorem,
  title = {},
  numberlike=theorem
]{namedtheorem}

\begin{document}

\chapter{The whole thing}

\begin{namedtheorem}[Theorem of Pythagoras]

The square on the hypotenuse of a right triangle equals the sum of the squares other two sides.

\end{namedtheorem}

\begin{namedtheorem}[Fermat's Last Theorem]

For $n > 2$, there are no positive integers $a, b, c$ for which $a^{n} + b^{n} = c^{n}$.

\end{namedtheorem}

\end{document}

Named theorems

Note that I had to "fake" making the namedtheorem name typeset essentially flush with the left margin by using headindent=-0.25em. Surely there's a better—and more precise—way to accomplish that.

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.