I would like to modify the answer that I got in this thread here such that I have the subsection numbers in the TOC but not in the text. I do not completely understand the workings of the code I was given.

Thanks

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


You have to add \def\subsectionformat{} to your example (besides removing the error-causing asterisks).

\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{}
\def\subsectionformat{}

\makeatother

\usepackage{hyperref}

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

• Thank you, worked great! I think I tried to bold some of it, hence the asterisks – Mike Stumpf Jul 8 '12 at 18:35