[OS X TeX] Does {ntheorem} have a bug related to \newshadedtheorem ?

Don Green Dragon fergdc at Shaw.ca
Thu Jan 12 04:40:24 CET 2012


Hi Michael,

On 11Jan2012, at 1:49 AM, Michael Welsh wrote:

> Okay, this is weird. There's some interactions going on between pstricks, ato-pst-pdf and ntheorem that don't work right, no matter what I do. However, there is a hack, which works for me:

Well, your hack works here too.

> \documentclass [11pt, fleqn, leqno] {book}
> 
> \usepackage{amsmath}
> \usepackage{color}
> \usepackage[amsthm, framed, thref]{ntheorem}
> \usepackage{framed}
> 
> \theoremclass{Theorem}
> \theoremstyle{break}
> \def\theoremframecommand{\colorbox{yellow}}
> \newshadedtheorem{thmshaded}{YellowBackTheorem}[chapter]
> 
> \begin{document}
> 
> \chapter{On Trial}\label{yellowbird}
> 
> Let's put some text in here.
> 
> \begin{thmshaded}[Named] 	% YellowBackTheorem
> \label{yellowguy}
> This is the statement of a shaded theorem \dots. Set by \texttt{thmshaded}.
> \end{thmshaded}
> 
> The theorem with the yellow background and optional ID
> ``(Yellow Bird)'' is \ref{yellowbird} and there's also \ref{yellowguy}
> 
> \end{document}

However, I never would have guessed that your line

> \def\theoremframecommand{\colorbox{yellow}}

would allow for the yellow backgrounds!!! Would you make a few comments about \theoremframecommand or give a reference. From the terminal "texdoc theoremframecommand" gave no results and a CTAN search fared no better!

Since you dropped the option 'thmmarks' from my code, I pasted it back into yours, and tested. OK, so 'thmmarks' is not the problem. To see if your coding would handle the 'framed' instances, I did the following:

-1- Got rid of your line \theoremclass{Theorem}

-2- Added the following lines so that \newframedtheorem could be tested:

\theoremstyle{change}
\theoremheaderfont{\normalfont\bfseries}
\theorembodyfont{\normalfont\rmfamily}
\theoremseparator{~~~$\diamondsuit$}
\newframedtheorem{thmbox}[thmshaded]{FramedTheorem}

Upon doing so, everything was fine, including references to an instance of \newframedtheorem via both \ref{...} and \thref{...}. So despite, the comments in May & Schedler, it "appears" (???) that no reference to {pstricks} is needed.

However, your line \def\theoremframecommand{\colorbox{yellow}} is crucial if one wants to use the \newshadedtheorem guy. I commented it out and received the error message:
============
./Untitled.tex:27: Undefined control sequence.
\thmshaded at framecommand ->\psframebox 
                                      [fillstyle=solid, fillcolor=gray, line...
l.27 \begin{thmshaded}
                      [Named] 	% YellowBackTheorem
============

So why do you refer to your solution as a 'hack'? The only defect that I suspected is that if I were to require a structure where the background was shaded magenta, then your 'fix' would not work. Not so! I threw in

\def\theoremframecommand{\colorbox{magenta}}
\newshadedtheorem{magshade}[thmshaded]{MagentaBackTheorem}

below the defintion of 'thmshaded', created an instance via 'magshade' and checked. Everything worked! Yellow guy, then framed guy, finally magenta guy and all references to any one working.

I've also checked out the use of \def\theoremframecommand{\colorbox{<some colour>}} and getting rid of {pstricks} in a far more complicated document that I've spent a lot of time on, and, so far, it works great!  :-))

Mind you, it is nice to know how to use these gadgets, but, at present, I have no plans for theorem-like structures with yellow, magenta, and lime backgrounds. However, incorporation of {ntheorem} into my regular work has been a great boon.

So, many thanks for the rescue from the {pstricks} black hole and introduction to {ntheorem}.


Don Green Dragon
fergdc at Shaw.ca






More information about the macostex-archives mailing list