* Thorsten Jolitz <tjol...@googlemail.com> wrote: > > Hi List,
Hi Thorsten! > although using Emacs/Org-mode for almost everything, I still write my > "official" correspondence with a (quite nice) OpenOffice template. It > would be so much easier and faster to just use Org mode for that too. I accomplished this by using yasnippet and Org-mode. It is quite convenient :-) 1. install, configure, and learn yasnippet for your Emacs - a must; independent of this one here! 2. put «newletter» (below) into your snippet directory so that it can be invoked when you're in a Org-mode buffer - usually, this means storing as something similar to «~/.emacs.d/snippets/text-mode/org-mode/newletter» - adopt my dummy entries for your name, address, and so forth So far for the initial setup. 3. create a new (empty) folder 4. enter the new folder 5. create and open a new Org-mode file in Emacs - it is only temporary - you might want to use «emacsclient init.org» 6. within this open Emacs buffer, type «newletter» followed by TAB - this invokes the yasnippet template 7. fill out all fields, take default values or change them, switch to the next field by using TAB 8. when you end up at the line «cat >Kopf.tex <<EOF»: press C-c C-c in order to get the template generated 9. exit the temporary Org-mode buffer - you can even delete the Org-mode file now that the template was generated 10. start typing your letter within «letter.tex» and compile with «make pdf» as you want This is the file «newletter»: - please do exclude my email signature below :-) - please note that the Makefile requires tabstops before each indented command line - probably you have to fix this once while creating «newletter» =========================================================================== # -*- mode: snippet -*- # name: LaTeX KOMA scrlttr2 # key: newletter # contributor: Karl Voit # -- From/Name: ${1:Your Name} From/Street: ${2:Your street and house number} From/Postal No.: ${3:1234} From/City: ${4:Yourcity} From/Signature: ${5:\\usekomavar{fromname}} From/Email: ${6:Youremail} From/Phone: ${7:0043/664/12\\,34\\,56} To/Company: $8 To/Name: $9 To/Street: $10 To/Postal No.: $11 To/City: $12 Subject: $13 Filename: $14 #+BEGIN_SRC sh cat >letter.tex <<EOF \documentclass[% %DIV=14,% viel mehr Platz auf einer Seite %enlargefirstpage,% mehr Platz (bringt nicht viel) fontsize=12pt,% parskip=half,% subject=titled,% 'Betrifft: ' hinschreiben backaddress=false,% Absenderadresse nochmal (klein, einzeilig) ueber Empfaenger fromalign=left,% fromemail=true,% fromphone=true% ]{scrlttr2} \usepackage{ucs} %% UTF8 as input characters \usepackage[utf8x]{inputenc} %% UTF8 as input characters \usepackage[ngerman]{babel} \setkomavar{fromname}{$1} \setkomavar{fromaddress}{$2\\newline{}$3~$4} \setkomavar{signature}{$5} \setkomavar{fromemail}{$6} \setkomavar{fromphone}{$7} \begin{document} % ------------------------------------------------------------- \setkomavar{subject}{$13} \begin{letter}{% $8\\newline $9\\newline $10\\newline $11~$12} \LoadLetterOption{DINmtext} %% Adressfeld ist weiter oben -> mehr Text \opening{Sehr geehrtXX NAME!} TEXT \closing{Mit freundlichen Grüßen} %\encl{Lebenslauf}% Anhang \end{letter} % ------------------------------------------------------------- \end{document} EOF cat -T >Makefile_temp <<EOF ## ein aussagekraeftiger Name zum Benennen der Endprodukte (PDFs, ZIPs, ...) PROJECTNAME = "$14" ## ----------------------------------------- ## DO NOT EDIT BELOW THIS LINE ## ----------------------------------------- ## Makefile von Karl Voit (k...@voit.net) ## COMMANDS: #PDFVIEWER = xpdf PDFVIEWER = acroread PDFLATEX_CMD = pdflatex TIMESTAMP = \\\`/bin/date +%Y-%m-%dT%H.%M\\\` FILENAME = "\\\${TIMESTAMP}_\\\${PROJECTNAME}.pdf" #help #helpThe main targets of this Makefile are: #help help this help .PHONY: help help: §@sed -n 's/^#help//p' < Makefile # -------------------------------------------------------- #help all create PDF .PHONY: all all: main .PHONY: main main: pdf # -------------------------------------------------------- #help pdf generate PDF .PHONY: pdf pdf: letter.pdf letter.pdf: letter.tex §TEXINPUTS=\\\$(TEXINPUTS) \\\${PDFLATEX_CMD} letter.tex §TEXINPUTS=\\\$(TEXINPUTS) \\\${PDFLATEX_CMD} letter.tex §-mv letter.pdf "\\\${FILENAME}" §touch letter.pdf # -------------------------------------------------------- #help view view the PDF .PHONY: view view: pdf §\\\${PDFVIEWER} "\\\${FILENAME}" # -------------------------------------------------------- #help clean clean up temporary files .PHONY: clean clean: §-rm *~ *.aux *.bbl main.dvi main.ps main.pdf *.dvi *.blg *.idx *.ilg *.ind *.toc *.log *.log *.brf *.out *.lof *.lot *.gxg *.glx *.gxs *.glo *.gls -f #help purge cleaner than clean ;-) .PHONY: purge purge: clean §-rm *.pdf *.ps -f #help force force rebuild next run .PHONY: force force: §touch *tex # TOOLS: #help zip create ZIP-file .PHONY: zip zip: clean §zip -r ../\\\${PROJECTNAME}_\\\${TIMESTAMP}.zip * #end EOF # OK, this is somewhat dirty but it's a workaround to the problem that TABs do not get into Makefile tr '§' '\t' <Makefile_temp >Makefile rm Makefile_temp #+END_SRC =========================================================================== -- Karl Voit