# Problem with solution to ntheorem and bad boxes; involves \newtheoremstyle

I'm using the ntheorem package to display endmarks on my examples/defns, etc. The problem is that it creates lots of bad boxes when the titles on theorems etc. are too long. I found a solution overfull-hbox-produced-by-ntheorem-subtitles, which is to define the following in the preamble bit:

\makeatletter
\newtheoremstyle{Myplain}%
\newtheoremstyle{nonumberMyplain}%
\makeatother

\theoremstyle{Myplain}
\theoremsymbol{$\bigcirc$}
\newtheorem{example}{Example}


And I use it with:

\begin{defn}[Definition of function]This is a definition of $f(x) = p_i(x^2)$.
\end{defn}


in my document to get this:

I don't want the math stuff to be in bold and italics. If I remove the label/title of the definition (Definition of function), the problem's solved. How do I change it so it looks normal even with a label? I know I have to mess around with the stuff after the \makeatletter but I don't understand it. Someone help please :(

-
Is there some reason not to switch to using amsthm and thmtools (as the accepted answer in your link suggests) to change the endmark display? –  Alan Munn May 11 '11 at 22:27
Yep, unfortunately those two have endmarks (for non-proof environments) that work poorly when you finish with a displayed equation. –  P.A May 12 '11 at 7:05

For some reason, the declaration \boldmath is in force when the optional argument is typeset (this might depend on settings in ntheorem). Solution:

\makeatletter
\newtheoremstyle{Myplain}%

Thanks once again. I changed the \itshape to \upshape and it got rid of the italics in the text for defns. with labels. It had no effect for definitions without labels -- still italics (but the math stuff is fine), but if I add \normaltext to each such definition it looks fine. Thank you again. –  P.A May 11 '11 at 22:39
the reason for the \boldmath is that ntheorem has a \theorem@checkbold macro which automatically switches \boldmath on when bold is used. –  Philippe Goutet May 11 '11 at 22:47