2

I tried to hide certain subsections (Hello) in the table of contents. I didn't find a solution that worked. I use the article class. Do you know what command I might use? Thanks for you help!

My code:

\documentclass[12pt,a4paper]{article}
\usepackage[top=1in, bottom=1in, inner=1in, outer=1in]{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage[utf8]{inputenc}
\usepackage{ngerman}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{acronym}
\renewcommand*\aclabelfont[1]{\acsfont{#1}}%unbold acronym

\begin{document}

\tableofcontents

%Anhang

\section*{Anhang}
\addcontentsline{toc}{section}{Anhang}
\renewcommand{\thesubsection}{\Alph{subsection}} 

\subsection{Hello}

\subsection{Hello}

\end{document}
  • 2
    what about \subsection*{Hello}? – touhami Sep 11 '16 at 23:13
  • Welcome! Can you complete the code so it can be compiled? – cfr Sep 11 '16 at 23:21
  • @touhami \subsection*{Hello} will hide the letters (numbering) everywhere. i just want them hidden in the toc. – S. Ming Sep 11 '16 at 23:29
3

Here is a solution

\documentclass{article}

\begin{document}
\tableofcontents
\section*{Anhang}
    \addcontentsline{toc}{section}{Anhang}
    \renewcommand{\thesubsection}{\Alph{subsection}} 

\addtocontents{toc}{\begingroup\string\c@tocdepth 1\relax}
    \subsection{Hello}
    \subsection{Hello}
\addtocontents{toc}{\endgroup}

    \subsection{Bye}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.