I have a problem with section numbering in latex. I want to remove the section numbers from headings and contents but I want the numbers to be there for lemmas, theorems etc. I want it to look like:
Section Whatever
Some unimportant text.
Section Whatever else
Another unimportant text.
Lemma 2.1
Theorem 2.2
Section Whatever again
Theorem 3.1
How can I do it? I tried
\renewcommand\thesection{}
but it removes the numbers even from lemmas and theorems. Thank you very much :)
Under the default article
class we can merely remove the formatting applied to the section counter by adding
\makeatletter
\renewcommand{\@seccntformat}[1]{}
\makeatother
to the preamble. This will remove all sectional title numbering (\section
s, \subsection
s, \subsubsection
s, ...), yet keep them where they are references or whenever \thesection
is used.
\documentclass{article}
\newtheorem{theorem}{Theorem}[section]% Theorems numbered by section
\newtheorem{lemma}[theorem]{Lemma}% Lemma uses theorem's counter
\makeatletter
\renewcommand{\@seccntformat}[1]{}
\makeatother
\begin{document}
\section{Section whatever}
Some uninportant text.
\section{Section whatever else}
Another uninportant text.
\begin{lemma}
Some lemma.
\end{lemma}
\begin{theorem}
Some theorem.
\end{theorem}
\section{Section whatever again}
\begin{theorem}
Another theorem.
\end{theorem}
\end{document}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With