146

I'm fairly new to LaTeX and I want to know how to change the way sections are numbered by default. I use LyX, and there it is relatively simple to change the way an enumeration is numbered, i.e.

1 foo
 a bar
   i baz

But I want to know if there is a way to do this by default for sections and subsections.

2 Answers 2

211

You change section numbering by redefining the commands used to generate each section number. For example, the default article class uses something like

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

with similar commands like \thesubsubsection and so on -- of course, there's also \thechapter (in the book and report class) and \thepart. Commands to typeset numbers include:

  • \arabic (1, 2, 3, ...)
  • \alph (a, b, c, ...)
  • \Alph (A, B, C, ...)
  • \roman (i, ii, iii, ...)
  • \Roman (I, II, III, ...)
  • \fnsymbol (∗, †, ‡, §, ¶, ...)
6
  • 11
    If you have any more expertise or examples to add to this answer, I think this would be a good question to serve as a "canonical" question with a widely applicable and extensive answer. I suppose widening the scope of the question a bit would be acceptable as well, even though it's pretty open already. I might come back to this question when I have some time and look into it. The 2.5k views are promising for sure.
    – doncherry
    Sep 30, 2012 at 0:53
  • By any chance, do you maybe know, if (or how) can I define my own set of expressions, to be used in similar way as these typesets above?
    – Kusavil
    Feb 5, 2017 at 0:17
  • 1
    @Kusavil Your best bet is to look at the definition of \fnsymbol in source2e.pdf and go from there. Feb 5, 2017 at 0:18
  • Dear @WillRobertson, please, how can I do to add only the first chapter as 0 and the remaining chapters as roman? I tried your answer but it erases the "0" in the first chapter Jul 26, 2020 at 21:35
  • 1
    @DaniloGregorin That sounds...weird. You probably want to define your own \RomanMinusOne command. Better to ask a new question. Jul 28, 2020 at 7:39
10

EDIT: As @Johannes_B pointed out, def is an inappropriate command for general use. The other answer still works.


Another way to do this is to put the command

\def\thesection{\alph{section}}

in the preamble, where alph can be susbtituted for arabic, roman etc as detailed in the other answer.

See:

http://wiki.lyx.org/FAQ/Numbering#sec-numbering

1
  • 11
    Hi and welcome, def is a low level command and should be used by experienced users exclusively. It is much better to do renewcommand if needed. There is a whole security mechanism behind the scene that def does not have.
    – Johannes_B
    Apr 7, 2015 at 12:52

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.