emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "\"Martin G. Skjæveland\"" <martige@ifi.uio.no>
To: emacs-orgmode@gnu.org
Subject: headline numbering in html export
Date: Tue, 02 Feb 2010 09:17:22 +0100	[thread overview]
Message-ID: <4B67DF92.4040506@ifi.uio.no> (raw)

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

             reply	other threads:[~2010-02-02  8:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-02  8:17 "Martin G. Skjæveland" [this message]
2010-02-02 14:12 ` headline numbering in html export Bill Powell

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=4B67DF92.4040506@ifi.uio.no \
    --to=martige@ifi.uio.no \
    --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).