3

Is there some way to get a theorem type which will make a theorem with the name passed as a parameter? In other words, is there a way to define "named" such that

\begin{named}[NAME]
text
\end{named}

will print

"NAME: text"?

I tried using the definition \newtheorem*{named}{}, but that results in

"(NAME): text", which is quite different from what I am trying to do.

I know that I could also create a new instance of \newtheorem for each named theorem I want to use, but that is clunky and inconvenient. Is there a better way?

1 Answer 1

8

Here's one possible solution using thmtools as a front-end for amsthm:

\documentclass{article}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{lipsum}

\declaretheoremstyle[
spaceabove=\topsep, spacebelow=\topsep,
headfont=\normalfont\bfseries,
notefont=\bfseries, notebraces={}{},
bodyfont=\normalfont\itshape,
postheadspace=0.5em,
name={\ignorespaces},
numbered=no,
headpunct=:]
{mystyle}
\declaretheorem[style=mystyle]{named}

\begin{document}

\begin{named}[NAME]
\lipsum[4]
\end{named}

\begin{named}[OTHERNAME]
\lipsum[4]
\end{named}

\end{document}

enter image description here

And without using thmtools, you can say something like:

\documentclass{article}
\usepackage{amsthm}
\usepackage{lipsum}

\makeatletter
\newtheoremstyle{mystyle}%
{\topsep}{\topsep}
{\itshape}{}
{\bfseries}{:}
{0.5em}
{\thmname{\@ifempty{#3}{#1}\@ifnotempty{#3}{\MakeUppercase{#3}}}}
\makeatother

\theoremstyle{mystyle}
\newtheorem*{named}{NAME}% here the second argument is the default name

\begin{document}

\begin{named}
\lipsum[4]
\end{named}

\begin{named}[Othername]
\lipsum[4]
\end{named}

\end{document}

enter image description here

With the second approach, you can set the default name for the structure in the second argument of \newtheorem*.

0

You must log in to answer this question.

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