Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove section numbers latex

Tags:

latex

sections

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 :)

like image 625
Katarina Avatar asked Jul 10 '16 13:07

Katarina


1 Answers

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 (\sections, \subsections, \subsubsections, ...), yet keep them where they are references or whenever \thesection is used.

enter image description here

\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}
like image 192
Werner Avatar answered Oct 22 '22 22:10

Werner