10

Is there a switch on org-mode I can use on export to ODT (or other format) to format my source file of

This is a paragraph this is a paragraph this is a paragraph this is a paragraph this is a paragraph this is a paragraph this is a paragraph this is a paragraph this is a paragraph.

This is another paragraph this is another paragraph this is another paragraph this is another paragraph this is another paragraph this is another paragraph this is another paragraph this is another paragraph.

into:

     This is a paragraph this is a paragraph this is a paragraph this is a
paragraph this is a paragraph this is a paragraph this is a paragraph
this is a paragraph this is a paragraph.
     This is another paragraph this is another paragraph this is another
paragraph this is another paragraph this is another paragraph this is
another paragraph this is another paragraph this is another paragraph.

3 Answers 3

3

Since you mentioned "other format" also, here's a solution for LaTex:

#+LaTeX_HEADER: \setlength{\parindent}{1cm} % Default is 15pt.

Insert the above line at the top of your org file and use the LaTex back-engine to print.

6
  • This is promising, but I'd still love an avenue to get me to an ODT file. If I export to LaTex, I can continue on to a PDF, but is there a way to get from LaTeX to ODT? Commented Jun 13, 2015 at 18:37
  • Sure there are several tools that can get you from TEX->ODT depending on your OS. TeX2Word, GrindEQ, Latex2RTF, TeX4HT and others like that come to mind. Some of these may require an intermediate step of creating html, doc, or rtf formats. But with a little scripting this entire workflow can be automated. mk4ht on ubuntu is a popular solution as well. If you don't mind loading additional development tools, consider a modern solution like pandoc, which is the swiss army knife of conversion tools between various markup languages.
    – Emacs User
    Commented Jun 13, 2015 at 19:39
  • I looked at pandoc, and that seems like a great utility. Would you be willing to add a strategy above that used pandoc to get from LaTeX to ODT? It would be a huge help to me, and I'd elect it as my answer. Thank you! Commented Jun 14, 2015 at 0:38
  • I think you already have your answer here. But you're looking for a specific implementation solution for which you should investigate other mechanisms instead of wrongfully dangling a carrot that your'd elect my answer. If you had already accepted and then asked for additional assistance, I would have considered. No thanks.
    – Emacs User
    Commented Jun 14, 2015 at 1:04
  • 1
    You can use pandoc directly on the org-mode file. Paragraphs get marked up with a particular style which you could then customise. Commented Jun 15, 2015 at 12:58
1

Does the image below capture what you have in mind?

Paragraph with First Line Indent

If yes, try the snippet below. For the snippet to work, you need to install the The enhanced ODT exporter with M-x package-install.

#+odt_extra_styles: <style:style style:name="Text_20_body"
#+odt_extra_styles:              style:parent-style-name="Standard"
#+odt_extra_styles:              style:display-name="Text body"
#+odt_extra_styles:              style:family="paragraph"
#+odt_extra_styles:              style:class="text">
#+odt_extra_styles:   <style:paragraph-properties fo:margin-bottom="0.212cm"
#+odt_extra_styles:                               fo:margin-left="0cm"
#+odt_extra_styles:                               fo:margin-right="0cm"
#+odt_extra_styles:                               fo:margin-top="0cm"
#+odt_extra_styles:                               fo:text-indent="0.64cm"
#+odt_extra_styles:                               style:auto-text-indent="false" />
#+odt_extra_styles: </style:style>

#+odt_extra_styles: <style:style style:name="List_20_body"
#+odt_extra_styles:              style:parent-style-name="Text_20_body"
#+odt_extra_styles:              style:list-style-name="OrgNumberedList"
#+odt_extra_styles:              style:display-name="List body"
#+odt_extra_styles:              style:family="paragraph">
#+odt_extra_styles:   <style:paragraph-properties fo:margin-left="0cm"
#+odt_extra_styles:                               fo:margin-right="0cm"
#+odt_extra_styles:                               fo:text-indent="0cm"
#+odt_extra_styles:                               style:auto-text-indent="false" />
#+odt_extra_styles: </style:style>

This is a paragraph this is a paragraph this is a paragraph this is a
paragraph this is a paragraph this is a paragraph this is a paragraph
this is a paragraph this is a paragraph.

This is another paragraph this is another paragraph this is another
paragraph this is another paragraph this is another paragraph this is
another paragraph this is another paragraph this is another paragraph.

#+ATTR_ODT: :p-style "List_20_body"
1. This is a item this is a item this is a item this is
   a item this is a item this is a item this is a
   item this is a item this is a item.

   1. This is a sub item this is a sub item this is a sub item this is
      a sub item this is a sub item this is a sub item this is a sub
      item this is a sub item this is a sub item.

   2. This is a sub item this is a sub item this is a sub item this is
      a sub item this is a sub item this is a sub item this is a sub
      item this is a sub item this is a sub item.

   This is another paragraph this is another paragraph this is another
   paragraph this is another paragraph this is another paragraph this
   is another paragraph this is another paragraph this is another
   paragraph.

2. This is a item this is a item this is a item this is
   a item this is a item this is a item this is a
   item this is a item this is a item.

   - This is a sub item this is a sub item this is a sub item this is
     a sub item this is a sub item this is a sub item this is a sub
     item this is a sub item this is a sub item.

   - This is a sub item this is a sub item this is a sub item this is
     a sub item this is a sub item this is a sub item this is a sub
     item this is a sub item this is a sub item.

The style configuration will look a bit overwhelming, at first. You can learn about it in

  1. Create a stylesheet for your OpenDocument files, and inline the XML definitions right in your Org file–Think HTML_HEAD, or HTML_HEAD_EXTRA but for ODT / DOCX files

  2. Applying custom styles through keywords .

0

http://orgmode.org/manual/Applying-custom-styles.html#Applying-custom-styles

^^ This is what I did. The page has instructions to generate an empty ODT template. Then you can go into LibreOffice, edit the Text Body paragraph style to set the first-line indent, and save the template.

Then add #+ODT_STYLES_FILE: "/path/to/my-stylesheet.odt" (or ott, depending how you saved it) into your org document. The exported ODT file will use the style definitions from your template, instead of the defaults.

Worked for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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