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.

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