0

I would like to have headings for sections and subsections in the body of the document, where the numbers in the heading show only the "section" or "subsection" level, and do not show the numbers for the part and chapter level at the beginning.

So, for exapmle, instead of II.1.2.3., I just want 2.3.

I found a threat for ConTeX for this issue, but no solution for LaTeX yet. This is the link: Compound/nested section numbers in ConTeXt: how to omit the top level? E.g. 1.2.1 --> 2.1

  • 2
    Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format. Perhaps counterwithout could be useful here? Could you provide a small minimal working example (MWE) for us to play with- the documentclass is particularly important – cmhughes Oct 26 '13 at 22:29
1

As cmhughes said, it is important to know the documentclass, however, presuming you are dealing with a class that has chapters (say book or report), normally the number format makes recursive calls like this:

\renewcommand{\thechapter}{\arabic{chapter}}
\renewcommand{\thesection}{\thechapter.\arabic{section}}
\renewcommand{\thesubsection}{\thesection.\arabic{subsection}}

This comes from the fact that when a counter is created via:

\newcounter{XXX}

A macro \theXXX is also created. This macro (\theXXX) is responsible for how the counter is formated / displayed. chapter, section, subsection, subsubsection, figure, table, etc... are all examples of counters used in the most basic documents, which also have corresponding formatting commands (\thechapter, \thesection, \thesubsection, \thesubsubsection, \thefigure and \thetable, respectively) These macro can be redefined, it doesn't alter the value of the counter, only the way it is typeset in the document, including making reference (if one wishes) to other counters, as is the nature of your query.

In the above demonstration of the typical recursive call, thesubsection label calls thesection, which in turn also calls thechapter. So therefore, if you are not interested in having thechapter as part of your numbering schema, renew thesection to something like this:

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

Incidentally, if you prefer letters, or roman numerals, for a counter XXX, the display format also has several options, for numbers, letters, roman numerals, here are the options:

\arabic{XXX}= 1,2,3,...
\alph{XXX}  = a,b,c,...
\Alph{XXX}  = A,B,C,...
\roman{XXX} = i,ii,iii,iv,...
\Roman{XXX} = I,II,III,IV,...

Here is a MWE which you can run.

\documentclass{book}

\renewcommand{\thesection}{\arabic{section}}
\begin{document}

\chapter{Chapter Heading}
\section{Section Heading}
\subsection{Subsection Heading}


\end{document}

Which produces the following output, showing how \thesection makes no reference to \thechapter, as your initial question proposed.

Output

  • Thank you so much for your quick response! It did work out very nicely, and with such a simple solution! – Danji Oct 27 '13 at 9:52
  • @Danji. No problem! – Nicholas Hamilton Oct 27 '13 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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