4

The default in lyx is to have

I. First part (roman number)

  1. Section 1

1.1 Subsection 1

and I'd like to have

  1. First part (arabic number)

1.1 Section 1

1.1.1 Subsection 1

etc.

Any suggestion? Thanks a lot in advance!

2
  • This may be a stupid comment/question, but you do know that other documentclasses (report- and book-type classes) provide a chapter level in addition to part and section? The default numbering of chapters/sections is as you wish, without customization. Commented Aug 29, 2012 at 18:03
  • (Addendum: the thought being that you use chapters instead of parts.) Commented Aug 29, 2012 at 18:19

1 Answer 1

2

No idea if this is the preferred LyX way (I haven't really ever used it)… you can add

\renewcommand*\thepart{\arabic{part}}% arabic numbers for part
\makeatletter
\@addtoreset{section}{part}% reset section number when a new part starts
\makeatother
\renewcommand*\thesection{\thepart.\arabic{section}}% section 1.1
\renewcommand*\thesubsection{\thesection.\arabic{subsection}}% subsection 1.1.1

to your documents preamble. In LyX go to Document > Settings… > LaTeX Preamble.

This has one drawback, though: the WYSIWYG (WYM?) won't be WYG any more. In your editor the numbering stays as before. But in the PDF the numbering will have changed.

Edit (reply to the comment below): the following is assuming you're using the standard article class. In the article class the ToC entry for the section is controlled by \l@section. You can patch that command to change the space reserved for the section number. This again goes in the LaTeX preamble:

\usepackage{etoolbox}
\makeatletter
\patchcmd\l@section
  {\setlength\@tempdima{1.5em}}% this is default
  {\setlength\@tempdima{2em}}% this is new; change value to your needs
  {}{}
\makeatother
5
  • Many thanks for your prompt reply, this works perfectly!!!! I had tried so many different specifications but couldn't make it work... Thanks a lot! The only thing is that now in the table of content, there is no space between the figure and the heading, i.e. for example "1 Part 1" (there is a space) but "1.1Section 1" (no space before the section)... and it works fine with the subsection "1.1.1 Subsection". Any idea why lyx drop the space in the TOC? The headings in the text look fine though...
    – Laure
    Commented Aug 30, 2012 at 9:23
  • @Laure You're welcome. Regarding your follow-up question please see my updated answer.
    – cgnieder
    Commented Aug 30, 2012 at 11:56
  • Thanks a lot cgnieder!!! It works magically :) and I could also add some extra space to the subsection. I could have never figured it out without your help!
    – Laure
    Commented Aug 30, 2012 at 13:14
  • @Laure Just as a disclaimer: I am no LyX user at all so there might be preferred LyX-ways over my proposal. Also: this is a bit of hackery. There are cleaner (but not necessarily shorter) ways to do this (for instance using special packages).
    – cgnieder
    Commented Aug 30, 2012 at 13:39
  • @Laure I just noticed your new question. If this is for the same document remove all this stuff and set the document class to book or report (Document > Settings > Document Class). You'll then be able to insert chapters instead of parts and the numbering will look like this modified article.
    – cgnieder
    Commented Aug 30, 2012 at 15:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .