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 am new to LaTex and I am writing a document where I do not want my sections to be numbered. I did a quick google search and found this line of code to turn them off: \setcounter{secnumdepth}{0} % Turns off numbering for sections. However, when using this, I notice that my second level items in my TOC are not indenting properly. You can see here that I have a chapter and underneath that chapter is the first section; however, it is on the same indentation level as the chapter. Is there a way to correct this so my sections appear indented? Also if there is a better way to disable section numbering, please let me know. Thanks!

The section "Solving Difficult Linear Equations" is not indented from the chapter "Fundamental Algebraic Skills"

share|improve this question
    
What document class are you using? –  Werner May 7 '12 at 6:11
    
I am using the report document class. –  agentbanks217 May 7 '12 at 6:19

2 Answers 2

The following suggestion re-inserts the \numberline component of the ToC entry for all sectional units higher than secnumdepth. So, you'll get the original spacing of \section, \subsection,... in the ToC:

enter image description here

\documentclass{report}
\setcounter{secnumdepth}{0}% % Turns off numbering for sections
\makeatletter
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\patchcmd{\@sect}% <cmd>
  {\else \protect}% <search>
  {\protect\numberline{}\else\protect}% <replace>
  {}{}% <success><failure>
\makeatother    
\begin{document}
\tableofcontents
\chapter{Fundamental Algebraic Skills}
\section{Solving Difficult Linear Equations}
\subsection{Linear Equations that Contain Fractions}
\end{document}

etoolbox is used to patch \@sect, adding an empty \numberline as part of the test on secnumdepth.

share|improve this answer

You can probably be satisfied with

\makeatletter
\renewcommand{\l@section}{\@dottedtocline{1}{2.5em}{2.3em}}
\makeatother

The usual definition is

\@dottedtocline{1}{1.5em}{2.3em}

so your section will be 1em more to the right than before.

share|improve this answer

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.