emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* headline numbering in html export
@ 2010-02-02  8:17 "Martin G. Skjæveland"
  2010-02-02 14:12 ` Bill Powell
  0 siblings, 1 reply; 2+ messages in thread
From: "Martin G. Skjæveland" @ 2010-02-02  8:17 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I thought I'd share some stuff I'm quite happy with so that others can 
enjoy it if it is good, and so that I can stop using or improve it if it 
is not so good! :)

I am writing a set of exercises for a course and publishing a chapter 
once a week in both pdf and html. I like having the exercises for week 2 
start the headline numbering with 2 (and so on), so for the latex export 
I set the section counter to the appropriate value, in this example 
(week 2):

   #+LATEX_HEADER: \setcounter{section}{1}

For the html export I could not find a similar easy setting, but then I 
found that css2 has introduced counters:

   http://www.w3.org/TR/CSS2/generate.html#counters

So by adding the css stylesheet below, I can start my numbering for html 
in a similar fashion as for pdf export:

   #+STYLE: <style>h1{counter-reset:section 1;}</style>


Thanks!
Martin

----------------

The stylesheet:

#+begin_src css :tangle exercises.css
/*
    Do not display numbering entered by org-mode,
    but use css2 counters instead.
  */
.section-number-2,
.section-number-3,
.section-number-4,
.section-number-5
{
   display: none;
   }
h2
{
   counter-reset:subsection;
   }
h2:before
{
   counter-increment:section;
   content:counter(section);
   }
h2.footnotes:before
{
   content:"";
   }
h3
{
   counter-reset:subsubsection;
   }
h3:before
{
   counter-increment:subsection;
   content:counter(section) "." counter(subsection) " ";
   }
h4:before
{
   counter-increment:subsubsection;
   content:counter(section) "." counter(subsection) "." 
counter(subsubsection) " ";
   }
#+end_src

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-02-02 14:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-02  8:17 headline numbering in html export "Martin G. Skjæveland"
2010-02-02 14:12 ` Bill Powell

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).