Changes

Jump to navigation Jump to search
17,542 bytes added ,  18:13, 2 December 2017
PDF document added for Modern CV cover letter example
< [[Sample documents]]
 
 
== Wolfgang's Letter Module ==
 
[[Letter]]
 
== German Letter style ==
The following is thought to be a(n early version of a) template for DIN (Deutsches Institut für Normung, German Standardization Institute) conforming letters. Using some provided commands, it should be easy to set sender and receiver addresses for window envelopes, include text or a logo at the top, and contact information to the right of the window space.
If you want to use it, save the following as <tt>letterstyle.tex</tt> and follow the usage instructions. A downloadable version is available [[media:letterstyle.tex|here]].
 
'''Beware:''' This style redefines <cmd>subject</cmd> as letter subject line and thus disables header setup!
<texcode>
\stopmode
</texcode>
 
==Another Approach==
 
Here is an alternative to the approach suggested by Holger. My university introduced a new official letterhead some months ago, and I was quite impressed to see that they even provided a LaTeX class for it. Of course, there was no ConTeXt support, so I decided to do it myself. My aim was merely to copy the official style, so my approach is far less fancy than the one before: you get a letter with a logo in the upper right corner, fields for information about the sender (assuming that the sender sits in a department of a university), and commands for the parts of a typical letter.
 
Instructions: copy the code below into a file, modify the generic information provided there to your needs, and save this file somewhere where ConTeXt can find it (the canonical place would be $HOMETEXMF/tex/context/third) as t-letterhead.tex. See below for usage instructions.
 
<texcode>
\protect
 
\setuppapersize[A4][A4] % or [letter][letter]; in that case, you'll have to fidget with the dimensions
 
\setuplayout[header=0mm,topspace=20mm,backspace=22mm,footer=0mm,width=160mm] % margins etc.
 
\enableregime[utf] % or whatever you prefer
 
\setupcolors[state=start] % in case you want any colored output
 
\mainlanguage[en] % or whatever you prefer
 
\setupbodyfont[modern,8pt] % this is the small bodyfont for the letterhead; we'll change to a bigger size for the actual letter later
 
\setuptabulate[before={\blank[0pt]},after={\blank[0pt]}] % there's a tabular, and I don't want any blank lines around it
 
\setuppagenumbering[state=stop]
 
\definelayer[myletter][x=1mm,y=1mm,width=\paperwidth,height=22mm] % The elements of the letterhead are defined as layers. This first layer contains the logo; you'll have to
\setlayer[myletter][x=104mm,y=11mm]{\externalfigure[Logo][width=56mm,height=20mm]} % supplyan image file yourself.
 
\definelayer[myuni][x=1mm,y=1mm,width=\paperwidth,height=24mm] % Second layer: Small column, right-aligned, with name of university and your name, in a narrow column
\setlayer[myuni][x=110.5mm,y=42mm]{\framed[width=50mm,height=22mm,frame=off]{\lbox to % below the logo.
35mm{\ss Name\\ of My University \\ (My Town) \\
\blank[line] \\ {\bf My Name} \\ Supreme Headmaster}}}
 
\definelayer[dept][x=1mm,y=1mm,width=\paperwidth,height=24mm] % Third layer, left-aligned, opposite layer 2. This column contains you contact information and the date.
\setlayer[dept][x=163mm,y=42mm]{\framed[width=40mm,height=22mm,frame=off]{\rbox
to 35mm{\ss Faculty of \\ Arts and Sciences \\
\blank[2*line] \\ Department of \\ High Energe Metaphysics\\
\blank[2*line]\\ 33 Main Street \\ Capital, DC 12345 \\ \starttabulate[|lw(4mm)|lw(36mm)|]
\NC Tel.: \NC (123) 456-7890 \NC\NR \NC Fax.: \NC (098) 7654-321 \NC\NR
\stoptabulate \\ Administrator: Highly Efficient \\
\starttabulate[|lw(4mm)|lw(36mm)|] \NC Tel.: \NC (012) 345-6789 \NC\NR
\stoptabulate \\ mymail@myaddress\\ www.my.website.edu \\ \blank[2*line]\\ Mytown,
\currentdate}}}
 
\definelayer[send][x=0mm,y=1mm,width=\paperwidth,height=15mm] % Fourth layer: one line, in fine print, that contains a short sender address; will be on top of the
\setlayer[send][x=9.4mm,y=44mm]{\framed[width=100mm,height=13mm,frame=off]{\ss % envelope's window.
\vii {\bf My University} $\cdot$ My Name $\cdot$
Dept. of Metaphysics $\cdot$ Capital, DC 12345}}
 
\startuniqueMPgraphic{fold}
fill unitsquare scaled 1mm withcolor blue ;
\stopuniqueMPgraphic
 
\definelayer[foldingmarkslayer][state=repeat] % Fifth layer: the folding marks
\setlayer[foldingmarkslayer][y=101mm, x=11mm]{\useMPgraphic{fold}}
\setlayer[foldingmarkslayer][y=147mm, x=11mm]{\useMPgraphic{fold}}
\setlayer[foldingmarkslayer][y=55mm, x=11mm]{\useMPgraphic{fold}}
 
\setupbackgrounds [page][background={foldingmarkslayer,myletter,myuni,dept,send}] % Make all layers active for page.
 
\long\def\addressee#1{\strut\blank[23*medium]\switchtobodyfont[11pt]\setupwhitespace[none]#1} % Defines field for receiver's address and places it at right position.
 
\long\def\lettersubject#1{\blank[3*line]{\bf Re: #1}} % Subject line, in bold face.
 
\long\def\letteropening#1{\blank[line]#1} % opening...
 
\long\def\letterbody#1{\blank[line]\setupwhitespace[medium]#1} % the main body
 
\long\def\letterclosing#1{\blank[line]#1\blank[3*line]} % and the closing formula
 
\setupalign[right] % I prefer letters with a ragged right, but you don't have to...
 
\ss % I want the sans font for the entire letter, but of course you can change to \tt or \rm, if you want
 
\unprotect
 
</texcode>
 
Here's an example how this module can be used:
 
<texcode>
\usemodule[t-letterhead]
 
\starttext
 
\addressee{Prof.\crlf
Heinrich Seltsam\crlf
Dept. of Physics\crlf
University of Southern Wyoming \crlf
123 Einstein Str.\crlf
Scumbag, WY 76543}
 
\lettersubject{My New Letterstyle}
 
\letteropening{Estimated Colleague,}
 
\letterbody{\dorecurse{6}{\input tufte\par}}
 
\letterclosing{Sincerely Yours}
 
Larry
 
\stoptext
</texcode>
 
Any feedback welcome. I'm not sure if the \long\defs for the several parts of the letters are very elegant and would be grateful if some of the moew knowledgeable folks could suggest something better. But overall, I like the simplicity of this style.
 
 
== Another Simple Style ==
 
<texcode>
%Context Environment for a basic Full Block Letter with Letterhead
\enableregime [utf]
\mainlanguage [en]
 
%==============Setup Page Layout======================
\def\MyPageNumber#1%
{{--~Page #1 / \lastpage~--}}%use lastpage for total page count
\setuppagenumbering[location={footer,middle},command=\MyPageNumber]
\setuppapersize[letter][letter]
\usetypescript[palatino]
\setupbodyfont[palatino,10pt,rm]
\setuplayout[
topspace=1.7in,
backspace=1.5in,
header=0mm,
footer=.25in,
width=5.5in,
height=8.55in]
\useexternalfigure[logo][letterheadLG][width=\makeupwidth,height=.7in]
\setupbackgrounds
[page]
[background={Letterhead,NextPgHead},state=repeat]
\definelayer[Letterhead]
[x=1.5in,y=1in,width=\makeupwidth,height=.7in,state=start]
\setlayerframed[Letterhead]
[corner={top,left},location={bottom,right},frame=off]
[offset=none,frame=off]
{\externalfigure[logo]}
\definelayer[NextPgHead]
[x=1.5in,y=1in,width=\makeupwidth,height=.7in,state=continue]
 
 
%==============Setup Paragraph Formatting==============
\setupwhitespace[big]
\setupindenting[no,medium,next]
 
%=================Define Letter Elements==================
 
\defineblank[FourLines][4*line,flexible]
\defineblank[OneLine][1*line,flexible]
 
\def\Regarding#1{\setgvariables[Letter][val={Re: #1}]Re: #1}
\def\RecNameVal{}
\def\RecName#1{
\def\RecNameVal{#1}
\setlayerframed[NextPgHead]
[corner={top,left},location={bottom,right},frame=off]
[offset=none,frame=off]
{\framed[frame=off,width=\makeupwidth,height=.7in,align={right,high}]%
{{\setupinterlinespace \RecNameVal\par
\setupinterlinespace\date\par
\setupinterlinespace\getvariable{Letter}{val}\par}}}
#1}
 
\long\def\MailingNote#1{\WORD{#1}\par}%
\long\def\Disposition#1{\WORD{#1}}%
\define[1]\Opening{#1:\blank[OneLine]}%
\define[1]\Closing{#1,\blank[FourLines]}%
\define[1]\Signature{#1\blank[OneLine]}%
\define[1]\Enclosures{\doifelse{#1}{1}{Enclosure}{Enclosures: #1}\blank[OneLine]}%
\definedescription[CC][location=left,distance=-.75in]
 
\definestartstop[Sender][before={\startlines},after={\stoplines\blank[FourLines]}]
\definestartstop[Notes][before={\startlines},after={\stoplines\blank[OneLine]}]
\definestartstop[Recipient][before={\startlines},after={\stoplines\blank[OneLine]}]
\definestartstop[Body][before={\startlines},after={\stoplines\blank[OneLine]}]
 
 
%=============Define Quotes====================
%just use \Qt{} and all nesting should be taken care of
\definedelimitedtext[Qt][quotation]
\setupdelimitedtext
[Qt]
[1]
[left={\symbol[leftquotation]},
right={\symbol[rightquotation]}]
 
\setupdelimitedtext
[Qt]
[2]
[left={\symbol[leftquote]},
right={\symbol[rightquote]}]
 
\setupdelimitedtext
[Qt]
[3]
[left={\symbol[leftquotation]},
right={\symbol[rightquotation]}]
 
%To create blockquotes use \startextract \stopextract
\defineblank[ExtractDistance][3pt]
\definestartstop[Extract][
style=italic,
before={\blank[ExtractDistance]
\setupnarrower[left=1.5pc,right=1.5pc]
\startnarrower[left,right]
\noindent},
after={\stopnarrower
\blank[ExtractDistance]
\indenting[next]}]%Don't indent the immediately following paragraph, but do indent later ones.
 
%==================Define Enumerations===========================
\defineitemgroup[Outline][5]%Use with \startOutline ... \item ... \stopOutline
\setupitemgroup[Outline][1][R]%First level, Roman Numerals
\setupitemgroup[Outline][2][A]%Second Level, A,B,C etc.
\setupitemgroup[Outline][3][n]%Third level, Numberd
\setupitemgroup[Outline][4][r][left=(,right=),stopper=]%Fourth level, lowercase roman
\setupitemgroup[Outline][5][m][left=(,right=),stopper=]%Fifth level, lowercase numbered
 
\defineitemgroup[Bullet][5]%Use with \startBullet ... \item ... \stopBullet
\setupitemgroup[Bullet][1][1]%First level
\setupitemgroup[Bullet][2][2]%Second Level
\setupitemgroup[Bullet][3][5]%Third level
\setupitemgroup[Bullet][4][1]%Fourth level
\setupitemgroup[Bullet][5][2]%Fifth level
</texcode>
 
And how to use it:
 
<texcode>
\environment basicLetterEnv
\starttext
\startSender
Company Name
Your Name, Your Title
1234 AnyStreet
City, ST 75098
Phone: 123-456-7890
Email: asdf@asdf.com
Web: www.asdf.com
\date
\Regarding{The subject of this letter}
\stopSender
 
\startNotes
\MailingNote{Certified Mail}%Mailing Notations:Certified,AirMail, Priority...
\Disposition{Confidential}%Disposition: Confidential, personal ...
\stopNotes
 
\startRecipient
\RecName{First Last Name}
Company Name
4567 ThisStreet
City, US 12345
\stopRecipient
 
\Opening{Dear First Name}
 
\startBody
\dorecurse{5}
{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras tellus.
Proin fringilla euismod elit. Donec eleifend purus sed eros. Fusce quis
diam. Donec euismod nisl non dui. Donec eu odio. Nam congue risus in
eros commodo elementum. Duis dolor. Etiam luctus mauris ut mi. Vivamus
vitae sem eu justo pretium ullamcorper. Aliquam ac mauris posuere justo
molestie interdum. Nullam eleifend leo quis justo. Suspendisse tortor
risus, porta a, hendrerit in, facilisis at, lectus.\par}
\stopBody
 
\Closing{Sincerely}
 
 
\Signature{Your Name, General Counsel}
 
\Enclosures{1}
\startCC{CC:}
A Name\par
Another Name\par
File
\stopCC
 
\stoptext
</texcode>
 
==Letterhead==
 
The following style was presented in the PracTeX Journal by Joseph Hogg, you find the article under the following link:
 
* http://www.tug.org/pracjourn/2006-3/hogg/
 
<texcode>
% Context file for letterhead
\setuppapersize[letter][letter]
\setuplayout[height=9in,backspace=80pt,location=middle]
\setupbodyfont[serif,12pt] \setupwhitespace[big]
\setupcolors[state=start]
% Set up addressee here, From and Date
\define\Toperson{A. U. Thor}
\define\Totitle{Editor}
\define\Tocompany{Great \TeX\ Journal}
\define\Tostreet{P. O. Box 3.1415926}
\define\TocityStateZip{\TeX town, 67890-12345}
\define\Tocountry{USA}
\define\Fromperson{Ben Lee User}
\define\Mydate{\currentdate}
% End addressee, From and Date
\setupheader[state=none] \setupfooter[state=empty]
\setupfootertexts[{\ssx {\Mydate} --- {\em from}
{\Fromperson} {\em to} {\Toperson} --- page {\pagenumber}
of {\totalnumberofpages}}]
%\showframe
%\showboxes
%\showsetups
 
\starttext
% Heading
{\ssb Ben Lee User} \hfill {\ssx voice: (123) 456-7890}\crlf {\ssx P. O.
Box 2.718281} \hfill {\ssx fax: (123) 456-7891}\crlf
{\ssx Punktown, 12345-67890} \hfill {\ssx email: ben.lee.user@tex.edu}%
\textrule \blank[10*medium]
% Address
\Toperson\crlf \Totitle\crlf \Tocompany\crlf \Tostreet\crlf
\TocityStateZip%\crlf
%\Tocountry
\blank[8*medium] \textrule
% Letter
\hfill\Mydate \blank[2*big]
 
Dear Thor:
 
Here's a setup for a business or personal letter that produces a
letterhead and the addressee's information on the letter. This allows
the sender to use envelopes with windows to avoid separately addressing
envelopes. I usually print a dozen or so of these envelopes with my
return address in advance.
 
Vertical spacing of addresses and other features is controlled by the
\type{\blank[..]} command. I experiment with this depending on the
number of lines in the address or where I want to place horizontal
lines.
 
% Jump to a new page to see the footer
I'll jump to a new page to illustrate the footer for the second and
subsequent pages. \page
 
There is no footer on the first page and no page number. Many letters
are only one page long. But on those with two or more pages, it is
useful to have page numbers and other identifying information.
 
\blank[2*big]
 
Very truly yours,
 
[signature space]
 
\blank[4*big]
 
Ben Lee User
 
\stoptext
</texcode>
 
Thanks to all those who contributed the original suggestions, they have been a great inspiration!
 
[[User:Thomas|Thomas]]
 
==Modern CV like cover letter==
 
This example is separated into 2 files : the environment file and a letter sample. Layout was made based on swiss standards for cover letters.
 
In the letter it is possible to specify the following options :
* full name of recipient (not to be provided if unknown)
* gender of recipient (not to be provided if full name wasn't given)
* if the sender address has to be put in an international format
 
Here is the letter sample :
<texcode>
% ENGLISH, TO MALE RECIPIENT
\mainlanguage[en]
\def\fullname{John Smith}
\def\gender{male}
 
% % FRENCH, TO FEMALE RECIPIENT
% \mainlanguage[fr]
% \def\fullname{Jeanne Petit}
% \def\gender{female}
 
% % ENGLISH, TO UNKNOWN RECIPIENT, INTERNATIONAL
% \mainlanguage[en]
% \define\international
 
\environment {cover-letter-env}
 
\starttext
 
\startletter[toaddress={Enterprise \\ Street \\ City \labeltext{date}},
subject={Application for the role of \quote{C++ embedded systems engineer} posted on Jobup}]
 
\setupindenting[yes,small]
 
I am an electronic engineer specialized on software development of embedded systems and your job offer caught my attention.
 
...
 
Thank you in advance for your time and consideration and blablabla. I look forward to hearing from you.
 
\stopletter
 
\stoptext
</texcode>
 
And, finally, here is the environment file :
<texcode>
\def\secondwordtmp#1 #2\relax{#2}
\def\secondword#1{\expandafter\secondwordtmp#1\relax}
 
\startenvironment cover_letter
 
\usemodule[letter]
\useletterstyle[swiss]
\usesymbols[mvs]
\setupsymbolset[martinvogel 2]
 
\def\lastname{\secondword{\fullname}}
 
\setuplabeltext [en] [greetings={\rightaligned{Yours sincerely,}}]
\setuplabeltext [fr] [greetings={}]
 
\doifdefinedelse {fullname}
{\def\to_name{\bold{\labeltext{\gender:title} \fullname{}}} % hack temp
\setuplabeltext [en] [male:title=Mr, female:title=Ms,
date={\blank[7mm]{\em \currentdate}}]
\setuplabeltext [en] [opening={{Dear \labeltext{\gender:title} \lastname{},}}]
\setuplabeltext [fr] [male:title=M., female:title=Mme,
male:longtitle=Monsieur, female:longtitle=Madame,
date={\blank[7mm]{\em Fribourg, le \currentdate}}]
\setuplabeltext [fr] [opening={{\labeltext{\gender:longtitle},}}]}
{\setuplabeltext [en] [HR={Human Resources}]
\setuplabeltext [fr] [HR={Ressources humaines}]
\def\to_name{\bold{\labeltext{HR}}}
\setuplabeltext [en] [opening={{Dear Hiring Manager,}}]
\setuplabeltext [fr] [opening={{Madame, Monsieur,}}]}
 
\def\CH{}
\setuplabeltext [country={}]
\doifdefined {international}
{\setuplabeltext [en] [country={{, Switzerland}}]
\setuplabeltext [fr] [country={{, Suisse}}]
\def\CH{CH-}}
 
\doif {\currentlanguage} {fr}
{\setcharacterspacing[frenchpunctuation]}
 
\setupbodyfont[sans, 12pt]
\setupwhitespace[big]
 
\setuplettersection
[reference,date,specialnotation,closing]
[leftmargin=.55\textwidth]
 
\setupletterlayer[head][alternative=left,
y=16mm,
style=slanted,
color=darkgray]
\setupletterlayer[backaddress][state=stop]
 
\setupletterlayer[address][preset=lefttop,
x=.7\textwidth]
 
\setupletterlayer[reference][y=7cm]
\setuplettertext[date=]
 
\setupletterlayout[firstpage][topspace=9.5cm]
 
\setupletterdescription[enclosure,postscript][headstyle=boldslanted]
\setuplettersection[appendices][style=slanted,color=darkgray,spacebefore={samepage,5*line}]
\setupletterstyle[fromname,toname][style=bold] % Bug : ne fonctionne pas pour toname !
\setuplettertext[postscript={\color[black]{PS: }}]
 
\setupletter
[fromname={My Name},
fromaddress={Street 1\\\CH{}1700 My-City\labeltext{country}},
fromphone={\symbol[Mobilefone] +41 98 765 43 21\\\symbol[Telephone] +41 12 345 67 89},
frommail={\symbol[Letter] my_email@address.com},
toname={\to_name{}},
opening={\labeltext{opening}},
date=,
closing={\labeltext{greetings}},
signature={\bold{My Name}}]
 
\stopenvironment
</texcode>
 
And here is the PDF document generated after compilation: [[File:modern-cv-cover-letter.pdf]].
 
Remark : there are still 1 or 2 hacks in the environment file, but I don't know how to make them better as I am not very experimented with ConTeXt, TeX and the use of the letter module.
 
Jonas Baggett
 
[[Category:Sample documents]]
6

edits

Navigation menu