File: ox-koma-letter.el.html
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 latex back-end (see
org-latex-packages-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,
- URL: see org-koma-letter-url,
- FROM_LOGO: see org-koma-letter-from-logo,
- SIGNATURE: see org-koma-letter-signature,
- PLACE: see org-koma-letter-place,
- LOCATION: see org-koma-letter-location,
- TO_ADDRESS: If unspecified this is set to "\\mbox{}".
TO_ADDRESS, FROM_ADDRESS, LOCATION, CLOSING, and SIGNATURE can also
be specified using "special headings" with the special tags
specified in org-koma-letter-special-tags-in-letter. LaTeX line
breaks are not necessary for TO_ADDRESS, FROM_ADDRESS and LOCATION.
If both a headline and a keyword specify a to or from address the
value is determined in accordance with
org-koma-letter-prefer-special-headings.
A number of OPTIONS settings can be set to change which contents is
exported.
- backaddress (see org-koma-letter-use-backaddress)
- foldmarks (see org-koma-letter-use-foldmarks)
- phone (see org-koma-letter-use-phone)
- url (see org-koma-letter-use-url)
- from-logo (see org-koma-letter-use-from-logo)
- email (see org-koma-letter-use-email)
- place (see org-koma-letter-use-place)
- location (see org-koma-letter-location)
- subject, a list of format options
(see org-koma-letter-subject-format)
- after-closing-order, a list of the ordering of headings with
special tags after closing (see
org-koma-letter-special-tags-after-closing)
- after-letter-order, as above, but after the end of the letter
(see org-koma-letter-special-tags-after-letter).
The following variables works differently from the main LaTeX class
- AUTHOR: Default to user-full-name but may be disabled.
(See also org-koma-letter-author.)
- EMAIL: Same as AUTHOR. (See also org-koma-letter-email.)
FROM_LOGO uses LaTeX markup. FROM_LOGO provides the
"includegraphics" command to tell LaTeX where to find the logo.
This command needs to know the logo's directory and file name. The
directory can either be relative or absolute, just as you would
expect. LaTeX can use three file types for the logo: PDF, JPEG, or
PNG. The logo can either include or exclude its extension, which
might surprise you. When you exclude its extension, LaTeX will
search the directory for the "best" quality graphics format. For
example if it finds both logo.pdf and logo.png then it will
identify the PDF as "better", and include "logo.pdf". This can be
useful, for example, when you are mocking up a logo in the PNG
raster format and then switch over to the higher quality PDF vector
format. When you include the file extension then LaTeX will
include it without searching for higher quality file types.
Whatever file type you choose, it will probably require a few
design iterations to get the best looking logo size for your
letter. Finally, the directory and file name are specified
*without* quotes. Here are some examples with commentary, in the
location of your letter, with a logo named "logo", to get you
started:
Logo in the same directory: \includegraphics{logo}
or a sub-directory: \includegraphics{logos/production/logo}
Logos specified using absolute paths on Linux or Windows:
\includegraphics{~/correspondence/logo}
\includegraphics{~/correspondence/logos/production/logo}
\includegraphics{c:/you/correspondence/logo}
\includegraphics{c:/you/correspondence/logos/production/logo}
Logos in the same directory where the "better" quality PDF will
be chosen over the JPG:
\includegraphics{logo.pdf}
\includegraphics{logo.png}
Headlines are in general ignored. However, headlines with special
tags can be used for specified contents like postscript (ps),
carbon copy (cc), enclosures (encl) and code to be inserted after
\end{letter} (after_letter). Specials tags are defined in
org-koma-letter-special-tags-after-closing and
org-koma-letter-special-tags-after-letter. Currently members of
org-koma-letter-special-tags-after-closing used as macros and the
content of the headline is the argument.
Headlines with to and from may also be used rather than the keyword
approach described above. If both a keyword and a headline with
information is present precedence is determined by
org-koma-letter-prefer-special-headings.
You need an appropriate association in org-latex-classes in order
to use the KOMA Scrlttr2 class. By default, a sparse scrlttr2
class is provided: "default-koma-letter". You can also add you own
letter class. For instance:
(add-to-list 'org-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]"))
Then, in your Org document, be sure to require the proper class with:
#+LATEX_CLASS: my-letter
Or by setting org-koma-letter-default-class.
You may have to load (LaTeX) Babel as well, e.g., by adding
it to org-latex-packages-alist,
(add-to-list 'org-latex-packages-alist '("AUTO" "babel" nil))
Defined variables (29)
org-koma-letter-author | Sender’s name. |
org-koma-letter-class-option-file | Letter Class Option File. |
org-koma-letter-closing | Letter’s closing, as a string. |
org-koma-letter-default-class | Default class for ‘org-koma-letter’. |
org-koma-letter-email | Sender’s email address. |
org-koma-letter-from-address | Sender’s address, as a string. |
org-koma-letter-from-logo | Commands for inserting the sender’s logo, e. g., \includegraphics{logo}. |
org-koma-letter-headline-is-opening-maybe | Non-nil means a headline may be used as an opening and closing. |
org-koma-letter-location | Sender’s extension field, as a string. |
org-koma-letter-opening | Letter’s opening, as a string. |
org-koma-letter-phone-number | Sender’s phone number, as a string. |
org-koma-letter-place | Place from which the letter is sent, as a string. |
org-koma-letter-prefer-special-headings | Non-nil means prefer headlines over keywords for TO and FROM. |
org-koma-letter-prefer-subject | Non-nil means title should be interpreted as subject if subject is missing. |
org-koma-letter-signature | Signature, as a string. |
org-koma-letter-special-contents | Holds special content temporarily. |
org-koma-letter-special-tags-after-closing | Header tags to be inserted in the letter after closing. |
org-koma-letter-special-tags-after-letter | Header tags to be inserted after the letter. |
org-koma-letter-special-tags-as-macro | Header tags to be inserted as macros. |
org-koma-letter-special-tags-in-letter | Header tags related to the letter itself. |
org-koma-letter-subject-format | Non-nil means include the subject. |
org-koma-letter-url | Sender’s URL, e. g., the URL of her homepage. |
org-koma-letter-use-backaddress | Non-nil prints return address in line above to address. |
org-koma-letter-use-email | Non-nil prints sender’s email address. |
org-koma-letter-use-foldmarks | Configure appearance of folding marks. |
org-koma-letter-use-from-logo | Non-nil prints sender’s FROM_LOGO. |
org-koma-letter-use-phone | Non-nil prints sender’s phone number. |
org-koma-letter-use-place | Non-nil prints the letter’s place next to the date. |
org-koma-letter-use-url | Non-nil prints sender’s URL. |
Defined functions (16)
org-koma-letter--add-latex-newlines | (STRING) |
org-koma-letter--build-settings | (SCOPE INFO) |
org-koma-letter--get-tagged-contents | (KEY) |
org-koma-letter--get-value | (VALUE) |
org-koma-letter--keyword-or-headline | (PLIST-KEY PRED INFO) |
org-koma-letter--special-contents-inline | (KEYWORDS INFO) |
org-koma-letter--special-tag | (HEADLINE INFO) |
org-koma-letter-email | () |
org-koma-letter-export-as-latex | (&optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST) |
org-koma-letter-export-block | (EXPORT-BLOCK CONTENTS INFO) |
org-koma-letter-export-snippet | (EXPORT-SNIPPET CONTENTS INFO) |
org-koma-letter-export-to-latex | (&optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST) |
org-koma-letter-export-to-pdf | (&optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST) |
org-koma-letter-headline | (HEADLINE CONTENTS INFO) |
org-koma-letter-keyword | (KEYWORD CONTENTS INFO) |
org-koma-letter-template | (CONTENTS INFO) |