Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a section which I don't want to be numbered, but which I still want in the table of contents. So I have written

\addtotoc{section}{My section}
\section*{My section}

I have done the same thing for all the subsections in this section. The problem is just that the subsections end up at separate pages, creating a lot of empty space in my document. If I remove the \addtotoc macro then the problem disappears. The question is why \addtotoc automatically starts a new page and if this can be turned off?

share|improve this question
    
Please edit your question and add a complete example that reproduces the problem. Without this it will be difficult for anyone to help you. –  Ian Thompson Jul 5 '12 at 14:35
3  
I've found \addtotoc in the ClemsonThesis class and it has a very bizarre definition. If you're using that class, I strongly suggest never using that command. –  egreg Jul 5 '12 at 14:51
add comment

1 Answer 1

up vote 3 down vote accepted

It's quite difficult to answer without any example and the indication of the used class. I guess it's ClemsonThesis, where the \addtotoc command is defined as

\newcommand{\addtotoc}[2]{
    \phantomsection
    \addcontentsline{toc}{chapter}{#1}
    #2 \clearpage
}

and the definition makes clear why a new page is started. It's quite difficult to understand what's the intended usage of this macro, but it's rather clear that it doesn't suit your needs.

If your sections are never numbered, you solve all problems by saying

\setcounter{secnumdepth}{0}

in your document preamble and then using \section{Section Title} without any other code.

An occasional unnumbered section can be treated by

\phantomsection
\section*{My section}
\addcontentsline{toc}{section}{My section}

You might want to define a special command:

\newcommand{\usection}[1]{%
  \phantomsection
  \section*{#1}
  \addcontentsline{toc}{section}{#1}
}
share|improve this answer
    
Ah, \addcontentsline was the command I really should have used! Thank you very much! :) –  StrawberryFieldsForever Aug 13 '12 at 11:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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