8
\section{Section title here}}
\subsection*{The subsection without numbers, but want it to appear in TOC}
\addcontentsline{toc}{subsection}{The subsection without numbers, but want it to appear in TOC}

This is how I am avoiding subsection numbering and only showing section numbering. But I want subsection to appear in ToC so using the line below. All the above I did under \documentclass{article} however when I change it to \documentclass{report} it started showing up numbers again.

I would appreciate if you can guide me to understand this a bit more. I can get by with article; however, I am interested to know the difference. How can I achieve same in \documentclass{report}?

1
  • 2
    I've marked your inline code with backticks `. (And I've removed your name from the actual post since it shows up in the lower right corner anyway.) Jan 7, 2011 at 17:11

2 Answers 2

14

Let me guess: After the switch from article to report, your \subsection is still unnumbered, but your \section suddenly shows up as "0.x A section" (which resembles the look of \subsection in article)? That is because the report class (and the book class) feature the additional sectioning level \chapter, which becomes the new top level.

\documentclass{report}

\begin{document}

\tableofcontents

% Uncomment the following line to get rid of "zero-sections"
% \chapter{Chapter title here}

\section{Section title here}

\subsection*{An unnumbered subsection appearing in the ToC}
\addcontentsline{toc}{subsection}{An unnumbered subsection appearing in the ToC}

\end{document}

EDIT: If I understand correctly, you want the effect of the following (to be added to the preamble):

\renewcommand{\thesection}{\arabic{section}}

Chapters are still numbered, but sections don't feature the chapter number. (This may confuse readers, and it may screw up the cross-reference mechanism.)

4
  • That is correct, but I don't want it to show the chapter number just show section numbers only.
    – Aku
    Jan 7, 2011 at 18:09
  • thats exactly what I want to add the effect of \renewcommand{\thesection}{\arabic{section}}, thanks a million
    – Aku
    Jan 7, 2011 at 18:26
  • @Aku Why are you using the report class at all if you want to make it behave like article does by default?
    – Seamus
    Jan 7, 2011 at 18:46
  • @Seamus- I wanted it to behave like a report. But did not know how to do it when I was learning TeX, everything I wanted to write worked pretty good with article. Now when I am close to finishing my report I thought I can check here if there is a way to go back. I did not know about this site until recently.
    – Aku
    Jan 7, 2011 at 18:49
3

\setcounter{secnumdepth}{1} will show only Chapter (if applicable) and Section numbers. The subsections will still appear, unnumbered, in the table of contents.

To get the change to appear, you will need to run LaTeX twice

5
  • To quote Kopka and Daly (2004), p. 59: \section is always level 1, \subsection level 2, [...] [I]n book and report classes, [...] \chapter becomes level 0."
    – lockstep
    Jan 7, 2011 at 17:27
  • Still it is showing up as 0.xx in the document and as well as in the TOC
    – Aku
    Jan 7, 2011 at 17:30
  • @lockstep yep I fixed that already.
    – Seamus
    Jan 7, 2011 at 17:32
  • @Aku That's what it's supposed to do. Using the report means you also have access to the \chapter command. So your sections, which appear before the first chapter command will appear as belonging to the 0th chapter.
    – Seamus
    Jan 7, 2011 at 17:33
  • @Aku, note also that to effect the changes, you need to run LaTeX twice.
    – Seamus
    Jan 7, 2011 at 17:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .