1

My sections are numbered arabic. I want to get subsection numbering also arabic as 1.1, 1.2, 1.3 etc. I have searched many forums and got these codes but it does not work for me. People say it works for us. I am using this code.

\def\thesection{\arabic{section}}
\def\thesubsection{\arabic{section}.\arabic{subsection}}
\def\thesubsubsection{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}

Only the first instruction works. I also used \renewcommand instead of \def.

4
  • This should work. Use a recursive definition \renewcommand{\thesection}{\arabic{section}} \renewcommand{\thesubsection}{\thesection.\arabic{subsection}} \renewcommand{\thesubsubsection}{\thesubsection.\arabic{subsubsection}} instead. Why doesn't it work for you? What are you doing differently? Perhaps include a minimal working example (MWE) that highlights your problem.
    – Werner
    Jul 13, 2013 at 15:39
  • Thanks for answering. But it does not work.
    – Imran Kanjoo
    Jul 13, 2013 at 16:57
  • You did see that I asked you a bunch of other questions as well, right? I'll reiterate: "Why does it not work when it works on 'many forums' for other people? What are you doing differently? Include a minimal working example (MWE) that highlights your problem."
    – Werner
    Jul 14, 2013 at 4:20
  • Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question.
    – Werner
    Jul 15, 2013 at 5:15

1 Answer 1

3

There are classes that use \Alph for subsections. Example revtex4-1:

\documentclass{revtex4-1}

\begin{document}
\tableofcontents
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\end{document}

revtex4-1, default

However, redefining the counter macro \the<counter> usually works as expected:

\documentclass{revtex4-1}

\makeatletter
\renewcommand*{\thesection}{\arabic{section}}
\renewcommand*{\thesubsection}{\thesection.\arabic{subsection}}
\renewcommand*{\p@subsection}{}
\renewcommand*{\thesubsubsection}{\thesubsection.\arabic{subsubsection}}
\renewcommand*{\p@subsubsection}{}
\makeatother

\begin{document}
\tableofcontents
\section{Section}
\label{sec}
\subsection{Subsection}
\label{subsec}
\subsubsection{Subsubsection}
\label{subsubsec}
References: \ref{sec}, \ref{subsec}, and \ref{subsubsec}.
\end{document}

Result

3
  • If you say \label{x} after the \subsubsection and then \ref{x}, you get 1 1.1 1.1.1 because revtex4-1 redefines \p@subsubsection to \thesection\,\thesubsection\, (and also \p@subsection, of course).
    – egreg
    Jul 15, 2013 at 9:21
  • @egreg: Thanks. I have updated the question. Jul 15, 2013 at 10:12
  • I was bitten by this problem, this is why I remember it. ;-)
    – egreg
    Jul 15, 2013 at 10:17

Your Answer

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