4

I'm trying to use the letter-classic class of the following version:

\ProvidesClass{letter-classic}[2003/03/04 v1.1]

The goal is to mix UTF-8 characters from German and Icelandic in an English letter. For the sake of this question I have come up with a minimal document that demonstrates my issue (store as UTF-8!):

\documentclass[12pt,a4paper]{letter-classic}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[icelandic,german,english]{babel}
\selectlanguage{english} %% main language of the letter

\begin{document}
\begin{letter}{Recipient}
\fromname{Max Mustermann}
\fromstreet{Musterstraße 123} %% using SZ ligature
\fromtown{12345 Musterstadt}
\fromtownshort{Musterstadt}

\opening{Dear Sir or Madam,}
%% body uses mixed Icelandic characters
\begin{itemize}
    \item Icelandic characters
    \begin{itemize}
        \item þ Þ - thorn
        \item æ Æ - AE ligature
        \item ö Ö - o with dieresis
        \item á Á - a with accent
        \item í Í - i with accent
        \item é É - e with accent
        \item ú Ú - u with accent
        \item ó Ó - o with accent
        \item ý Ý - y with accent
        \item ð Ð - eth
    \end{itemize}       
    \item German characters not in the above list
    \begin{itemize}
        \item ä Ä - a with dieresis
        \item ü Ü - u with dieresis
        \item ß   - SZ ligature
    \end{itemize}
\end{itemize}       

\end{letter}
\end{document}

The language-specific diacritic characters come out fine in the body of the letter, but not in the letter head.

NB: You can find the letter-classic.cls of the version I use in the following paste. I also found an archive that seems to correspond to my version of the document class, although the author's website is apparently no longer online.

I saw and read this question and accompanying answers as well as this article. All questions and answers I came up with so far deal exclusively with a particular single language or mixing English and whatever single other language. The problem there is that English has virtually no diacritic characters in its standardized form, so would use a subset of characters from any single language that uses the Latin script (diacritic or not).

I thought I could get away by declaring commands:

\newcommand{\ISL}[1]{\foreignlanguage{icelandic}{#1}}
\newcommand{\DEU}[1]{\foreignlanguage{german}{#1}}

and wrapping distinctly Icelandic words like Þjóðskrá and Ríkisskattstjóri as \ISL{Þjóðskrá} and \ISL{Ríkisskattstjóri} respectively; or distinctly German words like Musterstraße as \DEU{Musterstraße}. E.g. in \fromstreet{\DEU{Musterstraße 123}}.

However, that still doesn't allow me to use certain diacritic characters anywhere but in the body of the letter. The letter head simply doesn't accept most of these characters.

My LaTeX foo isn't exactly the strongest, but I like the format of letter-classic over the letter class that comes with several LaTeX distributions and would prefer to stick to it. So I wouldn't deem the suggestion to use the letter class instead as an answer, unless it provides steps to mold it into a similar shape as the letter-classic.cls already provides.

However, I noticed when pasting the class file that there are three lines declaring some font for later use:

\DeclareFixedFont{\bsf}{OT1}{cmss}{m}{n}{17.28}
\DeclareFixedFont{\nsf}{OT1}{cmss}{m}{n}{10}
\DeclareFixedFont{\ssf}{OT1}{cmss}{m}{n}{7}

I know OT1 is a standard font providing the bare minimum of glyphs and that \usepackage[T1]{fontenc} lets me extend on that bare minimum. Will it be sufficient to replace OT1 by T1 in those instances or will this come back later to bite me in some subtle ways?

An initial experiment suggests that it fixes the immediate issue. But I don't like just patching up symptoms when the root cause may still be there; just better hidden this time.

Also: is it good form to wrap foreign words in \foreignlanguage{}?

  • I think a modern class like scrlttr2 or the package scrletter might be better to use instead of that rusty thing without any maintainer information. – Johannes_B Mar 28 '15 at 13:16
  • @Johannes_B: do they offer a similar look? – 0xC0000022L Mar 28 '15 at 13:17
  • Looking at the class, it seems like it was modeled after an early version of KOMA. You should definitely try it out. – Johannes_B Mar 28 '15 at 13:21
  • btw, input/output of the charackters has nothing to do with babel. Babel is needed for getting Kapitel instead of chapter and localized dates, and not to forget, the right hyphenation patterns. – Johannes_B Mar 28 '15 at 13:28
  • 1
    Now that i read the whole question i see, that you already found the solution yourself. You can safely make the replacement. – Johannes_B Mar 28 '15 at 13:32
5

Just change the definition of the three fixed fonts to use the default encoding.

\documentclass[12pt,a4paper]{letter-classic}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[icelandic,ngerman,english]{babel}
\usepackage{lmodern}
%\selectlanguage{english} %% main language of the letter (not necessary)

\DeclareFixedFont{\bsf}{\encodingdefault}{\sfdefault}{m}{n}{17.28}
\DeclareFixedFont{\nsf}{\encodingdefault}{\sfdefault}{m}{n}{10}
\DeclareFixedFont{\ssf}{\encodingdefault}{\sfdefault}{m}{n}{7}


\begin{document}
\begin{letter}{Recipient}
\fromname{Max Ðusþermann}
\fromstreet{Musterstraße 123} %% using SZ ligature
\fromtown{12345 Musterstadt}
\fromtownshort{Musterstadt}

\opening{Dear Sir or Madam,}
%% body uses mixed Icelandic characters
\begin{itemize}
    \item Icelandic characters
    \begin{itemize}
        \item þ Þ - thorn
        \item æ Æ - AE ligature
        \item ö Ö - o with dieresis
        \item á Á - a with accent
        \item í Í - i with accent
        \item é É - e with accent
        \item ú Ú - u with accent
        \item ó Ó - o with accent
        \item ý Ý - y with accent
        \item ð Ð - eth
    \end{itemize}       
    \item German characters not in the above list
    \begin{itemize}
        \item ä Ä - a with dieresis
        \item ü Ü - u with dieresis
        \item ß   - SZ ligature
    \end{itemize}
\end{itemize}       

\end{letter}
\end{document}

I have commented out the \selectlanguage instruction that's not necessary (and wrong in that place). I also added lmodern just to show that the declarations do what they're supposed to do: note the changed surname that uses Icelandic characters. I also used ngerman rather than german, to comply with the new orthography of German.

The idea of wrapping foreign words in \foreignlanguage is good.

enter image description here

4

The glyphs do not seem to be available with Computer Modern Sans Serif in OT1 encoding. The class defines three different switches, ssf, nsf and bsf, for small, normal and big cmss fonts, but all of them in OT1 encoding. T1 encoding (or Cork encoding) was developed to handle glyphs of western european alphabets. Simply declaring the switches in the document using T1 should do the trick and no trip wires are to be expected.

0xCFontencodingDiacritics

\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[icelandic,german,english]{babel}
\DeclareFixedFont{\ssf}{OT1}{cmss}{m}{n}{7}
\begin{document}
\begin{minipage}{.45\textwidth}
    Icelandic characters
    \begin{itemize}
            \ssf
        \item þ Þ - thorn
        \item æ Æ - AE ligature
        \item ö Ö - o with dieresis
        \item á Á - a with accent
        \item í Í - i with accent
        \item é É - e with accent
        \item ú Ú - u with accent
        \item ó Ó - o with accent
        \item ý Ý - y with accent
        \item ð Ð - eth
    \end{itemize}       
    German characters not in the above list
    \begin{itemize}
            \ssf
        \item ä Ä - a with dieresis
        \item ü Ü - u with dieresis
        \item ß   - SZ ligature
    \end{itemize}
\end{minipage}\hfill
\begin{minipage}{.45\textwidth}
\DeclareFixedFont{\ssf}{T1}{cmss}{m}{n}{7}
    Icelandic characters
    \begin{itemize}
            \ssf
        \item þ Þ - thorn
        \item æ Æ - AE ligature
        \item ö Ö - o with dieresis
        \item á Á - a with accent
        \item í Í - i with accent
        \item é É - e with accent
        \item ú Ú - u with accent
        \item ó Ó - o with accent
        \item ý Ý - y with accent
        \item ð Ð - eth
    \end{itemize}       
    German characters not in the above list
    \begin{itemize}
            \ssf
        \item ä Ä - a with dieresis
        \item ü Ü - u with dieresis
        \item ß   - SZ ligature
    \end{itemize}
\end{minipage}       
\end{document}

The class seems to be modeled after an early version of KOMA-script letter. The current version scrlttr2 is a very feature rich documentclass with lots of options to change the appearance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.