summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/context/third/letter/doc/correspondence-letter-background.tex
blob: d0b0613f55534b8865cf5e6aff1b595186ea0e57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
\startcomponent correspondence-letter-background

\environment correspondence-environment

\chapter{Background}

There are different ways to customize the look of a letter, they are namely the
\startitemize[text,a][lefttext=,righttext=,stopper={)}]
\item layout of the page,
\item the font for the main text and the styles for each element and
\item the header and the other information blocks.
\stopitemize
Another option is the stationary which you use for the printed result, you could
use either already preprinted paper or what will be described in the following chapter
create your own with ConTeXt. Three different methods are available to do this:

\startitemize[a,packed][stopper={)}]
\item color,
\item images,
\item user created backgrounds.
\stopitemize

% backgroundcolor

\start

\setupletterstyle[backgroundcolor=gray]

\startletter
\input knuth
\stopletter

\stop

\section{Backgroundcolor}

Setting a color for the background is the first method to customize the layout of the letter background,
you can see result of the following code in the example on the left page and all other full page letters
in this document.

\starttyping
\setupcolors[state=start]

\setupletterstyle[backgroundcolor=gray]

\startletter
Thus, I came to the conclusion ...
\stopletter
\stoptyping

When you use {\em backgroundcolor} in combination with the other methods it's important to know the backgroundcolor
is always behind the other elements.

% backgroundimage

\start

\setupletterstyle[backgroundimage=954380_42830609]

\startletter
\input knuth
\stopletter

\stop

\section{Backgroundimages}

The second mathod is to use a graphic as background for the letter, the example on the left page is created
with the following code, take care the argument is existing figure or you will get \ConTeXt’s usual placeholder
for missing figures.

\starttyping
\setupletterstyle[backgroundimage=example]

\startletter
Thus, I came to the conclusion ...
\stopletter
\stoptyping

When you take a look in the source you will see the module use \type{\overlayfigure} to stretch the graphic
to the size of the paper, it’s up to the user to provide a graphic with the correct width|/|height ration and
a resultion which is high enough to aviud artefacts.

% background

\start

\startuseMPgraphic{dactylus}
draw unitsquare xyscaled (OverlayWidth-2cm,OverlayHeight-2cm) smoothed 1cm withpen pencircle scaled 2 ;
fill fullcircle scaled 1.5cm shifted (1cm,1cm) withcolor \MPcolor{orange} ;
\stopuseMPgraphic

\setupletterstyle
  [backgroundcolor=,
   background=\useMPgraphic{dactylus}]

\startletter
\input knuth
\stopletter

\stop

\section{Backgrounds}

As third and last method you can use the {\em background} parameter which is nothing more than a overlay
which is placed in the background. A example where a graphic is drawn with \MetaPost\ is shown below with
the result on the left page.

\starttyping
\startuseMPgraphic{dactylus}
draw unitsquare xyscaled (OverlayWidth-2cm,OverlayHeight-2cm)
    smoothed 1cm withpen pencircle scaled 2 ;
fill fullcircle scaled 1.5cm shifted (1cm,1cm)
    withcolor \MPcolor{orange} ;
\stopuseMPgraphic

\setupletterstyle[background=\useMPgraphic{dactylus}]

\startletter
Thus, I came to the conclusion ...
\stopletter
\stoptyping

You could use this method also to place normal graphic from a external file \type{\externalfigure}
where you have nore detailed control over the figure size etc. It's also possible to define different
background for the first and the second page but the user has to take care of this himself.

\stopcomponent