emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] HowTo: Letter template method using yasnippet


From: Nicolas Goaziou
Subject: Re: [O] HowTo: Letter template method using yasnippet
Date: Sat, 07 Jul 2012 00:35:32 +0200

Hello,

Based on your work, I've put up the attached back-end:
org-koma-letter.el.

Quoting its documentation:

--8<---------------cut here---------------start------------->8---
This library implements a KOMA Scrlttr2 back-end, derived from the
LaTeX one.

Depending on the desired output format, three commands are provided for
export: `org-koma-letter-export-as-latex' (temporary buffer),
`org-koma-letter-export-to-latex' ("tex" file) and
`org-koma-letter-export-to-pdf' ("pdf" file).

On top of buffer keywords supported by `e-latex' back-end (see
`org-e-latex-options-alist'), this back-end introduces the following
keywords: "CLOSING" (see `org-koma-letter-closing'), "FROM_ADDRESS" (see
`org-koma-letter-from-address'), "LCO" (see
`org-koma-letter-class-option-file'), "OPENING" (see
`org-koma-letter-opening'), "PHONE_NUMBER" (see
`org-koma-letter-phone-number'), "SIGNATURE" (see
`org-koma-letter-signature') and "TO_ADDRESS".

You will need to add an appropriate association in `org-e-latex-classes'
in order to use the KOMA Scrlttr2 class.  For example, you can use the
following code:

  (add-to-list 'org-e-latex-classes
               '("my-letter"
                 "\\documentclass\[%
  DIV=14,
  fontsize=12pt,
  parskip=half,
  subject=titled,
  backaddress=false,
  fromalign=left,
  fromemail=true,
  fromphone=true\]\{scrlttr2\}
  \[DEFAULT-PACKAGES]
  \[PACKAGES]
  \[EXTRA]"
                 ("\\section\{%s\}" . "\\section*\{%s\}")
                 ("\\subsection\{%s\}" . "\\subsection*\{%s\}")
                 ("\\subsubsection\{%s\}" . "\\subsubsection*\{%s\}")))

Then, in your Org document, be sure to require the proper class with :

   #+LATEX_CLASS: my-letter

In this back-end, headlines are ignored during export.
--8<---------------cut here---------------end--------------->8---


You can test it on the following Org document:

--8<---------------cut here---------------start------------->8---
#+TITLE: About Org and letters
#+AUTHOR: Nicolas Goaziou

#+TO_ADDRESS: Someone \\
#+TO_ADDRESS: in some town

#+SIGNATURE: ngz

#+LATEX_CLASS: my-letter

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enimad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
--8<---------------cut here---------------end--------------->8---

It's far from being complete. See it as a proof of concept. Feel free to
upgrade it.


Regards,

-- 
Nicolas Goaziou

Attachment: org-koma-letter.el
Description: application/emacs-lisp


reply via email to

[Prev in Thread] Current Thread [Next in Thread]