这是我的 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}
对于 thm 和 sthm 我不断收到错误:
No counter "theorem" defined.
如果我尝试添加 exam、defn、proof、arem 和 sproof,到目前为止它们都没问题。但对于 thm 和 sthm,我总是收到该错误。我尝试在定理定义上方添加以下行:
\newtheorem{Theorem}{Thm}
这会导致完全编译,没有任何错误,但没有定理环境,也没有任何阴影。任何帮助都将不胜感激。谢谢!
答案1
语法\newtheorem
有三种形式
\newtheorem{<envname>}{<tag>}
\newtheorem{<envname>}{<tag>}[<within>]
\newtheorem{<envname>}[<share>]{<tag>}
您\newtheorem{foo}{Bar}
正在定义一个与其他内容无关的编号环境。
\newtheorem{foo}{Bar}[section]
你定义一个编号为 1.1、1.2、2.1 等的环境,其中第一个数字是部分编号,第二个数字属于特定环境foo
;该<within>
部分应该是现有计数器的名称。使用
\newtheorem{foo}[baz]{Bar}
环境将与已经定义的baz
环境(应该已经按照前面的方式之一进行了定义)。该\newshadedtheorem
命令具有相同的属性。
在您使用的代码中[Theorem]
,没有对应先前定义的环境或计数器。
thm
以下代码修复了明显的错误,但您应该重新考虑编号系统(例如,不清楚为什么推论共享计数器,但引理却不共享)。
当然,由于pstricks
,文档必须使用latex+dvips+ps2pdf
路线进行编译,我是使用进行的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}