0

i run emacs 26.1, org 9.3.

i would like to modify the font used by the Text Body style when i export a file to odt.

i followed the instructions at https://orgmode.org/manual/Applying-custom-styles.html#Applying-custom-styles. but when i go looking in the 'stylist', there is only a single Org style there and not one that i'm interested in using or modifying.

& if i use a custom org export styles file, all of my other formatting in org is lost in the export process.

most of my text just uses the Text Body style. is there an easy way to copy/edit the OrgOdtStyles.xml do change the font of that style? or equally of 'Default Style'?

0

i would like to modify the font used by the Text Body style when i export a file to odt.

The easiest way for you to achieve what you want is to use the FORK of the ODT exporter (See Project Summary (OpenDocument Text Exporter for Emacs’ Org Mode)).

The keyword you are looking for is#+ODT_EXTRA_STYLES (See Applying custom styles (OpenDocument Text Exporter for Emacs’ Org Mode))

Here is a sample snippet and the corresponding output.

In the snippet,

  1. The Text Body style is modified to use Courier New
  2. The OrgVerse paragaph style--this is the style used by the verse block--is configured to use Comic Sans
#+odt_preferred_output_format: pdf

#+odt_extra_styles: <style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">
#+odt_extra_styles:  <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.212cm" loext:contextual-spacing="false">
#+odt_extra_styles:   <style:tab-stops/>
#+odt_extra_styles:  </style:paragraph-properties>
#+odt_extra_styles:  <style:text-properties style:font-name="Courier New1" fo:font-family="&apos;Courier New&apos;" style:font-style-name="Regular" style:font-family-generic="modern" style:font-pitch="fixed" fo:font-size="16pt"/>
#+odt_extra_styles: </style:style>

#+odt_extra_styles: <style:style style:name="OrgVerse" style:family="paragraph" style:parent-style-name="Preformatted_20_Text" style:master-page-name="">
#+odt_extra_styles:  <loext:graphic-properties draw:fill="none" draw:fill-color="#729fcf"/>
#+odt_extra_styles:  <style:paragraph-properties fo:margin-left="0.499cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false" style:page-number="auto" fo:background-color="transparent" fo:padding="0cm" fo:border="none" style:shadow="none">
#+odt_extra_styles:   <style:tab-stops>
#+odt_extra_styles:    <style:tab-stop style:position="1.0cm"/>
#+odt_extra_styles:   </style:tab-stops>
#+odt_extra_styles:  </style:paragraph-properties>
#+odt_extra_styles:  <style:text-properties style:font-name="Comic Sans MS" fo:font-family="&apos;Comic Sans MS&apos;" style:font-style-name="Regular" style:font-family-generic="script" style:font-pitch="variable" fo:font-size="12pt"/>
#+odt_extra_styles: </style:style>

This is a poem by Rudyard Kipling

#+begin_verse
If you can keep your head when all about you
    Are losing theirs and blaming it on you,
If you can trust yourself when all men doubt you,
    But make allowance for their doubting too;
If you can wait and not be tired by waiting,
    Or being lied about, don’t deal in lies,
Or being hated, don’t give way to hating,
    And yet don’t look too good, nor talk too wise:
#+end_verse

(In the above verse block, the indented line uses a SINGLE TAB)

Screenshot of ODT export


Btw, as you might have guessed, the user manual for the FORKED VERSION of ODT exporter is Top (OpenDocument Text Exporter for Emacs’ Org Mode).

| improve this answer | |
0

i would like to modify the font used by the Text Body style when i export a file to odt.

Instead of modifying the 'Text Bodystyle, you are likely to have better results if you modify the paragraph styleDefault Style`.

  • Note 1: that what LibreOffice UI labels as Default Style actually corresponds to Standard in styles.xml, and what it labels as Text Body actually corresponds to Text_20_body in styles.xml.

  • Note 2: The Text Body style (and all other paragraph styles) inherit from Standard style.

| improve this answer | |

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.