需要帮助修改 ntheorem 环境

需要帮助修改 ntheorem 环境

我正在尝试修改 中定义的一些定理环境。我希望我的文档中的定义能够ntheoremntheorem框架定理类他们的定义是:

\theoremclass{Theorem}
\theoremstyle{break}
\newframedtheorem{importantTheorem}[Theorem]{Theorem}

因此我将上面的代码修改如下:

\theoremclass{Theorem}
\theoremstyle{break}
\newframedtheorem{defn}[Theorem]{Definition}

然后在我的文档中调用一个定义实例:

\begin{defn}[Logical Equivalance] Two propositions are said to be logically equivalent iff ...
\end{defn}

现在,我想修改他们的阴影定理环境,其编码如下:

\theoremclass{Theorem}
\theoremstyle{break}
\newshadedtheorem{moreImportantTheorem}[Theorem]{Theorem}

我尝试了以下操作:

\theoremclass{Theorem}
\theoremstyle{break}
\newshadedtheorem{prop}[Theorem]{Proposition}

但仍然出现错误:

Undefined control sequence: begin{prop}

谁能帮我这个?

\documentclass[10pt,a4paper]{article}

\usepackage[left=2.50cm,right=2.50cm,top=2.50cm,bottom=2.75cm]{geometry}
\usepackage{amsmath,amssymb,amscd,amstext,amsbsy,array,color,epsfig}
\usepackage{fancyhdr,framed,latexsym,multicol,pstricks,slashed,xcolor}
\usepackage[amsmath,framed,thmmarks]{ntheorem}


\begin{document}

\theoremstyle{marginbreak}
\theoremheaderfont{\bfseries\scshape}
\theorembodyfont{\slshape}
\theoremsymbol{\ensuremath{\star}}
\theoremseparator{:}
\newtheorem{axm}{Axiom}[section]

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

\theoremclass{Theorem}
\theoremstyle{break}
\newshadedtheorem{prop}[Theorem]{Proposition}

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

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

\theoremstyle{plain}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\bullet}}
\theoremseparator{}
\newtheorem{exm}{Example}

\theoremclass{Theorem}
\theoremstyle{plain}
\theoremsymbol{\ensuremath{\clubsuit}}
\newframedtheorem{defn}[Theorem]{Definition}

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

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

\theoremstyle{plain}
\theorembodyfont{\upshape}
\newtheorem{exc}{Exercise}[section]


\begin{defn}[Logical Equivalance] Two propositions are said to be logically equivalent iff ...
\end{defn}  

\begin{prop}
Let $P$ and $Q$ be propositions. Then ...
\end{prop}

\end{document}

谢谢!!!

我现在添加了更多类似“定理”的环境,并且出现了更多错误,如果可能的话,请有人帮助我使用 mdframed 来解决问题。这是当前最新的 mwe:

\documentclass[a4paper,12pt,twoside]{book}

\usepackage[left=2.50cm,right=2.50cm,top=2.50cm,bottom=2.75cm]{geometry}
\usepackage{amsmath,amssymb,amscd,amsbsy,array,color,epsfig}
\usepackage{fancyhdr,framed,latexsym,multicol,pstricks,slashed,xcolor}
\usepackage{picture}
\usepackage{indentfirst}
\usepackage{enumitem}

\usepackage{tikz}
\usepackage{subfig}
\usetikzlibrary{calc,positioning,shapes.geometric}

\setenumerate[1]{label=(\alph*)}

\usepackage[amsmath,framed,thmmarks]{ntheorem}

\newtheorem{Theorem}{Thm}
\theoremclass{Theorem}
\theoremstyle{break}
\shadecolor{blue}
\newshadedtheorem{them}[Theorem]{Theorem}

\theoremclass{Theorem}
\theoremstyle{break}
\shadecolor{gray}
\newshadedtheorem{prop}{Proposition}[section]

\theoremclass{Theorem}
\theoremstyle{plain}
\newframedtheorem{lema}[Theorem]{Lemma}

\theoremclass{Theorem}
\theoremstyle{plain}
\newframedtheorem{coro}[Theorem]{Corollary}

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

\theoremstyle{plain}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\bullet}}
\theoremseparator{}
\newtheorem{exam}{Example}

\theoremstyle{plain}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\bullet}}
\newtheorem{exer}{Exercise}[section]

\theoremheaderfont{\sc}
\theorembodyfont{\color{blue}\bfseries\boldmath}
\theoremstyle{nonumberplain}
\theoremseparator{.}
\theoremsymbol{\rule{1ex}{1ex}}
\newtheorem{proof}{Proof}

\theoremstyle{plain}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\bigstar}}
\theoremseparator{.}
\newtheorem{remk}{Remark}


\def    \all    {\forall}
\def    \ex     {\exists}
\def    \imp    {\Rightarrow}
\def    \limp   {\Leftarrow}
\def    \iff    {\Longleftrightarrow}
\def    \contra {\rightarrow\negmedspace\leftarrow}
\def    \es     {\emptyset}
\def    \st     {\backepsilon}



\def    \bn{\mathbb N}
\def    \bz{\mathbb Z}
\def    \bq{\mathbb Q}
\def    \br{\mathbb R}
\def    \bc{\mathbb C}
\def    \bp{\mathbb P}
\def    \bt{\mathbb T}



\begin{defn}[Statement/Proposition]
Declarative sentences or strings of symbols in mathematics which can be said     to have \textit{exactly} one \textit{truth value}, that is, are either true (denoted T), or false (denoted F), are known as \textbf{statements} or \textbf{propositions}.
\end{defn}

\begin{exam}
Hence, the truth value of the negation of a proposition is \textit{merely} the opposite of the truth value of said proposition. Hence, the truth value of the proposition '$7$ is divisible by $2$' is the proposition 'It is not the case that $7$ is not divisible by $2$' or '$7$ is not divisible by $2$' (both of which are true).
\end{exam}

\begin{prop}
Let $P$ and $Q$ be propositions. Then:
\begin{enumerate}
    \item $P \imp Q \equiv (\neg Q) \imp (\neg P).$
    \item $P \imp Q  \not \equiv Q \imp P.$
\end{enumerate}
\end{prop}

\begin{prop}
Let $P,Q,$ and $R$ be propositions. Then:
    \begin{enumerate}
        \item $P \imp Q \equiv (\neg P) \vee (Q).$
        \item $P \iff Q \equiv (P \imp Q) \wedge (Q \imp P).$
        \item $\neg(P \imp Q) \equiv (P) \wedge (\neg Q).$
        \item $\neg(P \wedge Q) \equiv (P) \imp (\neg Q) \equiv (Q) \imp (\neg P).$
        \item $P \imp (Q \imp R) \equiv (P \wedge Q) \imp R.$
        \item $P \imp (Q \vee R) \equiv (P \imp Q) \wedge (P \imp R).$ 
        \item $(P \vee Q) \imp R \equiv (P \imp R) \wedge (Q \imp R).$
    \end{enumerate}
\end{prop}

\begin{proof}
The proof for the above proposition is left to the reader. All of the above statements may be proved using truth tables.
\end{proof}

\begin{axm}[Field Axioms of $\br$]
On the set $\br$ of real numbers, there are two binary operations, denoted by $\pmb{+}$ and $\pmb{\cdot}$ and called \textbf{addition} and \textbf{multiplication} respectively. These operations satisfy the following properties:
\begin{itemize}
    \item[$A_0$] $x,y \in \br \imp x+y \in \br \q \all \, x,y \in \br$. [additive closure]
    \item[$A_1$] $x+y=y+x \q \all \, x,y \in \br$. [additive commutativity]
    \item[$A_2$] $(x+y)+z=x+(y+z) \q \all \, x,y,z \in \br$. [additive associativity]
    \item[$A_3$] There is a unique $0 \in \br \text{ such that } 0+x=x=x+0 \q \all \, x \in \br$. [existence of an additive identity]
    \item[$A_4$] There is a unique $-x \in \br \text{ such that } x+(-x)=0=(-x)+x \q \all \, x \in \br$. [existence of an additive inverse]
    \item[$M_0$] $x,y \in \br \imp x \cdot y \in \br \q \all \, x,y \in \br$. [multiplicative closure]
    \item[$M_1$] $x \cdot y=y \cdot x \q \all \, x,y \in \br$. [multiplicative commutativity]
    \item[$M_2$] $(x \cdot y) \cdot z=x \cdot (y \cdot z) \q \all \, x,y,z \in \br$. [multiplicative associativity]
    \item[$M_3$] There is a unique $1 \in \br \text{ such that } 1 \cdot x=x=x \cdot 1 \q \all \, x \in \br$. [existence of multiplicative identity]
    \item[$M_4$] There is a unique $\nicefrac{1}{x} \in \br \text{ such that } x \cdot (\nicefrac{1}{x})=1=(\nicefrac{1}{x}) \cdot x \q \all x \in \br$. [existence of multiplicative inverse]
    \item[$AM_1$] $x \cdot (y+z) = (x \cdot y) + (x \cdot z)$ and $(y + z) \cdot x = (y \cdot x) + (z \cdot x)$. [distributivity]
\end{itemize}
\end{axm}


\begin{rem}
The reader should be familiar with all of the aforementioned field properties. We note that all of the `familiar' properties of algebra (those learned in middle school and high school, for example) may be deduced from this list. We now establish the basic fact that both the additive identity, $0$, and the multiplicative identity are in fact unique; and that multiplication by $0$ always results in $0$.
\end{rem}


\end{document}

答案1

您可以通过添加行来修复您的 MWE

\newtheorem{Theorem}{Thm}

这对于您后续的两个类定理环境prop和都是必需的defn

% arara: latex
% arara: dvips
% arara: ps2pdf
% !arara: indent: {overwrite: yes}
\documentclass[10pt,a4paper]{article}

\usepackage[left=2.50cm,right=2.50cm,top=2.50cm,bottom=2.75cm]{geometry}
\usepackage{amsmath}
\usepackage{pstricks}
\usepackage{framed}
\usepackage[amsmath,framed,thmmarks]{ntheorem}

\newtheorem{Theorem}{Thm}
\theoremclass{Theorem}
\theoremstyle{break}
\newshadedtheorem{prop}[Theorem]{Proposition}

\theoremclass{Theorem}
\theoremstyle{plain}
\theoremsymbol{\ensuremath{\clubsuit}}
\newframedtheorem{defn}[Theorem]{Definition}

\begin{document}

\begin{defn}[Logical Equivalance] 
    Two propositions are said to be logically equivalent iff ...
\end{defn}  

\begin{prop}
    Let $P$ and $Q$ be propositions. Then ...
\end{prop}

\end{document}

请注意,此 MWE 依赖于pstricks包,因此需要通过编译,latex->dvips->ps2pdf除非你想按照如何在 pdfLaTeX 中使用 PSTricks?

对于你所有的框架需求,我强烈推荐mdframed该方案解决了其竞争对手的诸多缺点。

这是之前 MWE 的一个版本,使用mdframed包;请注意,这个包没有依靠包上pstricks(与之前的方法相反)。这样,您可以(轻松地)使用 编译此文档pdflatex

% arara: pdflatex
% !arara: indent: {overwrite: yes}
\documentclass[10pt,a4paper]{article}

\usepackage[left=2.50cm,right=2.50cm,top=2.50cm,bottom=2.75cm]{geometry}
\usepackage{amsmath}
\usepackage[amsmath,framed,thmmarks]{ntheorem}
\usepackage[ntheorem,xcolor]{mdframed}

\newtheorem{Theorem}{Thm}
\theoremclass{Theorem}
\theoremstyle{break}
\newmdtheoremenv[
outerlinewidth = 2 ,%
roundcorner = 10 pt ,%
leftmargin = 40 ,%
rightmargin = 40 ,%
backgroundcolor=yellow!40,%
outerlinecolor=blue!70!black,%
innertopmargin=\topskip,%
splittopskip = \topskip ,%
ntheorem = true ,%
]{prop}[Theorem]{Proposition}

\theoremstyle{plain}
\theoremsymbol{\ensuremath{\clubsuit}}
%\newframedtheorem{defn}[Theorem]{Definition}
\newmdtheoremenv{defn}[Theorem]{Definition}

\begin{document}

\begin{defn}[Logical Equivalance] 
    Two propositions are said to be logically equivalent iff ...
\end{defn}  

\begin{prop}
    Let $P$ and $Q$ be propositions. Then ...
\end{prop}

\end{document}

当然,mdframed可以告诉包使用pstricks或者tikz如果您愿意,但这超出了问题的范围 - 请参阅手册了解更多详细信息。


根据问题编辑进行更新。

有了额外的类定理环境,这个 MWE 就可以工作了。请注意,你不能使用以下方法两次定义类定理环境\newtheorem

% arara: latex
% arara: dvips
% arara: ps2pdf
% !arara: indent: {overwrite: yes}
\documentclass[10pt,a4paper]{article}

\usepackage[left=2.50cm,right=2.50cm,top=2.50cm,bottom=2.75cm]{geometry}
\usepackage{amsmath}
\usepackage{pstricks}
\usepackage{framed}
\usepackage[amsmath,framed,thmmarks]{ntheorem}

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

\theoremclass{Theorem}
\theoremstyle{break}
\newshadedtheorem{prop}[Theorem]{Proposition}

\theoremclass{Theorem}
\theoremstyle{plain}
\theoremsymbol{\ensuremath{\clubsuit}}
\newframedtheorem{defn}[Theorem]{Definition}

\theoremstyle{marginbreak}
\theoremheaderfont{\bfseries\scshape}
\theorembodyfont{\slshape}
\theoremsymbol{\ensuremath{\star}}
\theoremseparator{:}
\newtheorem{axm}{Axiom}[section]

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

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

\theoremstyle{plain}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\bullet}}
\theoremseparator{}
\newtheorem{exm}{Example}

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

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

\theoremstyle{plain}
\theorembodyfont{\upshape}
\newtheorem{exc}{Exercise}[section]

\begin{document}

\begin{defn}[Logical Equivalance] 
    Two propositions are said to be logically equivalent iff ...
\end{defn}  

\begin{prop}
    Let $P$ and $Q$ be propositions. Then ...
\end{prop}

\end{document}

相关内容