7

I switched from using the standard AMS theorem package to ntheorem so I can put alternative end marks on theorem environments (I want my examples to have an end mark, but not the same one as proofs). However, this seems to be causing another problem.

Many of my examples have subtitles, by which I mean I start them with
\begin{example}[subtitle], where the subtitle is some description of the example. Some of these subtitles are long enough that they need multiple lines, which works fine with the standard AMS environment. On the other hand ntheorem seems to try to set the subtitle all on one line, giving an overfull \hbox whenever it is long enough that it should span multiple lines (I'm not talking a character or two wider than it knows how to deal with like a usual overfull \hbox, I mean they go through the whole margin and off the page).

This can be reproduced by

\documentclass[12pt]{article}  
\usepackage{amsmath}
\usepackage[thmmarks,amsmath,amsthm,thref]{ntheorem}
\newtheorem{example}{Example}
\begin{document}
\begin{example}[blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah]
Content
\end{example}
\end{document}

Is this a bug in ntheorem or am I doing something wrong? Perhaps this is an abuse of the subtitle field. Is there a simple fix?

2
  • the ability to attach a symbol to the end of some object other than a proof is being requested more and more frequently, and is on the ams list of things to be considered in the next upgrade of amsthm. in the meantime, take a look at ams.org/faq?faq_id=212 and at my comments on a couple of the answers to this question about qedhere for suggested workarounds. Mar 28, 2011 at 17:59
  • @barbara beeton: Thank you. I didn't see those when I searched earlier because I thought the problem was specific to ntheorem.
    – Noah Stein
    Mar 28, 2011 at 19:08

1 Answer 1

3

No; it's not a bug, although it could be considered a bad design choice; ntheorem uses the optional argument of \item to typeset the theorem header (name, number and annotation), and that causes the problem (I guess that the package author thought that an annotation shouldn't be too long). You can define your own style, imitating the existing plain style but modifying the undesired behaviour, so that you can now have annotations spanning several lines; the definition would be something along these lines, I used a checkmark (\Checkmark from bbding) as the endmark:

\documentclass[12pt]{article}
\usepackage{bbding}
\usepackage{amsmath}
\usepackage[thmmarks,amsmath,amsthm,thref]{ntheorem}

\makeatletter
\newtheoremstyle{Myplain}%
  {\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\theorem@separator]}%
  {\item[\hskip\labelsep \theorem@headerfont ##1\ ##2]\theorem@headerfont (##3)\theorem@separator\newline\normalfont\itshape}
\newtheoremstyle{nonumberMyplain}%
  {\item[\theorem@headerfont\hskip\labelsep ##1\theorem@separator]}%
  {\item[\theorem@headerfont\hskip \labelsep ##1]\theorem@headerfont (##3)\theorem@separator\newline\normalfont\itshape}
\makeatother

\theoremstyle{Myplain}
\theoremsymbol{\Checkmark}
\newtheorem{example}{Example}

\begin{document}
\begin{example}[blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah]
Content
\end{example}

\end{document}

Another option would be to use the thmtools package which doesn't use \item to build its theorem-like structures, thus providing an easier solution (the same checkmark was used in this example):

\documentclass[12pt]{article}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{bbding}
\declaretheoremstyle[
  spaceabove=6pt, spacebelow=6pt,
  headfont=\normalfont\bfseries,
  notefont=\mdseries\bfseries,
  qed=\Checkmark,
  notebraces={(}{)},
  bodyfont=\itshape,
]{mystyle}
\declaretheorem[style=mystyle]{Example}


\begin{document}
\begin{Example}[blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah]
Content
\end{Example}

\end{document}
7
  • 2
    Maybe one could call it a bug then that \item is used ... Mar 28, 2011 at 16:09
  • @Hendrik: yes, maybe ntheorem's use of \item is not the best choice. I'll add another solution using the thmtools package which doesn't use \item Mar 28, 2011 at 16:26
  • Well, thmtools uses whatever its backend uses, so if you use it in combination with ntheorem you'd have the same problem. Mar 28, 2011 at 17:04
  • @Ulrich: yes, I know that, but using thmtools with amsthm you can have theorem-like structures with annotations spanning several lines (without long redefinitions) and the ability of setting endmarks. Mar 28, 2011 at 17:16
  • 4
    amsthm was originally based on \item but there were so many complaints about long optional heading comments not breaking that it was thoroughly revised with the december 1999 upgrade to scrap that approach. you might suggest to the author of ntheorem that a similar revision would be appreciated. (proof has the same problem, and it's on the ams list of things to be looked at with the next upgrade. the list environment is simply too restrictive in many ways, this being one of the most annoying.) Mar 28, 2011 at 17:42

You must log in to answer this question.

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