Note: This document is a translation of the German koma script manual



Yüklə 2,79 Mb.
Pdf görüntüsü
səhifə14/60
tarix03.02.2017
ölçüsü2,79 Mb.
#7439
1   ...   10   11   12   13   14   15   16   17   ...   60

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:

\newcounter{Question}[letter]

\newcommand{\Question}[1]{%

\refstepcounter{Question}\par


Chapter 4: The New Letter Class scrlttr2

155

\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 153


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

.


Chapter 4: The New Letter Class scrlttr2

156

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

January 15, 2017

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 212


.

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


Chapter 4: The New Letter Class scrlttr2

157

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

January 15, 2017

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\\



Chapter 4: The New Letter Class scrlttr2

158

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

January 15, 2017

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.

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.

\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.



Chapter 4: The New Letter Class scrlttr2

159

\cc{distribution list }

\setkomavar

{ccseparator}[description ]{contents }

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 ]{contents }

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



Chapter 4: The New Letter Class scrlttr2

160

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

January 15, 2017

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

also, because there is only one enclosure and the default may be prepared for

several enclosures:

\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.}


Chapter 4: The New Letter Class scrlttr2

161

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

January 15, 2017

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

\cc{executive board\\all members}

\end{letter}

\end{document}

This will result in

figure 4.7

.

4.8. Selection of the Document Font Size

What is described in

section 3.5

applies, mutatis mutandis. So if you have alread read and

understood

section 3.5

you can jump to the example at the end of this section on

page 162


.

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.



Chapter 4: The New Letter Class scrlttr2

162

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 37


). On the other hand, each recalculation of type area and margins will be

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

lengths 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.}


Chapter 4: The New Letter Class scrlttr2

163

\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\\

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. So if you have alread read and

understood

section 3.7

you can switch to

page 167


. But you should have a look at

table 4.2

,

page 165


.

L

A



TEX offers different possibilities for logical and direct markup of text. Selection of the font

family commands, as well as choosing the font size and width is supported. More information

about the standard font facilities may be found at [

OPHS11


], [

Tea05b


], and [

Tea05a


].

Chapter 4: The New Letter Class scrlttr2

164

Joana Public

Hillside 1

12345 Public-City

January 15, 2017

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

January 15, 2017

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

\textsuperscript{Text }

\textsubscript{Text }

The L


A

TEX-Kern already defines the command \textsuperscript to superscript text. Un-

fortunately, until release 2015/01/01 L

A

TEX itself does not offer a command to produce text



in subscript instead of superscript. KOMA-Script defines \textsubscript for this purpose.

You may find an example of usage at

section 3.6

,

page 56



.

\setkomafont{element }{commands }

\addtokomafont{element }{commands }

\usekomafont{element }

With

v2.8p


the help of the two commands \setkomafont and \addtokomafont, it is possible to

define the commands that change the characteristics of a given element . Theoretically, all

possible statements including literal text could be used as commands . You should, however,

absolutely limit yourself to those statements that really switch only one font attribute. This

will usually be the commands \normalfont, \rmfamily, \sffamily, \ttfamily, \mdseries,


Chapter 4: The New Letter Class scrlttr2

165

\bfseries

, \upshape, \itshape, \slshape, and \scshape, as well as the font size commands

\Huge


, \huge, \LARGE, \Large, \large, \normalsize, \small, \footnotesize, \scriptsize,

and \tiny. The description of these commands can be found in [

OPHS11

], [


Tea05b

], or


[

Tea05a


]. Color switching commands like \normalcolor (see [

Car05


] and [

Ker07


]) are also

acceptable. The behavior when using other commands, especially those that make redefinitions

or generate output, is not defined. Strange behavior is possible and does not represent a bug.

The command \setkomafont provides a font switching command with a completely new

definition. In contrast to this, the \addtokomafont command merely extends an existing

definition. It is recommended to not use both commands inside the document body, but

only in the document preamble. Usage examples can be found in the paragraphs on the

corresponding element. Names and meanings of the individual items are listed in

table 4.2

.

The default values are shown in the corresponding paragraphs.



With command \usekomafont the current font style may be changed into the font style of

the selected element .A general example for the usage of \setkomafont and \usekomafont

may be found in

section 3.6

at

page 57


.

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 182



)

backaddress

return address for a window envelope (

section 4.10

,

page 182


)

descriptionlabel

label, i. e., the optional argument of

\item


, in a

description

environment (

sec-


tion 4.16

,

page 209



)

foldmark


foldmark on the letter page; intended for color settings (

section 4.10

,

page 168


)

footnote


footnote text and marker (see

section 4.15

,

page 206


)

footnotelabel

mark of a footnote; used according to the element

footnote


(see

section 4.15

,

page 206


)

footnotereference

footnote reference in the text (see

section 4.15

,

page 206


)

. . .


Yüklə 2,79 Mb.

Dostları ilə paylaş:
1   ...   10   11   12   13   14   15   16   17   ...   60




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©www.azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin