Hello I am trying to get rid of some of the numbers on the left side of the table of contents entries. I am using the article class and I would like to eliminate numbers left of "sections" but not "subsections". So, in the picture below, I would like to keep "1.1, 1.2, etc" but not "1"

This also happens in the document itself, with each new section it lists the number to the left. I would like to clear those but still keep the subsection numbers.

I have taken a look at tocloft but I could not make sense of it. If you could give any help, that would be great. I am using Texstudio and here is what my doc looks like right now:

\documentclass[12pt, a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[notes]{biblatex-chicago}
\DefineBibliographyStrings{english}{references = {Works Cited}}
\DeclareBibliographyCategory{primary}
\usepackage{filecontents}
\usepackage{microtype}
\usepackage{url}
\usepackage{makeidx}
\usepackage{indentfirst}
\makeindex
\begin{document}
\tableofcontents
\newpage
\section{Part I}
\printbibliography[title={Primary Works},category=primary]
\end{document}


Here's a minimal version of your document; the important code is between \makeatletter and \makeatother: basically we call \l@section, which is responsible for typesetting the entry in the table of contents after having neutralized \numberline. Then we redefine \@seccntformat which is responsible for printing the number next to the section titles (at all levels): since we define only \sectionformat, with \section{Part I} no number will be printed.

\documentclass[12pt, a4paper]{article}

\makeatletter
\let\latexl@section\l@section
\def\l@section#1#2{\begingroup\let\numberline\@gobble\latexl@section{#1}{#2}\endgroup}
\def\sectionformat{}

\makeatother

\usepackage{hyperref}

\begin{document}
\tableofcontents
\newpage
\section{Part I}
\subsection{abc}
\subsection{def}
\end{document}


Notice that hyperref should be loaded after the modification of \l@section (if you want to load it, of course).

The red rectangles are due to hyperref.

However I find it bad style writing “Part I” and then using an arabic number for the section.

• That answer only gets rid of section numbering in the table of contents. I don't think the OP wants section numbering in the body, either... – TSB Jul 3 '12 at 22:58
• @TSB This was not specified. :) – egreg Jul 3 '12 at 23:05
• Yes it was. "This also happens in the document itself, with each new section it lists the number to the left. I would like to clear those but still keep the subsection numbers." – TSB Jul 3 '12 at 23:05
• @TSB You're right. Fixed. – egreg Jul 3 '12 at 23:17
• Thank you, this is great! I had no idea how to go about this :) – Mike Stumpf Jul 4 '12 at 8:06

(Edited according to egreg's comment, except I still prefer \phantomsection before the section command itself.) This code works, but someone else could probably make a simpler version.

\documentclass[12pt,a4paper]{article}

\usepackage{hyperref}

\begin{document}

\tableofcontents

\newpage

\phantomsection
\section*{Part I}
\stepcounter{section}
\subsection{abc}
\subsection{def}

\phantomsection
\section*{Part II}

• Of course it would be better to define a \Section macro doing the work. – egreg Jul 3 '12 at 23:16