Example: Assumed, someone wants to send a letter to Joana Public. A minimalistic letter
document for this may be:
\documentclass[version=last]{scrlttr2}
\usepackage[english]{babel}
\begin{document}
\begin{letter}{Joana Public\\
Hillside 1\\
12345 Public-City}
\end{letter}
\end{document}
145
Chapter 4.
However, this would not result in any printable output. At least there would not
be an addressee at the note paper sheet. The reason for this will be explained at
the description of command \opening at
page 146
.
\AtBeginLetter{instruction code }
\AtEndLetter{instruction code }
L
A
TEX enables the user to declare instruction code whose execution is delayed until a
determined point. Such points are called hooks. Known macros for using hooks are
\AtBeginDocument
and \AtEndOfClass at the L
A
TEX kernel. The class scrlttr2 provides two
more hooks. The instruction code for these may be declared using \AtBeginLetter and
\AtEndLetter
v2.95
. Originally, hooks were provided for package and class authors, so they are
documented in [
Tea06
] only, and not in [
Tea05b
]. However, with letters there are useful
applications of \AtBeginLetter as the following example may illustrate.
Example: It is given that one has to set multiple letters with questionnaires within one
document. Questions are numbered automatically within single letters using a
counter. Since, in contrast to page numbering, that counter is not known by
scrlttr2, it would not be reset at the start of each new letter. Given that each
questionnaire contains ten questions, question 1 would get number 11 in the second
letter. A solution is to reset this counter at the beginning of each new letter:
\newcounter{Question}
\newcommand{\Question}[1]{%
\refstepcounter{Question}\par
\noindent\begin{tabularx}{\textwidth}{l@{}X}
\theQuestion:~ & #1\\
\end{tabularx}%
}%
\AtBeginLetter{\setcounter{Question}{0}}
This way first question remains question 1, even in the 1001st letter. Of course
the definition at this example needs package tabularx (see [
Car99b
]).
letter
\thisletter
\letterlastpage
If
v3.19
you have more than one letter in one document, it is useful to have a letter number. Since
version 3.19 KOMA-Script provides counter letter and increases it at every \begin{letter}.
Example: Have one more look into the \AtBeginLetter example. Instead of resetting the
counter explicitly at \begin{letter}, we can do it implicitly by defining counter
Question
depending on counter letter:
146
Chapter 4.
\newcounter{Question}[letter]
\newcommand{\Question}[1]{%
\refstepcounter{Question}\par
\noindent\begin{tabularx}{\textwidth}{l@{}X}
\theQuestion:~ & #1\\
\end{tabularx}%
}%
Now, the new counter will be reset at every start of a new letter and the first
question of every letter will be number one.
If you want the output of current value of letter, you may usually use \theletter. Indeed
the letter can also be used for cross-references. So you can use \label{name } to generate a
label immediately after \begin{letter} and reference it somewhere in the document using
\ref{name }
. Inside the same letter you can simply use \thisletter without generating a
label to get the same result.
KOMA-Script itself uses \thisletter to put a label onto the last page of every letter. You
can use \letterlastpage to reference the last page number of the current letter. Please note,
the value of \letterlastpage is valid after some L
A
TEX runs, because it uses \label and
\pageref
. So you need at least two or three L
A
TEX runs, if you use \letterlastpage. Please
have a look at Rerun terminal or log-file messages about labels that have been changed.
\opening{opening }
This is one of the most important commands in scrlttr2. For the user it may seem that only
the opening , e. g., “Dear Mrs . . . ”, is typeset, but the command also typesets the folding
marks, letterhead, address field, reference fields line, subject, the page footer and others. In
short, without \opening there is no letter. And if you want to print a letter without opening
you have to use an \opening command with an empty argument.
Example: Let’s extend the example from
page 144
by an opening:
\documentclass[version=last]{scrlttr2}
\usepackage[english]{babel}
\begin{document}
\begin{letter}{%
Joana Public\\
Hillside 1\\
12345 Public-City%
}
\opening{Dear chairman,}
\ end{letter}
\end{document}
This will result in a note paper sheet shown in
figure 4.3
.
147
Chapter 4.
Figure 4.3.: result of a minimalistic letter with addressee
and opening only (date and folding marks are defaults of
DIN-letters)
Joana Public
Hillside 1
12345 Public-City
June 17, 2016
Dear chairman,
\closing{closing phrase }
The main purpose of the command \closing is to typeset the closing phrase . This may
even consists of multiple lines. The lines should be separated by double backslash. Paragraph
breaks inside the closing phrase are not allowed.
Beyond that the command also typesets the content of the variable signature. More infor-
mation about the signature and the configuration of the signature may be found at
section 4.20
ab
page 192
.
Example: Let’s extend the our example by some lines of text and a closing phrase:
\documentclass[version=last]{scrlttr2}
\usepackage[english]{babel}
\begin{document}
\begin{letter}{%
Joana Public\\
Hillside 1\\
12345 Public-City%
}
\opening{Dear chairman,}
the last general meeting was about one year ago.
I want to remind you, that the constitution of our
club advises you to make a general meeting every
148
Chapter 4.
Figure 4.4.: result of a small letter with addressee, opening,
text, and closing (date and folding marks are defaults of
DIN-letters)
Joana Public
Hillside 1
12345 Public-City
June 17, 2016
Dear chairman,
the last general meeting was about one year ago. I want to remind you, that the
constitution of our club advises you to make a general meeting every six month. Because
of this I expect the executive board to detain such a meeting immediately.
Expecting an invitation
six month. Because of this I expect the executive
board to detain such a meeting immediately.
\closing{Expecting an invitation}
\end{letter}
\end{document}
This will result in a the letter shown in
figure 4.4
.
\ps
This instruction merely switches to the postscript. Hence, a new paragraph begins, and a
vertical distance — usually below the signature — is inserted. The command \ps is followed
by normal text. If you want the postscript to be introduced with the acronym “PS:” , which
by the way is written without a full stop, you have to type this yourself. The acronym is
typeset neither automatically nor optionally by the class scrlttr2.
Example: The example letter extended by a postscript
\documentclass[version=last]{scrlttr2}
\usepackage[english]{babel}
\begin{document}
\begin{letter}{%
Joana Public\\
Hillside 1\\
149
Chapter 4.
Figure 4.5.: result of a small letter with addressee, opening,
text, closing, and postscript (date and folding marks are
defaults of DIN-letters)
Joana Public
Hillside 1
12345 Public-City
June 17, 2016
Dear chairman,
the last general meeting was about one year ago. I want to remind you, that the
constitution of our club advises you to make a general meeting every six month. Because
of this I expect the executive board to detain such a meeting immediately.
Expecting an invitation
PS: I hope you accept this as an friendly demand note.
12345 Public-City%
}
\opening{Dear chairman,}
the last general meeting was about one year ago.
I want to remind you, that the constitution of our
club advises you to make a general meeting every
six month. Because of this I expect the executive
board to detain such a meeting immediately.
\closing{Expecting an invitation}
\ps PS: I hope you accept this as an friendly
demand note.
\end{letter}
\end{document}
results in
figure 4.5
.
In the time when letters were written by hand it was quite common to use a postscript because
this was the only way to add information which one had forgotten to mention in the main part of the
letter. Of course, in letters written with L
A
TEX you can insert additional lines easily. Nevertheless,
it is still popular to use the postscript. It gives one a good possibility to underline again the most
important or sometimes the less important things of the particular letter.
150
Chapter 4.
\cc{distribution list }
\setkomavar{ccseparator}[description ]{content }
With the command \cc it is possible to typeset a distribution list . The command takes
the distribution list as its argument. If the content of the variable ccseparator is not
empty, then the name and the content of this variable is inserted before distribution list .
In this case the distribution list will be indented appropriately. It is a good idea to set
the distribution list \raggedright and to separate the individual entries with a double
backslash.
Example: This time, the example letter should be send not only to the chairman, but also
to all club members:
\documentclass[version=last]{scrlttr2}
\usepackage[english]{babel}
\begin{document}
\begin{letter}{%
Joana Public\\
Hillside 1\\
12345 Public-City%
}
\opening{Dear chairman,}
the last general meeting was about one year ago.
I want to remind you, that the constitution of our
club advises you to make a general meeting every
six month. Because of this I expect the executive
board to detain such a meeting immediately.
\closing{Expecting an invitation}
\ps PS: I hope you accept this as an friendly
demand note.
\cc{executive board\\all members}
\end{letter}
\end{document}
The result is shown in
figure 4.6
.
In front of the distribution list a vertical gap is inserted automatically.
\encl{ enclosures }
\setkomavar{enclseparator}[description ]{content }
The enclosures have the same structure as the distribution list. The only difference is that
here the enclosures starts with the name and content of the variable enclseparator.
Example: Now, the example letter will be extended by some paragraphs from the constitu-
tion. These will be added as an enclosure. The description title will be changed
also, because there is only one enclosure and the default may be prepared for
several enclosures:
151
Chapter 4.
Figure 4.6.: result of a small letter with addressee, open-
ing, text, closing, postscript, and distribution list (date and
folding marks are defaults of DIN-letters)
Joana Public
Hillside 1
12345 Public-City
June 17, 2016
Dear chairman,
the last general meeting was about one year ago. I want to remind you, that the
constitution of our club advises you to make a general meeting every six month. Because
of this I expect the executive board to detain such a meeting immediately.
Expecting an invitation
PS: I hope you accept this as an friendly demand note.
cc: executive board
all members
\documentclass[version=last]{scrlttr2}
\usepackage[english]{babel}
\begin{document}
\begin{letter}{%
Joana Public\\
Hillside 1\\
12345 Public-City%
}
\opening{Dear chairman,}
the last general meeting was about one year ago.
I want to remind you, that the constitution of our
club advises you to make a general meeting every
six month. Because of this I expect the executive
board to detain such a meeting immediately.
\closing{Expecting an invitation}
\ps PS: I hope you accept this as an friendly
demand note.
\setkomavar*{enclseparator}{Enclosure}
\encl{Compendium of the constitution with the
general meeting paragraphs.}
\cc{executive board\\all members}
\end{letter}
\end{document}
152
Chapter 4.
Figure 4.7.: result of a small letter with addressee, open-
ing, text, closing, postscript, distribution list, and enclosure
(date and folding marks are defaults of DIN-letters)
Joana Public
Hillside 1
12345 Public-City
June 17, 2016
Dear chairman,
the last general meeting was about one year ago. I want to remind you, that the
constitution of our club advises you to make a general meeting every six month. Because
of this I expect the executive board to detain such a meeting immediately.
Expecting an invitation
PS: I hope you accept this as an friendly demand note.
Enclosure: Compendium of the constitution with the general meeting paragraphs.
cc: executive board
all members
This will result in
figure 4.7
.
4.8. Selection of Document or Letter Font Size
The main document font size is one of the basic decisions for the document layout. The
maximum width of the text area, and therefore splitting the page into text area and margins,
depends on the font size as stated in
chapter 2
. The main document font will be used for most
of the text. All font variations either in mode, weight, declination, or size should relate to the
main document font.
fontsize=size
In contrast to the standard classes and most other classes that provide only a very limited
number of font sizes, the KOMA-Script classes offer the feature of selection of any desired
size
for the main document font. In this context, any well known TEX unit of measure may
be used and using a number without unit of measure means pt.
If you use this option inside the document, the main document font size and all dependent
sizes will change from this point. This may be useful, e. g., if one more letter should be set
using smaller fonts on the whole. It should be noted that changing the main font size does
not result in an automatic recalculation of type area and margins (see \recalctypearea,
section 2.4
,
page 36
). On the other hand, each recalculation of type area and margins will be
153
Chapter 4.
done on the basis of the current main font size. The effects of changing the main font size
to other additionally loaded packages or the used document class depend on those packages
and the class. This may even result in error messages or typesetting errors, which cannot
be considered a fault of KOMA-Script, and even the KOMA-Script classes do not change all
lenghts if the main font size changes after loading the class.
This option is not intended to be a substitution for \fontsize (see [
Tea05a
]). Also, you
should not use it instead of one of the main font depending font size commands \tiny up to
\Huge
! Default at scrlttr2 is fontsize=12pt.
Example: Assumed, the example is a letter to “The friends of insane font sizes” and therefor
it should be printed with 14 pt instead of 12 pt. Only a simple change of the first
line is needed:
\documentclass[version=last,fontsize=14pt]{scrlttr2}
\usepackage[english]{babel}
\begin{document}
\begin{letter}{%
Joana Public\\
Hillside 1\\
12345 Public-City%
}
\opening{Dear chairman,}
the last general meeting was about one year ago.
I want to remind you, that the constitution of our
club advises you to make a general meeting every
six month. Because of this I expect the executive
board to detain such a meeting immediately.
\closing{Expecting an invitation}
\ps PS: I hope you accept this as an friendly
demand note.
\setkomavar*{enclseparator}{Enclosure}
\encl{Compendium of the constitution with the
general meeting paragraphs.}
\cc{executive board\\all members}
\end{letter}
\end{document}
Alternatively the option may be set at the optional argument of the letter envi-
ronment:
\ documentclass[version=last]{scrlttr2}
\usepackage[english]{babel}
\begin{document}
\begin{letter}[fontsize=14pt]{%
Joana Public\\
Hillside 1\\
154
Chapter 4.
12345 Public-City%
}
\opening{Dear chairman,}
the last general meeting was about one year ago.
I want to remind you, that the constitution of our
club advises you to make a general meeting every
six month. Because of this I expect the executive
board to detain such a meeting immediately.
\closing{Expecting an invitation}
\ps PS: I hope you accept this as an friendly
demand note.
\setkomavar*{enclseparator}{Enclosure}
\encl{Compendium of the constitution with the
general meeting paragraphs.}
\cc{executive board\\all members}
\end{letter}
\end{document}
In the case of this late change of the font size no recalculation of the type area will
happen. Because of this, the two results of
figure 4.8
differ.
4.9. Text Markup
What is described in
section 3.6
applies, mutatis mutandis. Names and meanings of the
individual items are listed in
table 4.2
. The default values are shown in the corresponding
paragraphs.
Table 4.2.: Alphabetical list of elements whose font can be changed in scrlttr2 using the commands
\setkomafont
and \addtokomafont
addressee
name und address in address field (
section 4.10
,
page 173
)
backaddress
return address for a window envelope (
section 4.10
,
page 173
)
descriptionlabel
label, i. e., the optional argument of \item, in a description environment (
sec-
tion 4.16
,
page 108
)
. . .
155
Chapter 4.
Joana Public
Hillside 1
12345 Public-City
June 17, 2016
Dear chairman,
the last general meeting was about one year ago. I want to remind you,
that the constitution of our club advises you to make a general meeting
every six month. Because of this I expect the executive board to detain
such a meeting immediately.
Expecting an invitation
PS: I hope you accept this as an friendly demand note.
Enclosure: Compendium of the constitution with the general meeting
paragraphs.
cc: executive board
all members
Joana Public
Hillside 1
12345 Public-City
June 17, 2016
Dear chairman,
the last general meeting was about one year ago. I want to remind you, that
the constitution of our club advises you to make a general meeting every six
month. Because of this I expect the executive board to detain such a meeting
immediately.
Expecting an invitation
PS: I hope you accept this as an friendly demand note.
Enclosure: Compendium of the constitution with the general meeting
paragraphs.
cc: executive board
all members
Figure 4.8.: result of a small letter with addressee, opening, text, closing, postscript, distribution list,
enclosure, and insane large font size (date and folding marks are defaults of DIN-letters):
at left one the font size has been defined by the optional argument of letter, at the right
one the optional argument of \documentclass has been used
Table 4.2.: Elements whose font can be changed (continuation)
foldmark
foldmark on the letter page; intended for color settings (
section 4.10
,
page 157
)
footnote
footnote text and marker (see
section 4.15
,
page 80
)
footnotelabel
mark of a footnote; used according to the element footnote (see
section 4.15
,
page 80
)
footnotereference
footnote reference in the text (see
section 4.15
,
page 80
)
. . .
156
Chapter 4.
Table 4.2.: Elements whose font can be changed (continuation)
footnoterule
horizontal rule
v3.07
above the footnotes at the end of the text area (see
section 3.14
,
page 83
)
labelinglabel
labels, i. e., the optional argument of \item in the labeling environment (see
sec-
tion 4.16
,
page 108
)
labelingseparator
separator, i. e., the optional argument of the labeling environment; used according
to the element labelinglabel (see
section 4.16
,
page 108
)
pagefoot
used after element pageheadfoot for the page foot, that has been defined with vari-
able nextfoot, or for the page foot of package scrlayer-scrpage (
chapter 5
,
page 212
)
pagehead
another name for pageheadfoot
pageheadfoot
the head of a page, but also the foot of a page at all page style, that has been defined
using KOMA-Script (see
section 4.13
,
page 190
)
pagenumber
page number in the header or footer (see
section 4.13
,
page 190
)
pagination
another name for pagenumber
placeanddate
v3.12
place and date, if a date line will be used instead of a normal reference line (
sec-
tion 4.10
,
page 180
)
refname
description or title of the fields in the reference line (
section 4.10
,
page 179
)
refvalue
content of the fields in the reference line (
section 4.10
,
page 179
)
specialmail
mode of dispatch in the address field (
section 4.10
,
page 173
)
. . .
157
Chapter 4.
Table 4.2.: Elements whose font can be changed (continuation)
lettersubject
v3.17
subject in the opening of the letter (
section 4.10
,
page 182
)
lettertitle
v3.17
title in the opening of the letter (
section 4.10
,
page 181
)
toaddress
variation of the element addressee for setting the addressee address (less the name)
in the address field (
section 4.10
,
page 173
)
toname
variation of the element addressee for the name (only) of the addressee in the
address field (
section 4.10
,
page 173
)
Dostları ilə paylaş: |