[Tex/LaTex] Remove numbering from Section and Subsection

numberingsectioning

I found this answer to remove the numbering from sections, but I also don't need numbering on sub– and subsubsections.

I tried to add a second def but then the number on Section is showed again.
I am fairly new to Latex and I don't really know what is going on in this code block.

Original:

\makeatletter
\def\@seccntformat#1{%
  \expandafter\ifx\csname c@#1\endcsname\c@section\else
  \csname the#1\endcsname\quad
  \fi}
\makeatother

Mine:

\makeatletter
\def\@seccntformat#1{%
  \expandafter\ifx\csname c@#1\endcsname\c@section\else
  \csname the#1\endcsname\quad
  \fi}

\def\@seccntformat#1{%
  \expandafter\ifx\csname c@#1\endcsname\c@subsection\else
  \csname the#1\endcsname\quad
  \fi}
\makeatother

Best Answer

Since you don't want numbering, use \setcounter{secnumdepth}{0}

\documentclass{article}
\setcounter{secnumdepth}{0}
\begin{document}
  \section{A section}
  \subsection{A sub section}
  \subsubsection{A sub sub section}
\end{document}

enter image description here