Search code examples
fontslatexletter

LATEX letter class font change


I'm using LATEX for writting a letter with "lettre" documentclass and I have no idea how to change the font. I can change the font in all other class but not in the letter one.

I'm trying to set the "ClearSans" font.

\documentclass[11pt, a4paper]{lettre}
\usepackage[francais]{babel}
\usepackage[utf8]{inputenc}

\usepackage[sfdefault]{ClearSans}
\usepackage[T1]{fontenc}


\begin{document}
    \begin{letter}{An address}
        \address{Somebody}
        \opening{Dear Mr x}

        Some text. Some text.

    \end{letter}
\end{document}

Thanks!


Solution

  • Unfortunately the lettre class uses hard-coded, old-style font switching commands (\rm). You can make this more flexible using

    \documentclass[11pt, a4paper]{lettre}
    \usepackage[francais]{babel}
    \usepackage[utf8]{inputenc}
    
    \usepackage[sfdefault]{ClearSans}
    \usepackage[T1]{fontenc}
    
    
    % https://tex.stackexchange.com/a/291238/140850
    \let\origletter=\letter
    \def\letter#1{\origletter{#1}\normalfont}
    
    \begin{document}
        \begin{letter}{An address}
            \address{Somebody}
            \opening{Dear Mr x}
    
             Some text. Some text.
    
        \end{letter}
    \end{document}
    

    Now the font you select as "default" is respected.