I'd like to create different Indexes for Equations, Definitions, Theorems, Propositions, Observations, Corollaries, Examples, Exercises. Is it possible?
For now, I don't know what MWE I must insert… . If You would answer my question, you could ask me what MWE add, and then I'll add what you'll want.
Thank you so much and Best Regards.
Index for Equations, Definitions, Theorems,
indexingtheorems
Related Solutions
I'd use a two step approach: define an inner environment with \newtheorem
and on top of it a new environment that checks for optional arguments, passing them to the inner environment and to \index
:
\documentclass{article}
\usepackage{imakeidx} % instead of makeidx, so you don't need to run MakeIndex
\usepackage{xparse}
\usepackage{amsthm}
\NewDocumentCommand{\defined}{om}{%
{\bfseries #2}%
\IfNoValueTF{#1}
{\index{#2}\label{#2}}
{\index{#1@#2}\label{#1}}%
}
\theoremstyle{definition} % use any style you prefer
\newtheorem{xdefinition}{Definition} % note the "x"
\NewDocumentEnvironment{definition}{oo}
{\IfNoValueTF{#1}
% no optional argument to definition
{\begin{xdefinition}}
% at least one optional argument
{\IfNoValueTF{#2}
% only one optional argument
{\begin{xdefinition}[#1]\index{Definition!#1}\label{def-#1}}
% two optional arguments
{\begin{xdefinition}[#2]\index{Definition!#1@#2}\label{def-#1}}%
}%
}
{\end{xdefinition}}
\makeindex
\begin{document}
\defined[G-invariant]{$G$-invariant}
\begin{definition}[G-invariant][$G$-invariant]
Something
\end{definition}
\begin{definition}[group]
Something
\end{definition}
The concept of $G$-invariant subgroup has been defined in~\ref{def-G-invariant} on page~\pageref{def-G-invariant}.
\printindex
\end{document}
When only one optional argument is specified, that is used for the index entry and the label.
The implicit \label
command will refer to the definition's number, but it's preceded by a def-
prefix in order to avoid duplicate labels: in in the body of a definition
environment you say \defined
with the same term, you'd end up with two identical labels.
If you want to add the definition number to the index entry, change the block where definition
is defined with
\NewDocumentEnvironment{definition}{oo}
{\IfNoValueTF{#1}
{\begin{xdefinition}}
{\IfNoValueTF{#2}
{\begin{xdefinition}[#1]\doindex{Definition!#1@#1}\label{def-#1}}
{\begin{xdefinition}[#2]\doindex{Definition!#1@#2}\label{def-#1}}%
}%
}
{\end{xdefinition}}
\ExplSyntaxOn
\NewDocumentCommand{\doindex}{m}
{
\use:x { \exp_not:N \index { \exp_not:n { #1~ } (\thexdefinition) } }
}
\ExplSyntaxOff
This will print in the index something like
Definition
G-invariant (1), 1
where the (1) refers to the definition number which is followed as usual by the page number.
I answer my question:
\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{amsthm}
\usepackage{stix}
%(Re)newcommands
\renewcommand\qedsymbol{$\blacksquare$}
%New 8 counters
\newtheorem{theorem}{Theorem}[subsection]
\newtheorem{definition}{Definition}[subsection]
\newtheorem{lemma}{Lemma}[subsection]
\newtheorem{corollary}{Corollary}[subsection]
\newtheorem{proposition}{Proposition}[subsection]
\newtheorem{example}{Example}[subsection]
\newtheorem{exercise}{Exercise}[subsection]
\newtheorem{observation}{Observation}[subsection]
%New Theorems
\newcommand{\namedtheoremname}{}
\newtheorem{namedtheoreminner}[theorem]{\protect\namedtheoremname}
\newenvironment{namedtheorem}[1]
{%
\renewcommand{\namedtheoremname}{#1}%
\begin{namedtheoreminner}%
}
{\end{namedtheoreminner}}
%New Definitions
\newcommand{\nameddefinitionname}{}
\newtheorem{nameddefinitioninner}[definition]{\protect\nameddefinitionname}
\newenvironment{nameddefinition}[1]
{%
\renewcommand{\nameddefinitionname}{#1}%
\begin{nameddefinitioninner}%
}
{\end{nameddefinitioninner}}
%New Lemmas
\newcommand{\namedlemmaname}{}
\newtheorem{namedlemmainner}[lemma]{\protect\namedlemmaname}
\newenvironment{namedlemma}[1]
{%
\renewcommand{\namedlemmaname}{#1}%
\begin{namedlemmainner}%
}
{\end{namedlemmainner}}
%New Corollaries
\newcommand{\namedcorollaryname}{}
\newtheorem{namedcorollaryinner}[corollary]{\protect\namedcorollaryname}
\newenvironment{namedcorollary}[1]
{%
\renewcommand{\namedcorollaryname}{#1}%
\begin{namedcorollaryinner}%
}
{\end{namedcorollaryinner}}
%New Propositions
\newcommand{\namedpropositionname}{}
\newtheorem{namedpropositioninner}[proposition]{\protect\namedpropositionname}
\newenvironment{namedproposition}[1]
{%
\renewcommand{\namedpropositionname}{#1}%
\begin{namedpropositioninner}%
}
{\end{namedpropositioninner}}
%New Examples
\newcommand{\namedexamplename}{}
\newtheorem{namedexampleinner}[example]{\protect\namedexamplename}
\newenvironment{namedexample}[1]
{%
\renewcommand{\namedexamplename}{#1}%
\begin{namedexampleinner}%
}
{\end{namedexampleinner}}
%New Exercises
\newcommand{\namedexercisename}{}
\newtheorem{namedexerciseinner}[exercise]{\protect\namedexercisename}
\newenvironment{namedexercise}[1]
{%
\renewcommand{\namedexercisename}{#1}%
\begin{namedexerciseinner}%
}
{\end{namedexerciseinner}}
%New Observations
\newcommand{\namedobservationname}{}
\newtheorem{namedobservationinner}[observation]{\protect\namedobservationname}
\newenvironment{namedobservation}[1]
{%
\renewcommand{\namedobservationname}{#1}%
\begin{namedobservationinner}%
}
{\end{namedobservationinner}}
\title{Theorem Proof, Stack}
\author{Name, Surname}
\begin{document}
\maketitle
\chapter{First Chapter}
\section{Theorems}
\subsection{Theorems}
\begin{namedtheorem}{First Theorem}
Statement.
\end{namedtheorem}
\begin{proof}
Its Proof.
\end{proof}
\begin{nameddefinition}{First Definition}
\end{nameddefinition}
\begin{nameddefinition}{Second Definition: Cauchy's Succession}
\end{nameddefinition}
\begin{namedlemma}{Zorn's Lemma}
Statement.
\begin{proof}
Its Proof.
\end{proof}
\end{namedlemma}
\end{document}
Observe this:
%New 8 counters
\newtheorem{theorem}{Theorem}[subsection]
\newtheorem{definition}{Definition}[subsection]
\newtheorem{lemma}{Lemma}[subsection]
\newtheorem{corollary}{Corollary}[subsection]
\newtheorem{proposition}{Proposition}[subsection]
\newtheorem{example}{Example}[subsection]
\newtheorem{exercise}{Exercise}[subsection]
\newtheorem{observation}{Observation}[subsection]
In this way it is possible create new counters and then use themselves like so:
% This is the main template for particular \LeTeX--Functions %
\newcommand{\namednewcountername}{}
\newtheorem{namednewcounterinner}[newcounter]{\protect\namednewcountername}
\newenvironment{namednewcounter}[1]
{%
\renewcommand{\namednewcountername}{#1}%
\begin{namednewcounterinner}%
}
{\end{namednewcounterinner}}
Here You can substutuite newcounter with theorem, lemma, proposition, ... .
THANK YOU
Best Answer
For everything except equations, if you define them as "theorem" environments, you can load
thmtools
and use the\listoftheorems
command.See the documentation (https://ctan.org/pkg/thmtools?lang=en) for how to filter the listing by type.
Listing equations have been asked several times previously on this site, the first one I found is List of Equations / Table of Equations