From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Barton Subject: Org/LaTex setup for Business Letter Revisited Date: Mon, 24 Dec 2012 09:42:08 +0000 Message-ID: <50D82370.5040308@wilkesley.net> Reply-To: ian@manor-farm.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060309030207040300070808" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:40171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tn4Y1-00051T-1r for emacs-orgmode@gnu.org; Mon, 24 Dec 2012 04:42:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tn4Xz-0002KE-Oi for emacs-orgmode@gnu.org; Mon, 24 Dec 2012 04:42:12 -0500 Received: from mail2.wilkesley.net ([109.74.196.44]:37386 helo=li40-130.members.linode.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tn4Xz-0002Jr-Fy for emacs-orgmode@gnu.org; Mon, 24 Dec 2012 04:42:11 -0500 Received: from [192.168.0.58] (unknown [46.33.134.31]) (Authenticated sender: lists@wilkesley.net) by li40-130.members.linode.com (Postfix) with ESMTPSA id 5CB4D5C179D for ; Mon, 24 Dec 2012 09:42:09 +0000 (GMT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org This is a multi-part message in MIME format. --------------060309030207040300070808 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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. --------------060309030207040300070808 Content-Type: text/plain; charset=UTF-8; name="dalek.lco" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="dalek.lco" \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 --------------060309030207040300070808 Content-Type: application/vnd.lotus-organizer; name="dalek_letter.org" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="dalek_letter.org" KiBMZXR0ZXIuCjpQUk9QRVJUSUVTOgo6dG9fbmFtZTogRHIgV2hvCjp0b19hZGRyZXNzOiBU aGUgVGFyZGlzXFxcXCBHYWlsZnJleS1vbi1TZWFcXFxcIEdhbGlmcmV5CjpFTkQ6CgpZb3Ug Y2FuIHNldCBhbnkga29tYXZhciB2YXJpYWJsZXMgdXNpbmcgdGhlIFByb3BlcnRpZXMgZHJh dy4gVmFsdWVzCnRoYXQgZG9uJ3QgY2hhbmdlIGFyZSBwcm9iYWJseSBiZXN0IGNvbmZpZ3Vy ZWQgZGlyZWN0bHkgaW4gdGhlCmluY2x1ZGVkIExDTyBmaWxlLgoKClRoZSBib2R5IHRleHQg b2YgdGhlIGxldHRlciBpcyBlbmNsb3NlZCBpbiBhbiBvcmcgbW9kZSBzcmMgYmxvY2sgc28K aXQgY2FuIGJlIHJlZmVyZW5jZWQgaW4gdGhlIGJhYmVsIGJsb2NrIGZvciB0aGUgdGV4IGZp bGUuIFRoZXJlIGlzCnByb2JhYmx5IGEgYmV0dGVyIHdheSBvZiBkb2luZyB0aGlzLgoKIytu YW1lOiBib2R5X3RleHQKIytiZWdpbl9zcmMgb3JnIDpub3dlYiB5ZXMKSXQgaGFzIGNvbWUg dG8gb3VyIG5vdGljZSB0aGF0IHlvdXIgVGFyZGlzIHdhcyBpbGxlZ2FsbHkgcGFya2VkIG9u CnRoZSBzdHJlZXRzIG9mIHRoZSBjYXBpdGFsIGNpdHkgb2YgU2t5cm8uIEFjY29yZGluZ2x5 IEkgYW0gaW5zdHJ1Y3RlZAp0byBpc3N1ZSB3aXRoIGEgZmluZSBvZiAxMCwwMDAgR2FsYWN0 aWMgQ3JlZGl0cy4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50ZXJpbmcKICAgIHtcYWRkZm9udGZlYXR1cmV7TGV0dGVyU3BhY2U9MjAuMH1cZm9u dHNpemV7MzZ9ezM2fVxzZWxlY3Rmb250XHNjc2hhcGUgVHJhZmZpYyBFbmZvcmNlbWVudFxc WzVtbV0KICBcZm9udHNpemV7MTh9ezE4fVxzZWxlY3Rmb250XHNjc2hhcGVcdXNla29tYXZh cntmcm9tYWRkcmVzc319XFwKICBcZm9udHNpemV7MTJ9ezEyfXtcTGFyZ2UgXEVtYWlsfVx1 c2Vrb21hdmFye2Zyb21lbWFpbH0ge1xMYXJnZSBcVGVsZWZvbn1cdXNla29tYXZhcntmcm9t cGhvbmV9IHtcTGFyZ2UgXE1vYmlsZWZvbmV9XHVzZWtvbWF2YXJ7bW9iaWxlfQoKfQoKJSA9 PT0gZm9vdGVyIHNldHRpbmdzClxmaXJzdGZvb3R7CiBcY2VudGVyaW5nCiAgXHVzZWtvbWF2 YXJ7ZnJvbWFkZHJlc3N9IFxcCiAgXHVzZWtvbWF2YXJ7ZnJvbWVtYWlsfSBcdXNla29tYXZh cntmcm9tcGhvbmV9Cn0KClxlbmRpbnB1dAoKIytlbmRfc3JjCgoKKiBDcmVkaXRzLgpNb3N0 IG9mIHRoZSBpZGVhcyBmb3IgY3JlYXRpbmcgdGhlIGxldHRlciBsYXlvdXQgY2FtZSBmcm9t ICJDb3ZlcgpMZXR0ZXIgd2l0aCBTdHlsZSIgYXQgaHR0cDovL3N0ZWZhbm8uaXRhbGlhbnMu bmwvYXJjaGl2ZXMvNTUgVmFyaW91cwpvdGhlciBoYWNrcyB0byBzbGVkZ2VoYW1tZXIgdGhl IG91dHB1dCBpbnRvIHRoZSBmb3JtYXQgSSB3YW50ZWQgYXJlIGNyZWRpdGVkIGluCnRoZSBM Q08gZmlsZS4K --------------060309030207040300070808 Content-Type: text/x-tex; name="dalek_letter.tex" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="dalek_letter.tex" \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} --------------060309030207040300070808--