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 would very much like that the the appendix sections of the Table of Contents doesn't have a section numbers, dots, and page numbers. If I do the following

\documentclass{article}
\usepackage{tocloft}
\addtocontents{toc}{\cftpagenumbersoff{section}}
\renewcommand{\cftdot}{}
\begin{document}
\tableofcontents
\newpage
\section{Appendix}
\section*{Another Letter} \addcontentsline{toc}{section}{Another Letter}
\end{document}

then the section "Another Letter" is left aligned, so it doesn't look like the others.

Question

Is it possible to have "Another Letter" styled the same way as normal TOC entries, but just without section number, dots, and page number?

share|improve this question
2  
There is an error, it should be \addcontentsline{toc}{section}{Another Letter} –  karlkoeller Sep 24 '13 at 16:35
    
Thanks. That fixed the bold issue. –  Sandra Schlichting Sep 24 '13 at 16:42
    
What about sections before the appendix? –  egreg Sep 24 '13 at 16:55
    
@egreg They should be normal and unaffected. –  Sandra Schlichting Sep 24 '13 at 16:56
    
@SandraSchlichting Should \section{Appendix} in the text receive a number? –  egreg Sep 24 '13 at 17:13
add comment

1 Answer 1

up vote 4 down vote accepted

I don't know whether this really answers your question. Basically, I patch the \appendix command to suppress numbering of sections; then it also issues some commands to be written in the toc file to change the behavior from that point on. The double \unexpanded trick is for avoiding several \protect in front of macro names.

As far as I know, leaders are off for section titles in the article class to begin with, so there's no need to act on \cftdot.

\documentclass{article}

\usepackage[titles]{tocloft}
\usepackage{etoolbox}

\appto\appendix{%
  \setcounter{secnumdepth}{-2}
  \addtocontents{toc}{%
    \unexpanded{\unexpanded{%
      \cftpagenumbersoff{section}%
      \setlength\cftsecindent{\cftsecnumwidth}%
    }}%
  }%
}

\begin{document}

\tableofcontents
\clearpage

\section{This has the section number also in the TOC}


\appendix
\section{Appendix}

\section{Another Letter}

\end{document}

enter image description here

share|improve this answer
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.