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


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to