6

So, for variety's sake I'd like lists and sublists to have different styles. In emacs, I've enabled org-list-allow-alphabetical, but this doesn't work with export (not a bug). However, there doesn't seem to be any simple way to change styles without adding extensive latex or html code to the file.

For example, with a list like this,

1. Parent
   1. child

I'd like to use a different marker for the sublist, to avoid confusion, eg

1. Parent
   a) child

Latex seems to do this rather well by default. Is there a way to specify it for other exporters?

6

The html output from the exporter is just nested ol lists without any labels. To alter the labels you can use CSS:

#+HTML_HEAD: <style type="text/css">
#+HTML_HEAD:  ol ol { list-style-type: lower-alpha; }
#+HTML_HEAD: </style>

  1. first
  2. second
     a. sub
     b. under
  3. third

Sample output

To change the fullstops after the labels to something else see https://stackoverflow.com/q/5945161/4050592 for appropriate CSS.

Note that you can use the #+ATTR_HTML to add specific attributes to elements including a list. This way you can make specific styling, such as:

#+HTML_HEAD: <style type="text/css">
#+HTML_HEAD:  ol#al { list-style-type: upper-alpha; }
#+HTML_HEAD: </style>

#+ATTR_HTML: :id al
  1. first
  2. second
  3. third

Styled sample

  • Is it possible to have a more local change? This would impact all the ol ol's around. – Michaël Jul 9 '19 at 22:15
  • @Michaël You can use <div>s and have different css styles for different sections. – Andrew Swann Jul 12 '19 at 9:33
  • Would you mind indicating how to specify an ID in Org? Thanks! – Michaël Jul 12 '19 at 11:08
  • @Michaël Example added – Andrew Swann Jul 20 '19 at 12:19
  • Fantastic, thanks very much. – Michaël Jul 20 '19 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.