emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org/LaTex setup for Business Letter Revisited
@ 2012-12-24  9:42 Ian Barton
  2012-12-27  7:31 ` AW
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Barton @ 2012-12-24  9:42 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Org/LaTex setup for Business Letter Revisited
  2012-12-24  9:42 Org/LaTex setup for Business Letter Revisited Ian Barton
@ 2012-12-27  7:31 ` AW
  0 siblings, 0 replies; 2+ messages in thread
From: AW @ 2012-12-27  7:31 UTC (permalink / raw)
  To: emacs-orgmode, ian

Am Montag, 24. Dezember 2012, 09:42:08 schrieb Ian Barton:
> 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. 

Ian, this is really of interest to me, but I don't quite get it.

> 
> * koma variables which don't change are defined in an LCO file.

So this is the usual LCO file, in a place where kpathsea will find it, namely at 
~/texmf/tex/latex/   -- right?

> * koma variables (toaddress, etc) which change between letters are
> defined using org PROPERTIES.

> * a letter template in defined in a latex src block.
But what is the sense of having a LaTeX scr block? I'd like to outsource this 
somewhere as a template. Or is it necessary in each file including a letter?

> * 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.

"tangling" -- could you elaborate, please?

> 
> 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.
> 
"the whole thing"? What has to be included in the snippet?

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

> Happy Christmas everyone and best wishes for the New Year.

Yeah, and thanks to you for your time and effort,

Alexander

> 
> Ian.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-27  7:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-24  9:42 Org/LaTex setup for Business Letter Revisited Ian Barton
2012-12-27  7:31 ` AW

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).