Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

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*.

share|improve this answer
    
Thank you. This is precisely I was looking for. –  yrudoy Aug 5 '12 at 17:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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