ntheorem 文档中的高级定理列表会抛出错误

ntheorem 文档中的高级定理列表会抛出错误

我对我的定理的定义如下

\documentclass[a4paper,twoside]{article}

\usepackage{amsmath,amsfonts,mathtools,framed}
\usepackage{enumitem} % einfacher Nummerierung verändern
\usepackage{listofitems} % für Farben für Kapitel

%%%%%%%%%%%%%%%%%%Theoreme%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[thmmarks,framed,thref]{ntheorem} % [thmmarks] guarantees endmarks

%theorem
\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\newtcbtheorem[number within=subsection]{thm}{Satz} 
{{colback=\mycolors[\thesection]!5},
{colframe=\mycolors[\thesection]!95!black},
fonttitle=\scshape\bfseries,
before skip=15pt plus 2pt,after skip=15pt plus 2pt}{th}

\setsepchar{,}
\readlist\mycolors{amaranth,blue,orange,purple}

\newcounter{counter} 
\numberwithin{counter}{subsection}

% defn
\theoremstyle{break}
\theoremprework{\medbreak}
\theorempostwork{\medbreak}
\theorembodyfont{\normalfont}
\theoremheaderfont{\kern-5mm\bfseries} 
\theoremindent=5mm
\def\theoremframecommand{\colorbox{\mycolors[\thesection]!10}}
\newshadedtheorem{defn}[counter]{\textsc{Definition}}

%lemma
\theoremstyle{break}
\theoremprework{%
\def\FrameCommand{
{\color{\mycolors[\thesection]}{\hspace{-8pt}\vrule width 2pt     \hspace{6pt}}}}
\medbreak}
\theorempostwork{\medbreak}
\theorembodyfont{\itshape}
\theoremheaderfont{\kern-5mm\normalfont\bfseries} 
\theoremindent0.5cm
\newframedtheorem{lemma}[counter]{Lemma}

\definecolor{amaranth}{HTML}{a82337}
\definecolor{orange}{HTML}{BF7F00}
\definecolor{blue}{HTML}{016FB9}
\definecolor{purple}{HTML}{603C96}

\newtheoremlisttype{tab}%
{\begin{tabular*}{\linewidth}{@{}lrl@{\extracolsep{\fill}}r@{}}}%
{##1&##2&##3&##4\\}%
{\end{tabular*}}
\begin{document}
\section{first section}
\begin{lemma}[first lemma]
This is a lemma
\end{lemma}

oh, another lemma!

\begin{lemma}[second lemma]
This is a lemma, also.
\end{lemma}

oh, another lemma!

\begin{lemma}[third lemma]
This is a lemma, also.
\end{lemma}

oh, another lemma!

\begin{lemma}[fourth lemma]
This is a lemma, also.
\end{lemma}

\begin{lemma}[another lemma]
This is a lemma, also.
\end{lemma}

\begin{lemma}[another lemma]
This is a lemma, also.
\end{lemma}
\begin{lemma}[another lemma]
This is a lemma, also.
\end{lemma}
\begin{lemma}[another lemma]
This is a lemma, also.
\end{lemma}
\begin{lemma}[another lemma]
This is a lemma, also.
\end{lemma}        
\section{Alle wichtigen Definitionen und Lemmata}
\theoremlisttype{tab}
\listtheorems{defn,lemma}
\end{document}

现在我想使用 ntheorem 文档中的以下扩展,但计数器再次弹出 :/ 奖励:如何列出所有定理和引理?

答案1

改编:

  • 已移除:\newcounter{counter}并且\numberwithin{counter}{subsection}
  • 添加:\theoremnumbering{arabic}\theoremnumbering{greek}(参见第 17 页ntheorem 文档
  • 已更改:\newframedtheorem{lemma}{Lemma}[subsection]使用小节编号+定理编号
  • 添加:L表格的新列类型,因此长标题会有换行符
  • 添加:defn测试结果的环境
  • 注意:使用 UTF8 编码作为文件编码以保留德语变音符号。(见第 4 行)

代码:

\documentclass[a4paper,twoside]{article}

\usepackage{amsmath,amsfonts,mathtools,framed}
\usepackage{enumitem} % einfacher Nummerierung verändern
\usepackage{listofitems} % für Farben für Kapitel

%%%%%%%%%%%%%%%%%%Theoreme%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[thmmarks,framed,thref]{ntheorem} % [thmmarks] guarantees endmarks

%theorem
\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\newtcbtheorem[number within=subsection]{thm}{Satz} 
{{colback=\mycolors[\thesection]!5},
{colframe=\mycolors[\thesection]!95!black},
fonttitle=\scshape\bfseries,
before skip=15pt plus 2pt,after skip=15pt plus 2pt}{th}

\setsepchar{,}
\readlist\mycolors{amaranth,blue,orange,purple}

% defn
\theoremstyle{break}
\theoremprework{\medbreak}
\theorempostwork{\medbreak}
\theorembodyfont{\normalfont}
\theoremheaderfont{\kern-5mm\bfseries} 
\theoremindent=5mm
\def\theoremframecommand{\colorbox{\mycolors[\thesection]!10}}
\theoremnumbering{arabic} % <- NEW for arabic counter
\newshadedtheorem{defn}{\textsc{Definition}}[subsection] % subsection + arabic

%lemma
\theoremstyle{break}
\theoremprework{%
\def\FrameCommand{
{\color{\mycolors[\thesection]}{\hspace{-8pt}\vrule width 2pt     \hspace{6pt}}}}
\medbreak}
\theorempostwork{\medbreak}
\theorembodyfont{\itshape}
\theoremheaderfont{\kern-5mm\normalfont\bfseries}
\theoremindent0.5cm
\theoremnumbering{greek} % <- NEW for greek counter
\newframedtheorem{lemma}{Lemma}[subsection] % subsection + greek

\definecolor{amaranth}{HTML}{a82337}
\definecolor{orange}{HTML}{BF7F00}
\definecolor{blue}{HTML}{016FB9}
\definecolor{purple}{HTML}{603C96}


\usepackage{tabularx}
\newcolumntype{L}[1]{>{\hspace{0pt}\raggedright\arraybackslash}p{#1}} % linksbündig mit Breitenangabe

\newtheoremlisttype{tab}%
{\begin{tabular*}{\linewidth}{@{}lrL{85mm}@{\extracolsep{\fill}}r@{}}}%
{##1&##2&##3&##4\\}%
{\end{tabular*}}

\begin{document}
\section{first section}

\subsection{first subsection}

\begin{lemma}[first lemma]
    This is a lemma
\end{lemma}

\begin{lemma}[second lemma with a very long title to get a linebreak in tabular]
    This is a lemma, also.
\end{lemma}

\begin{defn}[first theorem]
    This is a theorem, also.
\end{defn}

\begin{lemma}[third lemma]
    This is a lemma, also.
\end{lemma}

\begin{lemma}[fourth lemma]
    This is a lemma, also.
\end{lemma}

\begin{defn}[second theorem]
    This is a theorem.
\end{defn}

\begin{lemma}[fifth lemma]
    This is a lemma, also.
\end{lemma}

\section{Alle wichtigen Definitionen und Lemmata}
\theoremlisttype{tab}
\listtheorems{defn,lemma}

\end{document}

结果:

在此处输入图片描述

相关内容