emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ian Barton <lists@wilkesley.net>
To: emacs-orgmode@gnu.org
Subject: Org/LaTex setup for Business Letter Revisited
Date: Mon, 24 Dec 2012 09:42:08 +0000	[thread overview]
Message-ID: <50D82370.5040308@wilkesley.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 902 bytes --]

I have been following the various threads about using the scrlttr2 
class. However, none of them quite worked for me.

I have come up with the following hack using Babel. There are three 
files attached which illustrates the general principles.

* koma variables which don't change are defined in an LCO file.
* koma variables (toaddress, etc) which change between letters are 
defined using org PROPERTIES.
* a letter template in defined in a latex src block.
* The letter body is written in an org_mode src block.
* The final letter is produced by tangling the body, the lco file and 
the letter template.

In normal use you would simply modify the PROPERTIES and body text to 
suit each letter. The whole thing can probably be made into a yasnippet.

Suggestions for improvement welcome, as the existing stuff is just a 
quick hack.

Happy Christmas everyone and best wishes for the New Year.

Ian.

[-- Attachment #2: dalek.lco --]
[-- Type: text/plain, Size: 2003 bytes --]


\ProvidesFile{dalek.lco}[%
 2002/07/09 v0.9a LaTeX2e unsupported letter-class-option]


\usepackage{fontspec}
\usepackage[english] {babel}
\usepackage{marvosym}

\KOMAoptions{backaddress=off}

% Make the toaddress flush left with the body text.
% Default is to position it further left.
% Obtained from nowindow.lco by Markus Kohm.
\@setplength{firstheadwidth}{\textwidth}
\@setplength{toaddrhpos}{\oddsidemargin}
\@addtoplength{toaddrhpos}{1in}


% ==============================================
% PERSONAL DATA
% ==============================================
\newkomavar{mobile}
\setkomavar{fromname}{The Black Dalek}
\setkomavar{fromaddress}{Traffic Enforcement HQ Skyro City Skyro}
\setkomavar{fromphone}{1-800-dalek}
\setkomavar{mobile}{Top Secret}
\setkomavar{fromemail}{exterminate@dalek.com}

\setkomavar{signature}{The Black Dalek}
\setkomavar{subject}{Illegal Parking}

% ==============================================
% FORMATTING STUFF
% ==============================================

% === font settings
\defaultfontfeatures{Mapping=tex-text}
\setmainfont {STIXGeneral}
\setsansfont {Impact}

% date
\usepackage[english]{isodate}
\usepackage{datetime}
\renewcommand{\dateseparator}{-}
\newcommand{\todayiso}{\the\year \dateseparator \twodigit\month \dateseparator \twodigit\day}

% Set the date to flush left.
\setkomavar{date}{\todayiso}
\setkomavar{date}{\flushleft\vspace{-\baselineskip}\today\par}


%set the font size and leading
\renewcommand{\normalsize}{\fontsize{12.5}{17}\selectfont}

% === header settings
\firsthead{
 \centering
    {\addfontfeature{LetterSpace=20.0}\fontsize{36}{36}\selectfont\scshape Traffic Enforcement\\[5mm]
  \fontsize{18}{18}\selectfont\scshape\usekomavar{fromaddress}}\\
  \fontsize{12}{12}{\Large \Email}\usekomavar{fromemail} {\Large \Telefon}\usekomavar{fromphone} {\Large \Mobilefone}\usekomavar{mobile}

}

% === footer settings
\firstfoot{
 \centering
  \usekomavar{fromaddress} \\
  \usekomavar{fromemail} \usekomavar{fromphone}
}

\endinput

[-- Attachment #3: dalek_letter.org --]
[-- Type: application/vnd.lotus-organizer, Size: 3789 bytes --]

[-- Attachment #4: dalek_letter.tex --]
[-- Type: text/x-tex, Size: 681 bytes --]


\documentclass[dalek, subject=afteropening, subject=left]{scrlttr2}

\begin{document}

\begin{letter}{%

}
\setkomavar{toname}{Dr Who}
\setkomavar{toaddress}{The Tardis\\ Gailfrey-on-Sea\\ Galifrey}
\setkomavar{subject}{Illegal Parking.}
\opening{Dear Doctor Who,}


It has come to our notice that your Tardis was illegally parked on
the streets of the capital city of Skyro. Accordingly I am instructed
to issue with a fine of 10,000 Galactic Credits. If you pay within 7
days there is a discount of 2,000 Galactic credits.

Failure to pay may result in your Tardis being towed away and
crushed. Also, you will be exterminated!



\closing{Regards}


\end{letter}
\end{document}

             reply	other threads:[~2012-12-24  9:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-24  9:42 Ian Barton [this message]
2012-12-27  7:31 ` Org/LaTex setup for Business Letter Revisited AW

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50D82370.5040308@wilkesley.net \
    --to=lists@wilkesley.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=ian@manor-farm.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).