1

Try to get a kind of letter with the sender on left side and the receiver on right side. I can use "indent to" that's ok in Emacs but when exporting to html or pdf the indentation characters are swiped out .. Can someone tell me how to get this working in pdf, html or odt format ? Thk

Org-mode with "indent to" picture .. Emacs Org-mode Pdf result .. Pdf export

FWIW, this is a verbatim reproduction of https://stackoverflow.com/questions/72755221/org-mode-how-to-write-addr-block-and-export-to-pdf-correctly

1 Answer 1

1

There are three different ways to get side-by-side text

  1. Using Verse Blocks, with Tabs to separate out the columns
  2. Using Tables
  3. Using Textboxes (within Tables)

I will outline the solution for each of the methods. The solution I outline will be for ODT export using the the /enhanced/ ODT exporter. Note that this exporter is NOT part of standard Emacs / Org mode. So, it has to be installed separately. See Installation Instructions for more details.

The second and third examples uses Transcluded Tables. So, you need to do enable it explicitly with

(add-to-list 'org-odt-experimental-features
         'transclude-sole-footnote-references-in-a-table)

Side-by-side text using Verse Blocks

To get this

Side-by-Side text using Verse Block and Tab

do this

(Note that there are tab characters in the verse block below)


#+odt_preferred_output_format: pdf

#+ATTR_ODT: :target "extra_styles"
#+begin_src nxml
<style:style style:name="MyOrgVerse"
             style:parent-style-name="Standard"
             style:family="paragraph">
  <style:paragraph-properties fo:margin-bottom="0.199cm"
                              fo:margin-top="0cm">
    <style:tab-stops>
      <style:tab-stop style:position="11cm" />
    </style:tab-stops>
  </style:paragraph-properties>
</style:style>
#+end_src

#+ATTR_ODT: :style "MyOrgVerse"
#+begin_verse
Free Software Foundation             The Linux Foundation      
51 Franklin Street, Fifth Floor      548 Market St             
Boston, MA 02110                     PMB 57274                 
USA                                  San Francisco, California 
                                     94104-5401 US             
#+end_verse

Proident, excepteur ea aliqua commodo qui duis officia cupidatat
consectetur velit sint dolore ullamco.  Eiusmod velit esse aliqua sint
et culpa proident, in pariatur laborum fugiat laborum lorem mollit
est.  Reprehenderit ipsum consequat lorem est labore amet, quis ut eu
mollit reprehenderit proident, incididunt aute reprehenderit.  Do
commodo in nostrud occaecat adipiscing tempor lorem sint nulla anim
aliqua sint.  Veniam, sunt quis excepteur ut lorem tempor ad.


Side-by-Side text using a Table

To get this

Side-by-Side Text using Tables

do this


#+odt_preferred_output_format: pdf

#+ATTR_ODT: :col-cookies "|2|1|"
| [fn:1] | [fn:2] |

Proident, excepteur ea aliqua commodo qui duis officia cupidatat
consectetur velit sint dolore ullamco.  Eiusmod velit esse aliqua sint
et culpa proident, in pariatur laborum fugiat laborum lorem mollit
est.  Reprehenderit ipsum consequat lorem est labore amet, quis ut eu
mollit reprehenderit proident, incididunt aute reprehenderit.  Do
commodo in nostrud occaecat adipiscing tempor lorem sint nulla anim
aliqua sint.  Veniam, sunt quis excepteur ut lorem tempor ad.

[fn:1]

Free Software Foundation\\
51 Franklin Street, Fifth Floor\\
Boston, MA 02110\\
USA

[fn:2]

The Linux Foundation\\
548 Market St\\
PMB 57274\\
San Francisco, California\\
94104-5401 US

Side-by-Side Text using Textboxes in a Table

To get this

Side by Side text using Textbox in a Table

do this


#+odt_preferred_output_format: pdf

| [fn:1] | [fn:2] |

Proident, excepteur ea aliqua commodo qui duis officia cupidatat
consectetur velit sint dolore ullamco.  Eiusmod velit esse aliqua sint
et culpa proident, in pariatur laborum fugiat laborum lorem mollit
est.  Reprehenderit ipsum consequat lorem est labore amet, quis ut eu
mollit reprehenderit proident, incididunt aute reprehenderit.  Do
commodo in nostrud occaecat adipiscing tempor lorem sint nulla anim
aliqua sint.  Veniam, sunt quis excepteur ut lorem tempor ad.

[fn:1]

#+ATTR_ODT: :style "OrgTextBoxFrameFlushLeft"
#+begin_textbox
Free Software Foundation\\
51 Franklin Street, Fifth Floor\\
Boston, MA 02110\\
USA
#+end_textbox

[fn:2]

#+ATTR_ODT: :style "OrgTextBoxFrameFlushRight"
#+begin_textbox
The Linux Foundation\\
548 Market St\\
PMB 57274\\
San Francisco, California\\
94104-5401 US
#+end_textbox


#+ATTR_ODT: :target "extra_styles"
#+begin_src nxml
<style:style style:name="OrgTextBoxFrameFlushRight"
             style:parent-style-name="OrgTextBoxFrame"
             style:family="graphic">
  <style:graphic-properties fo:border="none"
                            fo:padding="0.15cm"
                            style:horizontal-pos="right"
                            style:horizontal-rel="paragraph-content"
                            style:vertical-pos="top"
                            style:vertical-rel="paragraph" />
</style:style>
<style:style style:name="OrgTextBoxFrameFlushLeft"
             style:parent-style-name="OrgTextBoxFrame"
             style:family="graphic">
  <style:graphic-properties fo:border="none"
                            fo:padding="0.15cm"
                            style:horizontal-pos="left"
                            style:horizontal-rel="paragraph-content"
                            style:vertical-pos="top"
                            style:vertical-rel="paragraph" />
</style:style>
#+end_src

Additional Note on using Textboxes

You can use textboxes to position text wherever you want.

For example, if you merely want the textboxes in the above example to be positioned right or left, and you are OK with those textboxes being staggered like so

A formal Indian-style letter

Positioning Text using Textboxes

then do this


#+odt_preferred_output_format: pdf

#+ATTR_ODT: :style "OrgTextBoxFrameFlushRight"
#+begin_textbox
*From*

Free Software Foundation\\
51 Franklin Street, Fifth Floor\\
Boston, MA 02110\\
USA
#+end_textbox

#+ATTR_ODT: :style "OrgTextBoxFrameFlushLeft"
#+begin_textbox
*To*

The Linux Foundation\\
548 Market St\\
PMB 57274\\
San Francisco, California\\
94104-5401 US
#+end_textbox

Pariatur quis est,

Voluptate sit ex irure sed adipiscing ad sed in proident. Cillum nisi
adipiscing dolore et aliqua cupidatat veniam, quis ut pariatur magna
laborum.  Minim consequat proident, excepteur consectetur elit,
nostrud sunt exercitation.  Laborum velit est laborum ipsum sit elit,
ex ipsum ipsum sint eiusmod cupidatat minim id anim laboris fugiat.
Aliquip qui labore ad incididunt deserunt sunt enim.

#+begin_center
Thanking You,
#+end_center

#+ATTR_ODT: :style "OrgTextBoxFrameFlushRight"
#+begin_textbox
Yours Sincerely,\\
Whitetrillium
#+end_textbox

#+ATTR_ODT: :target "extra_styles"
#+begin_src nxml
<style:style style:name="OrgTextBoxFrameFlushRight"
             style:parent-style-name="OrgTextBoxFrame"
             style:family="graphic">
  <style:graphic-properties fo:border="none"
                            fo:padding="0.15cm"
                            style:horizontal-pos="right"
                            style:horizontal-rel="paragraph-content"
                            style:vertical-pos="top"
                            style:vertical-rel="paragraph" />
</style:style>
<style:style style:name="OrgTextBoxFrameFlushLeft"
             style:parent-style-name="OrgTextBoxFrame"
             style:family="graphic">
  <style:graphic-properties fo:border="none"
                            fo:padding="0.15cm"
                            style:horizontal-pos="left"
                            style:horizontal-rel="paragraph-content"
                            style:vertical-pos="top"
                            style:vertical-rel="paragraph" />
</style:style>
#+end_src


Your Answer

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