Delete Latex Partition Numbers

I have a problem with section numbering in latex. I want to remove the section numbers from the headers and contents, but I want the numbers to be there for lemmas, theorems, etc. I want it to look like this:

 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 this? I tried

 \renewcommand\thesection{}

but he removes numbers even from lemmas and theorems. Many thanks:)

+4
source share
1 answer

In the articledefault class , we can simply remove the formatting applied to the section counter by adding

\makeatletter
\renewcommand{\@seccntformat}[1]{}
\makeatother

in the preamble. This will delete all section heading numbering ( \sections, \subsections, \subsubsections, ...), but keep them where they are links, or when used \thesection.

enter image description here

\documentclass{article}

\newtheorem{theorem}{Theorem}[section]% Theorems numbered by section
\newtheorem{lemma}[theorem]{Lemma}% Lemma uses theorem 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}
+6
source

All Articles