Configuration

Prev |  | Next

# 3. Configuration

## 3.1. The configuration file

Some things could be configured in Muttprint. This is permanently done in the configuration files `$HOME/.muttprintrc` (only for the current user) or `/usr/local/etc/Muttprintrc` (global for all users). User settings override global settings.

You can also specify an additional configuration file with the `-r `filename`` option. This file is read finally and overwrites command line settings, too. This additional configuration file is useful for using more than one configurations and you can combine it with some Hooks of Mutt.

The configuration file is structured in a way that values are assigned to different variables -- this is different from `.muttrc`. The name of the variable stands first and is case sensitive; take over them exactly. Then follows a equal sign (`=`) without any whitespace. At last, there's the value. Quotes (`'` or `"`) are optional.

An example for a configuration file is distributed with Muttprint (`sample-muttprintrc`). If you've installed a RPM or debian package, you'll find it in `/usr/local/share/doc/muttprint/`.

An example for a correct assignment:

    VARIABLE=value

Normally the script works without any adapts. But it is recommended to inform about the possibilities you have.

### 3.1.1. Printer

If Muttprint should not print to lp, you can change this by setting `PRINTER` to the correct value.

To print in a file, you could use following syntax, the name (and location) of the file is freely chosable:

    PRINTER="TO_FILE:/foo/bar/test.ps"

If duplex printing is enabled, Muttprint creates a second file with the prefix `2`, e. g. `test.ps2`.

### 3.1.2. Printing command

Muttprint uses lpr to print in its default setting. If you would like to use another printing command, set `PRINT_COMMAND` to the program you would like to use. The string `$PRINTER` is replaced by the choosed printer. The default is `lpr -P$PRINTER`.

> Tip: You could use the setting `gv -` to have a print preview. This is useful if you test different settings.

### 3.1.3. Penguin

As a default setting it is printed a little penguin on the right top of the page. If there should be another picture or if the penguin has another location as Muttprint assumes, you can configure this by setting the `PENGUIN` variable to the right value. The picture must be in Encapsulated PostScript (you could use convert from the Image Magick package for converting your favourite picture into EPS) and it is scaled to a height of 2 cm (5.08 in). The logo must not have a higher width than height.

If `PENGUIN=on`, Muttprint tries to find out the location of the penguin file. (Read the source code to find out, where Muttprint searches.) This is the default setting.

Additionally, Muttprint comes with some example pictures that are already converted into the EPS format. After the installation, you'll find this in `/usr/local/share/muttprint`.

If the printing of the graphic should turned off, set `PENGUIN` to the value `off`.

### 3.1.4. Printing of X-Faces

X-Faces are black and white pictures with a size of 48 x 48 pixels, that could be included as mailheader (the `X-Face:` header) in each message. This is no "official" standard but it is spread especially in news articles.

Muttprint supports the printing of this picture instead of the image specified with the `PENGUIN` varaible. To do this, set `XFACE` to `on`. If there's no such header, the `PENGUIN` picture (or nothing) is printed.

To work right, following two programs are required:

- convert from the Image Magick package

- uncompface

Both programs should be part of common Linux distributions and can simply be installed.

In any case you must make sure that this header is really dumped to Muttprint. If you use Mutt, see Section 2.3.1 for a correct configuration. Otherwise read the documentation of your mail software.

### 3.1.5. Duplex printing

Muttprint allows manual duplex printing. It prints odd pages at first, waits a while and prints then even pages.

Muttprint needs the speed of your printer to calculate the time when the printing of even pages will start, see Section 3.1.9.

To activate the duplex printing, set `DUPLEX` to `on`.

If you own a real Postscript printer and if this printer has duplex capabilities, you should set `DUPLEX` to `printer`. This changes the Postscript code in a way that tells your printer to enable automatic duplex printing.

### 3.1.6. Paper save mode

It's possible to print two pages on one page in landscape. This allows you to save paper and ink and increases the printing speed. This makes only with the paper format DIN A4 sense because two reduced pages fit exactly to one sheet.

To enable this mode, set `PAPERSAVE` to `on`.

If you only want to activate the papersave mode if more than one page is printed, set `PAPERSAVE` to `optional`.

### 3.1.7. Date

The `DATE` option allows two settings: `original` and `local`. If set to `original`, Muttprint print the date unchanged as it is in the mail header, i. e. in English and in the sender's time zone.

If you set this option to `local`, Muttprint converts the time zone in the time zone of the system and prints the date in the local language [1].

The format of the date could be specified with the `DATE_FORMAT` variable. The argument is a format string, e. g. `"%A, %d. %B %Y %H:%M:%S"`. The quotation marks are necessary because the string contains spaces. The strftime(3) manpage contains details about it.

### 3.1.8. Format of printed mail addresses

There are different ways of writing mail address and realname together in the mailheader. Here're some examples:

- `Bernhard Walle <Bernhard.Walle@gmx.de>`

- `"Bernhard Walle <Bernhard.Walle@gmx.de>`

- `Bernhard.Walle@gmx.de (Bernhard Walle)`

The used format depends of the mail program of the sender; all three are correct. If the variable `ADDRESSFORMAT` is set to the value `original`, the addresses are printed unchanged.

If you would like uniform mail heaers, you can assign a format string to this variable. The default setting is `"%r <%a>,\n"`. You can use all characters as format string, `%r` is substituted by the name ("real name"), `%a` by the mail address and `\n` prints a newline. The paling quotes are necessary because of the spaces. A newline at the end means that every address is printed in a seperate line if more than one address is given. Muttprint removes newlines and commas after the last address automatically.

Additionally, particular parts could be printed bold or italic. If a part is embedded in stars (`*`), the text is bold; slashes (`/`) means italic printing; nesting is possible.

Here is just another example for a format string (this is the one that I use): `"/%r/ (%a),"`.

### 3.1.9. Printing speed

As mentioned above, Muttprint requires the duration which your printer needs to print one page. This setting is done by setting the variable `SPEED` to the value in seconds (only integers are allowed). Default is 30 seconds (`SPEED=30`).

### 3.1.10. Font

You could use different fonts for the printing. The correspondent variable is names `FONT`. `Latex` (standard steting) means the standard LaTeX font of the EC family. `Latex-bright` uses Computer Modern Bright. This font is not available on current Debian systems because of its license[2]

There are several Postscript fonts which are possible here: `Times`, `Palatino`, `Utopia`, `Charter` and `Bookman`.

Of course the fonts has to be installed on your system. As the LaTeX distribution teTeX is standard on Linux systems, this should be no problem.

### 3.1.11. Font size

You can control the font size with the variable `FONTSIZE`. Only the values `10pt`, `11pt` and `12pt` are possible.

### 3.1.12. Formatting of the mail body

The mail body is split into two parts: text and signature. If there is a signature and it should not be removed (see Section 3.1.18), this two parts can be formated separately.

Muttprint uses the LaTeX package `fancyvrb.sty` to print the body, which offers lots of formatting options. The options which are passed to the `Verbatim` environment could be set with the variable `VERBATIMNORMAL` (for the normal text) and `VERBATIMSIG` (for the signature).

You'll find the exact syntax in the documentation of `fancyvrb.sty`, which could be viewed with the command texdoc fancyvrb. Normally, the signature is printed in Italics. You can print borders, too.

If you don't want a separate formating of mail body and signature, just set `VERBATIMSIG` to `raw`. If so, the signature is treated as normal mail text and is printed like this (including the signature separator).

Here're some examples:

- `fontshape=it,frame=topline`: italic font, border above the block

- `fontfamily=helvetica,fontseries=b`: Helvetica font, bold

- `numbers=left,stepnumber=5`: Line nummering each fifth line

### 3.1.13. Margin settings

The margins could be set by modifiying following variables: `TOPMARGIN` (top margin), `BOTTOMMARGIN` (bottom margin), `LEFTMARGIN` (left margin) and `RIGHTMARGIN` (right margin).

This variables should be set to a integer, which specifies the margin in millimeters (mm). Other measuring units are not possible; 25.4 mm are 1 inch.

### 3.1.14. Wrapping long lines

The length of the longest line is specified with the `WRAPMARGIN` variable. Longer lines are wrapped automatically but shorter lines are not joined.

### 3.1.15. Rules under/over head- and footline

There could be printed a rule under the headline resp. over the footline. They are turned off as default.

Set the variables `HEADRULE` resp. `FOOTRULE` to `on` or `off`.

### 3.1.16. Design of the first pages

There exists different possibilities to highlight the mailheaders on the first page. Here is a listing of them:

Style | Description
--- | ---
`plain` | no rules
`border` | rule after the headers (default setting)
`fbox` | simple box around the mailheaders
`shadowbox` | shadowbox arount the header
`ovalbox` | box with rounded corners arount the header (thin lines)
`Ovalbox` | same as `ovalbox` but thicker lines
`doublebox` | box with double lines around the header
`grey` | grey background behind the headers
`greybox` | same as `grey` but with a additional black box

Set the variable `FRONTSTYLE` to a value from the table above.

### 3.1.17. Paper format

To set the paper format, set `PAPER` to the right value. Possible are only `A4` and `letter`.

If there exists a file `/usr/local/etc/papersize` as usually on Debian systems, it is evaluated, too. Own settings overwrite this system settings.

### 3.1.18. Cut signature

Often the signature contains unseless information or advertising and should therefore not be printed. Muttprint is able to cut the signature, if it was separated from the mail by using "`––` " -- take a look at the whitespace (some mail clients don't generate a correct separator).

To do this you've to set `REM_SIG` (this means "remove signature" to the value `on`.

### 3.1.19. Omit quoting

Often the author of the mail does not quote sensibly but attaches the whole mail so that the printing becomes very long and confusing.

If `REM_QUOTE` is set to `on`, the quoting will not be printed. Muttprint detects the quoting by using the same regular expression that Mutt does in its standard configuration. So the text which is color emphasized from Mutt should omited in the printing. This corresponds to the toggle quote funktion (Shift-t) on screen.

### 3.1.20. Printed headers

Normally only the interesting headers are printed. You could change this settings with the variable `PRINTED_HEADERS`. Specify each header separated with a underline (`_`).

The order is important for the printing. The evaluation is case-insensitive. Headers that doesn't exist are ignored. For bold printing embed the name of the header in stars (`*`), for italic printing do the same with slashes (`/`).

The default setting is:

    PRINTED_HEADERS="Date_To_From_CC_Newsgroups_*Subject*"

One more example for a sensible setting:

    PRINTED_HEADERS="/Date/_To_From_*Subject*_X-Mailer"

### 3.1.21. Own LaTeX code

The variable `LATEXCODE` is for people who are very familar with LaTeX and would like to customize the printing without changing the source code of Muttprint. For example, it is useful to use own fonts.

Besides `LATEXCODE` there are five additional variables (`LATEXCODE1` till `LATEXCODE5`) to split your LaTeX code nicely. This variables are integrated in the code in this order.

> Tip: You could print the mail text in a proportional font (instead of typewriter font) with following setting:

>     LATEXCODE="\renewcommand{\ttdefault}{\rmdefault}"

### 3.1.22. Error messages

The output of latex and dvips are not displayed. If there are any problems, it would be helpful to read this output. Therefore you should set `DEBUG` to `1` in your `.muttprintrc`. Now Muttprint creates a logfile named `/tmp/muttprint.log` in the next run so that you can watch the error messages. This could be helpful for all bug reports, too.

## 3.2. Command line options

Most configuration settings could be made by command line options as well. The advantage is a easier integration in the mail client (e. g. with own macros).

You find a detailled description of all options with muttprint `-h` oder or in the muttprint(1) manpage.

The effects of this options are the same as in the configuration file but command line settings override all other settings.

## 3.3. Different languages

Muttprint supports different languages. Normally the environment variable `LANG` is set to the right value: e. g. `de`, `it`, `fr`, `es` or `en`, which is the shortcut according to ISO 639. Only the first two characters are recognized so that `de_DE@euro` is okay. If the value is not known, Muttprint falls back to English.

You find a overview about all available translations in the file `README.translations`, which is installed with the documentation in the same directory.

If you would like to use another language for Muttprint than for the remaining system, you could define `LANG` in your `.muttprintrc`.

### 3.3.1. Lanuages on the printing

The most important effects of language adaption are on the printing: the mail header and the date.

The last one is created with the LaTeX package `babel.sty`. Muttprint passes the right option which corresponds to your language to the package. You could set your own value with the variable `LPack`, e. g. to `austrian`, `spanish`. Read texdoc babel for a list of all possible values.

If you would like to use another strings for the printed header, you could set following variables:

- `FROM_STRING`

- `TO_STRING`

- `SUBJECT_STRING`

- `CC_STRING`

- `DATE_STRING`

- `PAGE_STRING`

- `OF_STRING`

- `NEWSGROUPS_STRING`

Additional headers that are configured for printing (see Section 3.1.20) could not be translated.

### 3.3.2. Charsets

Muttprint supports different charsets for the printing. Here's a short overview:

charset | option | description
--- | --- | ---
ISO-8859-1 | `latin1` | west European lanuages
ISO-8859-2 | `latin2` | east European languages
ISO-8859-3 | `latin3` | southeast European and miscellaneous languages
ISO-8859-4 | `latin4` | southeast European and miscellaneous languages
ISO-8859-9 | `latin5` | Latin-1 modification for Turkish
ISO-8859-15 | `latin9` | Latin-1 with some modifications, e. g. Euro currency symbol
Windows-1252 | `latin1` | Latin-1 with some enhancements
Windows-1250 | `latin2` | Latin-2 with some enhancements

This charsets allows you printing of most languages that use latin characters. The charset handling is mostly based on the LaTeX package `inputenc.sty`, but it is extended.

The default charset is Latin-1. If there are translation files, the charset is changed to the Country-specific one. For example, for German the charset Latin-9 is used for printing the Euro currency sign correctly. For Czech, the charset is changed to Latin-2 because it's a east European language.

Moreover, you can change the charset in the configuration file with the variable `CHARSET`. Normally, you should set this to the charset used for displaying the mail on the screen, see the variable `charset` of Mutt.

If you set `CHARSET` to the value `auto`, Muttprint tries to find a suitable mail header that contains the charset of the mail. Use this setting carefully. For example, Mutt adapts the output to the screen charset. On the other side, this setting could be useful if you often print mails with different charsets.

Aside from the charsets of the ISO-Latin family, Muttprint supports the enhancements of the Windows charsets Windows-1252 (West European) and Windows-1250 (East European). This charsets extends the ISO charsets with some characters, for example typographical quotation marks, per mille sign or the Euro sign. Last one often appears one the place 128 (decimal) because of the wide spread of Windows -- partial declared as ISO-8859-1. Muttprint prints this mails correctly, if the mailclient doesn't change something.

You find a full overview about the ISO-8859-* charsets on http://czyborra.com/charsets/iso8859.html.

### 3.3.3. Translation file

The Muttprint translation files are located in the `share` directory and have the name `translation-`language`.pl`. You could add new files in this directory without any changes on the Muttprint script. Not only the headers mentioned above but also the help message are translated here.

For new translations take any file as template, copy it and translate it. If you would like to provide your translation to other users, just send me the new file with a e-mail and I'll add it in the next release.

### Notes

[1] | This works independent from the translation file by using the functions of the operating system. Despite this, the `LANG` (see Section 3.3) in the configuration file affects the language of the date.
[2] | You can download this font and install it on your computer from the CTAN. You find the fonts in CTAN:/tex-archive/nonfree/fonts/cmbright/ (CTAN = Comprehensive TeX Archive Network consists of a network of several servers. The CTAN server in Germany is ftp://ftp.dante.de, in the United Kingdom ftp://cam.ctan.org and in the United States ftp://tug.ctan.org).

Prev | Home | Next
Installation |  | Notes