13.12.5 Applying custom styles

The ODT export back-end comes with many OpenDocument styles (see Working with OpenDocument style files). To expand or further customize these built-in style sheets, either edit the style sheets directly or generate them using an application such as LibreOffice. The example here shows creating a style using LibreOffice.

Applying custom styles: the easy way

  1. Create a sample ‘example.org’ file with settings as shown below, and export it to ODT format.
    #+OPTIONS: H:10 num:t
    
  2. Open the above ‘example.odt’ using LibreOffice. Use the Stylist to locate the target styles, which typically have the “Org” prefix. Open one, modify, and save as either OpenDocument Text (ODT) or OpenDocument Template (OTT) file.
  3. Customize the variable org-odt-styles-file and point it to the newly created file. For additional configuration options, see Overriding factory styles.

    To apply an ODT style to a particular file, use the ‘ODT_STYLES_FILE’ keyword as shown in the example below:

    #+ODT_STYLES_FILE: "/path/to/example.ott"
    

    or

    #+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png"))
    

Using third-party styles and templates

The ODT export back-end relies on many templates and style names. Using third-party styles and templates can lead to mismatches. Templates derived from built-in ODT templates and styles seem to have fewer problems.