1

I have defined my theorems as follows

\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}}
\newframedtheorem{altdef}[counter]{\textsc{Alternative 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}

\usepackage[bookmarks=true,colorlinks=true,linkcolor=black]{hyperref}
\usepackage[headheight=12.6pt, includehead, includefoot, hscale=0.60, vscale=0.90]{geometry}

\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}

Now I want to use the following extension from the ntheorem documentation, but counters pop up again :/ Bonus: How can I make a list of all theorems and lemmas?

2

The ntheorem package has a special option to make it compatible with the hyperref package:

\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,hyperref]{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}}
\newframedtheorem{altdef}[counter]{\textsc{Alternative 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}

\usepackage[bookmarks=true,colorlinks=true,linkcolor=black]{hyperref}
\usepackage[headheight=12.6pt, includehead, includefoot, hscale=0.60, vscale=0.90]{geometry}
\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}

\section{Alle wichtigen Definitionen und Lemmata}
\listtheorems{defn,lemma}
\end{document}

enter image description here

  • Great! How can I now also incorporate the theorems, which are not defined as a standard (n)theorem? – Viktor Glombik Jan 31 at 18:52
  • Also, when the theorem numbers are longer, i.e. 2.3.10, the text and the number clash. How can that be fixed? I updated my MWE to reflect that. – Viktor Glombik Jan 31 at 18:55
  • Also, with some advanced formatting directly from the documentation (p. 26/27), the counters reappear. – Viktor Glombik Jan 31 at 19:04
  • This advanced formatting would take care of the issue, that numbers and text get in each others way, though. – Viktor Glombik Jan 31 at 19:19
  • @ViktorGlombik If you have new questions, please use the "ask question" button to post them. More people will see them and be able to help you. – user36296 Jan 31 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.