emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Vladimir Lomov <lomov.vl@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Change section (headings) numbering style
Date: Tue, 14 Jan 2014 21:43:59 +0900	[thread overview]
Message-ID: <20140114124359.GA898@smoon> (raw)
In-Reply-To: <52D4F70E.1000803@mac.com>

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

  parent reply	other threads:[~2014-01-14 12:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-14  8:36 Change section (headings) numbering style Axel E. Retif
2014-01-14  8:39 ` Sebastien Vauban
2014-01-14  9:18   ` Axel E. Retif
2014-01-14 12:43 ` Vladimir Lomov [this message]
2014-01-14 20:04   ` Axel E. Retif
2014-01-14 21:49   ` Axel E. Retif

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140114124359.GA898@smoon \
    --to=lomov.vl@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).