emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Change section (headings) numbering style


From: Vladimir Lomov
Subject: Re: [O] Change section (headings) numbering style
Date: Tue, 14 Jan 2014 21:43:59 +0900
User-agent: Mutt/1.5.22 (2013-10-16)

Hello,
** Axel E. Retif [2014-01-14 02:36:30 -0600]:

> Greetings!

> I need to change the numbering style of the first level sections (*) in the
> exported html file.

> Right now they are exported as

> 1 First section              ;; for * First section

> 1.1 First subsection         ;; for ** First subsection

> etc.

> For the first part of the document that's all right, but for the next part I
> need

> A First new section          ;; for * First new section

> A.1 First new subsection     ;; for ** First new subsection

> and so on.

> I've tried with different combinations of #+ATTR_HTML and #+OPTIONS with
> section-number-2 with no success.

I can suggest CSS way to accomplish this. I checked that it works with
firefox, but not sure for other browsers.

Minimal Org example:
#+BEGIN_SRC org

#+TITLE: An example
  ,#+OPTIONS: num:nil
  ,#+HTML_HEAD_EXTRA: <link rel="stylesheet" type="text/css" href="ex.css"/>

  ,* This is title on top level

  Text for document body.

  ,** Title for subtop level

  Text for body of subtop level.

  ,* This is title of next top level heading

  Text text text.

  ,** Title of second order

  Text text text.
#+END_SRC

Additional CSS
#+BEGIN_SRC css

body {
  counter-reset: level;
}
#table-of-contents > h2:before {
  content: normal;
  counter-increment: level;
}
h2:before {
  content: counter(level, upper-latin) "  ";
  counter-increment: level;
}
h2 {
  counter-reset: sublevel;
}
h3:before {
  content: counter(level, upper-latin) "." counter(sublevel) "  ";
  counter-increment: sublevel;
}
#+END_SRC

Note, that use have to turn off 'automatic' numbering when exporting
from Org, this is because export routine inserts numbers 'by-hand' don't
relying on CSS (imho, not bad because there are browsers that don't
support CSS, but it would be great to have option to switch this
on/off).

Second, in example only headings of two levels (top, subtop) will have
desired format.

---
WBR, Vladimir Lomov


-- 
The difference between the right word and the almost right word is the
difference between lightning and the lightning bug.
                -- Mark Twain



reply via email to

[Prev in Thread] Current Thread [Next in Thread]