1

Here is my MWE:

\documentclass[12pt,a4paper,oneside]{report}
\usepackage[left=2.00cm,right=2.00cm,top=2.45cm,bottom=2.5cm]{geometry}
\usepackage{amsmath,amssymb,amscd,color,enumitem}
\usepackage{fancyhdr,framed,latexsym,multicol,pstricks,slashed,xcolor}
\usepackage[amsmath,framed,thmmarks]{ntheorem}
\pagestyle{fancy}

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}{}}
\lhead{\leftmark}
\rhead{\rightmark}
\cfoot{\thepage}
\renewcommand{\qed}{\qedsymbol{\blacksquare}}

\theoremstyle{marginbreak}
\theoremheaderfont{\normalfont\bfseries}\theorembodyfont{\slshape}
\theoremsymbol{\ensuremath{\diamondsuit}}
\theoremseparator{:}
\newtheorem{thm}{Theorem}[Theorem]

\theoremstyle{changebreak}
\theoremsymbol{\ensuremath{\heartsuit}}
\theoremindent0.5cm
\theoremnumbering{greek}
\newtheorem{lem}{Lemma}

\theoremindent0cm
\theoremsymbol{\ensuremath{\spadesuit}}
\theoremnumbering{arabic}
\newtheorem{cor}[thm]{Corollary}

\theoremstyle{change}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\ast}}
\theoremseparator{}
\newtheorem{exm}{Example}

\theoremstyle{plain}
\theoremsymbol{\ensuremath{\clubsuit}}
\theoremseparator{.}
\theoremprework{\bigskip\hrule}
\theorempostwork{\hrule\bigskip}
\newtheorem{defn}{Definition}

\theoremheaderfont{\sc}\theorembodyfont{\upshape}
\theoremstyle{nonumberplain}
\theoremseparator{}
\theoremsymbol{\rule{1ex}{1ex}}
\newtheorem{proof}{Proof}

\theoremstyle{change}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\ast}}
\theoremseparator{}
\newtheorem{rem}{Remark}

\theoremclass{Theorem}
\theoremstyle{break}
\theoreminframepreskip{0pt}
\theoreminframepostskip{0pt}
\theoremframepreskip{1cm}
\theoremframepostskip{1cm}
\theoremstyle{break}
\def\theoremframecommand{%
\psshadowbox[fillstyle=solid,fillcolor=blue,linecolor=black]}
\newshadedtheorem{sthm}[Theorem]{Theorem}

\theoremclass{Proof}
\theoremstyle{nonumberbreak}
\shadecolor{red}
\def\theoremframecommand{%
\psshadowbox[fillstyle=solid,fillcolor=red,linecolor=black]}
\theoremsymbol{\rule{1ex}{1ex}}
\newshadedtheorem{sproof}{Proof}

\title{Calculus Notes}
\author{}
\date{\today}
\begin{document}
\maketitle

chapter{Limits}
\begin{sthm}[Basic Limits]
    Let $b$ and $k \in \mathbb{R}$ and let $n$ be a positive integer. Then:
        \begin{enumerate}
            \item $\lim\limits_{x\to c}k=c$
            \item $\lim\limits_{x\to c}x=c$
            \item $\lim\limits_{x\to c}x^n=c^n$
        \end{enumerate}
\end{sthm}
\end{document}

For the thm and sthm I keep getting the error:

No counter "theorem" defined. 

If I try and add exam, defn, proof, arem, and sproof so far they are fine. But for thm and sthm I keep getting that error. I have tried adding the following line above my definition of theorem:

\newtheorem{Theorem}{Thm}

which results in a full compile without any errors, but without the theorem environment and no shading whatsoever. Any help would be appreciated. Thanks!

5
  • Just remove [Theorem] or replace it with [chapter] indicating that you want the theorem counter (here: thm) dominated by the chapter counter (among other things, thus will reset the thm counter at each new chapter).
    – daleif
    Sep 7, 2016 at 14:58
  • \newtheorem{thm}{Theorem}[Theorem] tries to use the Theorem counter as resetting counter for thm. This counter is not yet defined --> Do you need this resetter at all? If no,then remove [Theorem], if yes, say \newcounter{Theorem}, but you say what Theorem counts then
    – user31729
    Sep 7, 2016 at 14:59
  • When I remove [Thorem] in the shaded theorem definition I get no errors but now as before the theorem is compiled and printed not as a theorem but just the math and not shaded at all... Sep 7, 2016 at 15:01
  • @MichaelDykes: Your bunch of theorem definitions is confusing anyway. Perhaps you should use something like mdframed or tcolorbox to provide shaded/coloured theorems and having a cleaner interface?
    – user31729
    Sep 7, 2016 at 15:02
  • @ChristianHupfer: I am all for cleaning up my definitions but How would I go about doing this? Sep 7, 2016 at 15:04

1 Answer 1

1

The syntax for \newtheorem has three forms

\newtheorem{<envname>}{<tag>}

\newtheorem{<envname>}{<tag>}[<within>]

\newtheorem{<envname>}[<share>]{<tag>}

With \newtheorem{foo}{Bar} you're defining an environment that is numbered independently of anything else. With

\newtheorem{foo}{Bar}[section]

you define an environment that's numbered like 1.1, 1.2, 2.1 and so on, where the first number is the section number and the second pertains to the specific foo environment; the <within> part should be the name of an existing counter. With

\newtheorem{foo}[baz]{Bar}

the environment will share the numbering with the already defined baz environment (which should have been defined in one of the previous ways). The \newshadedtheorem command has the same properties.

In your code you're using [Theorem] that corresponds to no previously defined environment or counter.

The following code fixes the obvious errors, but you should rethink the numbering system (it's not clear why corollaries share the thm counter, but lemmas don't, for instance).

Of course, due to pstricks, the document has to be compiled with the latex+dvips+ps2pdf route, which I do with arara.

% arara: latex
% arara: dvips
% arara: ps2pdf

\documentclass[12pt,a4paper,oneside]{report}
\usepackage[left=2.00cm,right=2.00cm,top=2.45cm,bottom=2.5cm]{geometry}
\usepackage{amsmath,amssymb,amscd,color,enumitem}
\usepackage{fancyhdr,framed,latexsym,multicol,pstricks,slashed,xcolor}
\usepackage[amsmath,framed,thmmarks]{ntheorem}
\pagestyle{fancy}

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}{}}
\lhead{\leftmark}
\rhead{\rightmark}
\cfoot{\thepage}
\renewcommand{\qed}{\qedsymbol{\blacksquare}}

\theoremstyle{marginbreak}
\theoremheaderfont{\normalfont\bfseries}\theorembodyfont{\slshape}
\theoremsymbol{\ensuremath{\diamondsuit}}
\theoremseparator{:}
\newtheorem{thm}{Theorem}

\theoremstyle{changebreak}
\theoremsymbol{\ensuremath{\heartsuit}}
\theoremindent0.5cm
\theoremnumbering{greek}
\newtheorem{lem}{Lemma}

\theoremindent0cm
\theoremsymbol{\ensuremath{\spadesuit}}
\theoremnumbering{arabic}
\newtheorem{cor}[thm]{Corollary}

\theoremstyle{change}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\ast}}
\theoremseparator{}
\newtheorem{exm}{Example}

\theoremstyle{plain}
\theoremsymbol{\ensuremath{\clubsuit}}
\theoremseparator{.}
\theoremprework{\bigskip\hrule}
\theorempostwork{\hrule\bigskip}
\newtheorem{defn}{Definition}

\theoremheaderfont{\sc}\theorembodyfont{\upshape}
\theoremstyle{nonumberplain}
\theoremseparator{}
\theoremsymbol{\rule{1ex}{1ex}}
\newtheorem{proof}{Proof}

\theoremstyle{change}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\ast}}
\theoremseparator{}
\newtheorem{rem}{Remark}

\theoremclass{Theorem}
\theoremstyle{break}
\theoreminframepreskip{0pt}
\theoreminframepostskip{0pt}
\theoremframepreskip{1cm}
\theoremframepostskip{1cm}
\theoremstyle{break}
\def\theoremframecommand{%
\psshadowbox[fillstyle=solid,fillcolor=blue,linecolor=black]}
\newshadedtheorem{sthm}[thm]{Theorem}

\theoremclass{Proof}
\theoremstyle{nonumberbreak}
\shadecolor{red}
\def\theoremframecommand{%
\psshadowbox[fillstyle=solid,fillcolor=red,linecolor=black]}
\theoremsymbol{\rule{1ex}{1ex}}
\newshadedtheorem{sproof}{Proof}

\title{Calculus Notes}
\author{}
\date{\today}
\begin{document}
\maketitle

\chapter{Limits}
\begin{sthm}[Basic Limits]
    Let $b$ and $k \in \mathbb{R}$ and let $n$ be a positive integer. Then:
        \begin{enumerate}
            \item $\lim\limits_{x\to c}k=c$
            \item $\lim\limits_{x\to c}x=c$
            \item $\lim\limits_{x\to c}x^n=c^n$
        \end{enumerate}
\end{sthm}
\end{document}

enter image description here

0

You must log in to answer this question.

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