Sie sind hier

\makelabels mit scrlttr2

Bild von Markus Kohm

Letter Class Option mlabel
Copyright (c) Markus Kohm, 2009
Licence: LPPL
Version: 2009/07/10 v0.5 UNSUPPORTED BETA VERSION
KOMA-Script related: yes

The standard letter class `letter' has a label feature, you may activate using \makelabels. While in germany window envelopes are common, printing labels is not common and scrltt2 never supported label printing. At the `KOMA-Script Buch' I've shown how you may print labels simply by printing a letter with special pseudo value settings. Doing this you may use several configuration features. Using mlabel in opposite does only implement a \makelabels feature like the standard classes. Currently there are no configuration features at mlabel.lco and only avery 8162 or compatible labels are supported. But you may use package envlab from CTAN after loading mlabel.lco to get various configuration features.

Like all other Letter Class Options you may load mlabel.lco either via the optional parameter of \documentclass or using \LoadLetterOption{mlabel}. After this, you may use command \makelabels as usual.

Following variables are used for producing the \mlabel command at the aux-file:

first argument:
second argment:
toname and toaddress

While the \mlabel will be written at \end{letter} you may change these values somewhere before \end{letter}—even after \closing{...}—to get other label results.


  • mlabel.lco must not be loaded after \begin{document}!

Package icon mlabel.lco v0.5 and examples48.68 KB


Bild von Markus Kohm

User "redwood" asked for something like this at the forum. See also the thread there.

If you look at your mlabeltestx
you will note that the \toname is typeset with a serif font
whereas the \toaddress is typeset (wrongly) in sans-serif

A workaround is to enclose the \toname\\\toaddress in extra brackets:

\begin{letter}{{Jane Doe\\2 Alpha Street\\Otherplace, NY 12346}}

Weird, yes?

Bild von Markus Kohm

envlab.sty defines \@toaddressfont using \def (instead of e.g. \newcommand or \providecommand). So it does not recognize, that this macros was already defined by scrlttr2. It's the macro that scrlttr2 uses for the internal representation of the font you may set by \setkomafont{toaddress}. If you don't want envlab's change of the font, you have to reset it to the wanted setting after loading envlab, e.g.

% You may add this after loading package envlab:
\setkomafont{toaddress}{}% don't like envlab's change of the address font
%\setkomafont{toname}{\usekomafont{toaddress}}% want envlab's change of the
                                             % address font even for the name
                                             % of the addressee

With the extra braces everthing is the toname and toaddress is empty. So no address is set only a name. This is not a good solution, because if you want to use \usekomavar{toname} without \usekomavar{toaddress} (e.g. at the head of the second letter page) you'll get name + address instead of name only.

That did the trick.

I have a color printer, a Xerox Phaser 8860, for which the black ink sticks costs triple that of the color sticks, so it would be nice to print envelopes in color to save on black ink. So I found a way to change the color/formatting of the returnaddress by modifying your mlabel.lco:

diff ../mlabel.lco mlabel_new.lco
<     \protected@edef\returnaddress{\scr@backaddress@var}%
>     \protected@edef\fromaddress{\scr@backaddress@var}%
<       \string\@mlabel{\returnaddress}{\toname\\\toaddress}%
>       \string\@mlabel{\returnaddress}{\mailtoaddress}%
> \def\returnaddress{\fromaddress}
> \def\mailtoaddress{\toname\\\toaddress}

Then one can re-define the returnaddress later in the lyx preamble,

I don't see anyway to do something similar with the
mailtoaddress, other than to change envlab's \PrintAddress:

\lineskip=1pt \ToAddressFmt
\if@barcodes \PrintBarCode{#1} \fi
\if@capitalizeaddress \@make@capitalize{#1} \else #1 \fi}}
Comments for "\makelabels mit scrlttr2" abonnieren