Changes

Jump to navigation Jump to search
5,785 bytes added ,  12:07, 2 September 2017
Example of changing element order
== \start/startletter, \stopletter ==
The letter environment has only optional arguments which acts like a local
The “layers” (which are used for the “head”, “address” or “reference line”) are configured with <cmd>setupletterlayer</cmd> and <cmd>setupletterframe</cmd> command, the first is used to move the layer to its position on the page with the “x” and “y” keys and you can select one letter elements (which are created with <cmd>defineletterelement</cmd>) with the “alternative” key. With <cmd>setupletterframe</cmd> you can change the “width” and “height” of the element.
 
Thus, for example, the following will produce a small, sans serif header, 10pt from the bottom of the page and centered.
 
<texcode>
\defineletterelement[layer][foot][example]%
{This is my footer.}
\setupletterlayer[foot][alternative=example,style=\tfx\sans,y=10pt]
 
\setupletterframe[foot][align=middle]
</texcode>
 
The “sections” (which are used for the “subject” and “content”) are configured with <cmd>setuplettersection</cmd> which allows you to change the alignment and spacing before and after the element.
A complete list with all values for the various commands can be seen in the following document: [http://bitbucket.org/wolfs/correspondence/downloads/commands.pdf commands.pdf]
 
=== List of Layers and Sections ===
 
These layers are defined and configurable:
* head, nexthead, lefthead, righthead
* foot, nextfoot, rightfoot, leftfoot
* address, backaddress
* reference, location
* topmark, botmark, cutmark, endmark, usermark
* lettermain, letternext
 
These sections are defined and configurable:
* '''(default)''' title, subject, opening, content, closing, appendices
* '''(block style layouts)''' head, date, reference, specialnotation, address
 
=== Changing the order of elements ===
 
The order of elements can be changed using <cmd>setupletterelements</cmd>. For example, to place the subject after the opening (as is standard in Britain), use the following:
 
\setupletterelements
[section]
[title,
opening,
subject,
content,
closing,
appendices]
 
=== \defineletterelement ===
* http://bitbucket.org/wolfs/correspondence/downloads/correspondence.pdf
 
== Examples ==
 
=== List of enclosures/attachments ===
 
\usemodule[letter]
\setupletterdescription
[enclosure]
[
location=top,
leftmargin=1em,
symbol=bullet, % or "none"
]
\setupletter
[enclosure={list:One,Two,Three}]
\startletter
\input knuth
\stopletter
 
=== Hraban’s complicated logo and address setup ===
 
Same as in [[Invoice]] sample.
 
\mainlanguage[nl]
\usemodule[letter]
\setuplanguage [nl] [date={year, –, mm, –, dd}] % ISO 8601 date
\setupbodyfont [rm, 10pt]
\setupinterlinespace[3.0ex] % default: 2.8ex
\setbreakpoints[compound] % break at / and -
\setupletteroptions
[language=netherlands,
bodyfont={rm,10pt},
whitespace=1.5ex, %3ex
]
\setuptabulate[distance=0pt]
\setupletter[
% Sender address in envelope window
backaddress={Pragma ADE · H.\,Hagen · Riderstraat 27 · NL-8061 GH Hasselt}
]
% Define logo for the first page
\defineletterelement[layer][head][example]%
{\framed[background=logohead,height=35mm,frame=off,align=right]%
{\externalfigure[biglogo]}}
% Other logo for subsequent (right) pages
\defineletterelement[layer][nexthead][example]%
{\externalfigure[logo][height=2cm,width=6cm]}
% We put our logo in the head
\setupletterlayer[head,nexthead]
[x=128mm,
y=15mm,
alternative=example]
\setupletterlayer[nexthead][state=right]
\setupletter[
name={Hans Hagen},
street={Ridderstraat 27},
city={NL-8061 GH Hasselt},
phone={+31 (0)38 477\,53\,69},
mobile={+31 (0)38 477\,53\,69},
email={hh@pragma-ade.com},
web={www.pragma-ade.com},
skype={whoknows}
]
% center around the :
\defineletterelement[layer][location][example]%
{\setuptabulate[bodyfont=small]
\starttabulate[|Irw(5em)|Ip|]
\NC person \NC\correspondenceparameter{name} \NC\NR
\NC location \NC\correspondenceparameter{street}\\\correspondenceparameter{city}\NC\NR
\NC phone \NC\correspondenceparameter{phone}\\\correspondenceparameter{mobile} \NC\NR
\NC internet \NC\correspondenceparameter{email}\\\correspondenceparameter{web} \NC\NR
\NC skype \NC\correspondenceparameter{skype} \NC\NR
\stoptabulate}
\setupletterlayer[location]
[alternative=example,
x=152mm,
y=30mm
]
% Our own recipient setup without too much space before the address
\defineletterelement[layer][address][example]%
{\correspondenceparameter{toname}\\
\correspondenceparameter{toaddress}
\par}
\setupletterlayer[address][alternative=example]
% Subject and date on the same line, date below logo
\defineletterelement[section][subject][example]%
{\bTABLE[frame=off]
\bTR
\bTD[width=\dimexpr169mm-\backspace\relax]\correspondenceparameter{subject}\eTD
\bTD{\tf\correspondenceparameter{date}}\eTD
%\bTD{\tf 2012-12-12}\eTD
\eTR
\eTABLE}
\setuplettersection[subject][alternative=example]
% account information at the foot, below the logo
\defineletterelement[layer][foot][example]%
{\setuptabulate[bodyfont=small]
\starttabulate[|Irw(39mm)|Ip|]
\NC financial \NC \NC\NR
\NC tax no. \NC 1234567890 \NC\NR
\NC UStID \NC NL\,123\,456\,789 \NC\NR
\NC Account \NC 123\,456\,890\\Context bank, BIC NLPRCOHA \NC\NR
\NC IBAN \NC NL12\,345\,678\,908\,12 \NC\NR
\stoptabulate}
\setupletterlayer[foot][
preset=leftbottom,
x=127mm,
y=34mm,
alternative=example]
% switch off reference line
\setupletterlayer[reference][state=stop]
% Move the text a bit up
\setupletterlayout[firstpage][topspace=10cm]
% Adjust text start on subsequent pages
\setupletterlayout[secondpage][topspace=3cm]
% Move marks to the paper rim (won't print on most printers)
\setupletterlayer[topmark,botmark,cutmark][x=-2mm]
\startletter[
toname={MIT\\Prof. Donald Knuth},
toaddress={13, Anywhere Outthere\\Utopia, MA\\USA},
subject={Regression in latest release of i\TEX}]
\input knuth
\blank[2*big]
Best regards,
\blank[small]
\externalfigure[signature]%
Hans Hagen
\stopletter
1

edit

Navigation menu