Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4093220
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:35:26+00:00 2026-05-20T19:35:26+00:00

I am writing a document where I do not want subsection numbering to show

  • 0

I am writing a document where I do not want subsection numbering to show in the TOC (I want the subsection heading visible in the TOC) but I want the subsection numbering to show in the actual document heading.

This is what I want

Table of Contents
1. Chapter One
 1.1 Section One
       SubSection One

Chapter 1
Chapter One
Some chapter text

1.1 Section One
Some text

1.1.1 Subsection One
Some text

I tried using \setcounter{secnumdepth}{1} but this removes the number even from the section heading so what I have is,

Table of Contents
1. Chapter One
 1.1 Section One
       SubSection One

Chapter 1
Chapter One
Some chapter text

1.1 Section One
Some text

Subsection One
Some text

Is it possible to get the section number in the document heading but not in the TOC entry?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T19:35:27+00:00Added an answer on May 20, 2026 at 7:35 pm

    In a latex example (using the “article” class), I get this in the .toc file:

    \contentsline {section}{\numberline {1}test section without number}{1}{section.1}
    

    The important part here is the \numberline macro. Redefining it to something empty like

    \def\numberline#1{}
    

    will remove all numberings in the toc and not elsewhere.
    If you get something like \tocsubsection instead in the .toc (see other answer), then you can probably do something like:

    \let\oldtocsubsection=\tocsubsection
    \def\tocsubsection#1#2#3{\oldtocsubsection{#1}{}{#3}}
    

    However, this removes all numbers in the table of contents. If you want to control at which level the numbering disappear, the \contentsline macro expands to different macros depending on the context, e.g., \l@section. Those macros in turn use the generic \@dottedtocline macro. This is the one you need to modify, in which we will conditionally redefine \numberline.

    To have control on the depth at which to stop displaying numbers, let us define a new counter:

    \newcounter{sectocnonumdepth}
    \setcounter{sectocnonumdepth}{2}
    

    Then the conditional redefinition will be following line (extracted from the code for more readability).

     \ifnum #1>\c@sectocnonumdepth \def\numberline##1{}\fi%
    

    I simply copy-pasted the definition of \@dottedtocline from the latex.ltx source file, and added the check inside. Here is the code for the whole example:

    \newcounter{sectocnonumdepth}
    \setcounter{sectocnonumdepth}{2}
    
    
    \makeatletter
    \def\@dottedtocline#1#2#3#4#5{%
      \ifnum #1>\c@tocdepth \else
        \vskip \z@ \@plus.2\p@
        {\ifnum #1>\c@sectocnonumdepth \def\numberline##1{}\fi%
         \leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
         \parindent #2\relax\@afterindenttrue
         \interlinepenalty\@M
         \leavevmode
         \@tempdima #3\relax
         \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
         {#4}\nobreak
         \leaders\hbox{$\m@th
            \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
            mu$}\hfill
         \nobreak
         \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5}%
         \par}%
      \fi}
    \makeatother
    

    Final note: this will make the title of section and subsection to start at the same horizontal position, since there is no number to display. If you want more padding, you can for instance add \quad to the new definition of \numberline, or to even use the original definition with just the #1 removed:

    \def\numberline##1{\hb@xt@\@tempdima{\hfil}}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing this code for an extension but It returns: Origin chrome-extension://gjganecebobheilkbpmhmocibjckgidc is not
Pretty simple question, I'm writing an XML document and i'm not sure how to
I am writing an XML document in C#. I have something like this... string
I'm writing a Sweave document, and I want to include a small section that
Here is what I have, but it is not working: if(window.width() < 1000) document.getElementsByTagName('body')[0].id=be
I am writing a document with Emacs. As you know, there are some code
I have seen people writing $(document).ready(function(){ }); and some writing $(function() { }); What's
I'm writing a simple document management system for my work. I'm only a hobbyist
How many people actually write an SDD document before writing a single line of
I'm writing what boils down to a document editor. When the application is closing,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.