4

I want to place the date above the receiver address with KOMA-Script class scrlttr2. I'm using the NF.lco or \LoadLetterOption{NF}

In French letters,

  • the first line contains the date, flushed to the right
  • then the sender address on the left
  • then the receiver address on the right
  • then the subject
  • ...

I can use the excellent lettre class from 'Observatoire de Genève' to obtain the correct french layout (see below), but I'm constrained by my org-mode export tool using scrlttr2 as the LaTeX class.

How do I do that ?

In fact I'de love to have an org-mode tool to export directly to the lettre class. An alternative would be to reproduce the 'lettre' layout in a .lco file. but that not my question here.

I probably have not read enough linearly the official documentation but random regex search in it for 'date' 'date.*position' 'position' did not give me satisfying results.

Below are illustration of what I have and then what I want

What I have

enter image description here

for the following code

\documentclass[a4paper,11pt,french]{scrlttr2}

\usepackage{palatino} 
\usepackage[T1]{fontenc} 
\usepackage{ucs} 
\usepackage[utf8x]{inputenc} 
\usepackage{eurosym} 
\usepackage{geometry} 
\usepackage{graphicx} 
\geometry{verbose,a4paper,lmargin=3cm,rmargin=3cm}

\setlength\parskip{\medskipamount} \setlength\parindent{0pt}

\usepackage{setspace} \usepackage{lipsum} \setstretch{1.15}

\LoadLetterOption{NF}%                         

\KOMAoptions{%
   fromalign=left% alignment of the address
  ,fromphone=true%         print sender phone number 
  ,fromemail=true%  print sender e-mail address  
  ,fromlogo=true%         print a logo (position depends on fromalign)
}

\setkomavar{date}{le \today}

\setkomafont{backaddress}{\rmfamily} 
\setkomafont{fromaddress}{\small} 
\setkomafont{fromname}{\scshape} 
\setkomavar{backaddressseparator}{ $\cdot$ } 
\setkomavar{backaddress}{}

\setkomavar{emailseparator}{~:~} \setkomavar{enclseparator}{ > } \setkomavar{fromaddress}{7-13 rue dejourney\\  49000 ANGERS} \setkomavar{fromemail}{gigiair@gigiair.fr} \setkomavar{fromname}{Gigiair} \setkomavar{fromphone}{0123 456 789} \setkomavar{phoneseparator}{~:~} \setkomavar{place}{Angers} \setkomavar{signature}{\qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad  \quad  \quad \includegraphics[width=2.5cm]{signature}} \setkomavar{subjectseparator}{ >>> } \setkomavar{subject}{Modèle}

\usepackage{babel}

\begin{document}


\begin{letter}{\`A Madame la centurion\\
    Camps de Babaurum\\
    Bretagne conquise}   \def\concname{Objet :~} 

  \opening{Madame la centurion,}   C'est une invitation pour manger du sanglier roti.   \closing{à la tienne !}

  \cc{Panoramix et Obleix} \end{letter} \end{document}

and what I want

enter image description here

from the following code

\documentclass[11pt, francais]{lettre} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{lmodern} \usepackage[francais]{babel} \usepackage{mathcomp} \usepackage{url}

\makeatletter \newcommand*{\NoRule}{\renewcommand*{\rule@length}{0}} \makeatother

\begin{document}

\begin{letter}   {\`A Madame la centurion
    \\Camps de Babaurum
    \\Bretagne conquise}   \def\concname{Objet :~}    \conc{Fête au village}

  \NoRule

  \name{Abraracourcix chef}   \address{Village des irréductibles Gaulois\\ Armorique}   \lieu{Bretagne Libre}

  \telephone{0123 456 789}   \nofax   \email{goscini@uderzo.be}

  \opening{Madame la centurion,}   C'est une invitation pour manger du sanglier roti.   \closing{à la tienne !}

  \cc{Panoramix et Obleix}


\end{letter} \end{document}
Adding a page from scrguien.pdf (KOMA-Script manual) that could help other readers coming here

enter image description here

1
  • Attention: Do not just look at the pseudo-length image from the documentation, but read the descriptions of the pseudo-lengths carefully. Some of them are set to special values by default, eg. 0pt. Then the class calculates the length of the positions of the letter elements when "opening". The rules for the calculations are described in the documentation. – esdd Apr 11 '19 at 11:50
1

Because I do not know the rules for french letters (is'nt there a *.lco file for french speaking swiss, simular to letters in france?) I let it to you to work it out precisley.

In your case you need to define a new firsthead like:

\setkomavar{firsthead}{%
  \begin{tabular}[t]{l@{}}%
    \usekomavar{fromname}\\
    \usekomavar*{fromphone}\usekomavar{fromphone}\\
    \usekomavar*{fromemail}\usekomavar{fromemail}
  \end{tabular}
  \hfill
  \normalsize
  Angers, le \today % <=================================================
} 

Please see I added the place and date directly in the code above (marking <======). To get no place and date printed in the refline you need to use the following two lines:

%\setkomavar{place}{Angers} 
\date{}

Please see the following complete code

\documentclass[%
  paper=a4,
  fontsize=11pt,
  french,
]{scrlttr2}

\usepackage{palatino} 
\usepackage[T1]{fontenc} 
\usepackage{ucs} 
\usepackage[utf8]{inputenc} 
\usepackage{babel}
\usepackage{eurosym} 

\usepackage{geometry} 
\usepackage{graphicx} 

\usepackage{setspace} 
\usepackage{lipsum}

\geometry{verbose,a4paper,lmargin=3cm,rmargin=3cm}

\setlength\parskip{\medskipamount} 
\setlength\parindent{0pt}

\setstretch{1.15}
\LoadLetterOption{NF}%

\KOMAoptions{% 
   fromalign=left% alignment of the address
  ,fromphone=true% print sender phone number
  ,fromemail=true% print sender e-mail address
  ,fromlogo=true% print a logo (position depends on fromalign) 
}

%\setkomavar{date}{le \today}
\setkomafont{backaddress}{\rmfamily} 
\setkomafont{fromaddress}{\small} 
\setkomafont{fromname}{\scshape} 
\setkomavar{backaddressseparator}{ $\cdot$ } 
\setkomavar{backaddress}{}

\setkomavar{emailseparator}{~:~} 
\setkomavar{enclseparator}{ > } 
\setkomavar{fromaddress}{7-13 rue dejourney\ 49000 ANGERS} 
\setkomavar{fromemail}{gigiair@gigiair.fr} 
\setkomavar{fromname}{Gigiair} 
\setkomavar{fromphone}{0123 456 789} 
\setkomavar{phoneseparator}{~:~} 
%\setkomavar{place}{Angers} % <=========================================
\date{} % <============================================================
\setkomavar{signature}{\qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \quad \quad \includegraphics[width=2.5cm]{example-image}} 
\setkomavar{subjectseparator}{ >>> } 
\setkomavar{subject}{Modèle}

\setkomavar{firsthead}{% <==============================================
  \begin{tabular}[t]{l@{}}%
    \usekomavar{fromname}\\
    \usekomavar*{fromphone}\usekomavar{fromphone}\\
    \usekomavar*{fromemail}\usekomavar{fromemail}
  \end{tabular}
  \hfill
  \normalsize
  Angers, le \today % <=================================================
}

\LoadLetterOption{visualize} % <========================================
\showfields{head,address,location,refline,foot} % <=====================


\begin{document}

\begin{letter}{`A Madame la centurion\ Camps de Babaurum\ Bretagne conquise} 
\def\concname{Objet :~}
\opening{Madame la centurion,} 
C'est une invitation pour manger du sanglier roti. 
\closing{à la tienne !}
\cc{Panoramix et Obleix} 
\end{letter} 
\end{document}

and its result:

result

Please see that the call of \LoadLetterOption{visualize} activates the tool of scrarttl2 to visualize special fields, named in \showfields{head,address,location,refline,foot}.

If that is a real standard format for french letters, please contact the maintainer of KOMA-Script at https://komascript.de/ (you can write in english) and ask for a feature request to realize this french letter format via pur lco file ...

2
  • Another thing. I like your answer but I find strange the way you place the signature with \quad .... What If I want the signature aligned with the receiver adresse ? I need a way to find my way in the koma official doc. – Malik Koné Apr 8 '19 at 11:38
  • 1
    @MalikKoné well, I simply took your used signature with \quad. You can change the used indent for the signatur for example with \setplength{sigindent}{\paperwidth+\useplength{toaddrhpos}-\useplength{toaddrwidth}-\useplength{toaddrindent}-\useplength{toaddrindent}-\useplength{refhpos}}. The negative value of toaddrhpos means that it counts from the right pager side, not the left as shown in the picture in documentation ... – Mensch Apr 9 '19 at 4:25
2

With the suggestion below you can still use \setkomavar{date}{...} and \setkomavar{place}{...} and you can enable/disable the usage of fromphone and fromemail using options fromphone and fromemail, respectivly. If variable place is empty, the place seperator will be removed.

Note, that the contents of variable firsthead overwrittes both option fromalign and fromlogo. To remove the back address you can set option backaddress=false. Do not change \parskip manually, use option parskip instead.

\documentclass[a4paper,11pt,french]{scrlttr2}

\usepackage{palatino} 
\usepackage[T1]{fontenc}
\usepackage{babel}
%\usepackage[utf8]{inputenc}% not needed with an uptodate TeX Distribution
\usepackage{eurosym} 
\usepackage{geometry} 
\usepackage{graphicx} 
\geometry{verbose,a4paper,lmargin=3cm,rmargin=3cm}

\KOMAoptions{parskip=half-}%<- do not set \parskip manually

\usepackage{setspace}
\setstretch{1.15}

\usepackage{url}% <- added

\LoadLetterOption{NF}%

\KOMAoptions{%
  %fromalign=center% <- no effect because of \setkomavar{firsthead}{...}
  ,fromphone=true
  ,fromemail=true
  %,fromlogo=true% <- no effect because of \setkomavar{firsthead}{...}
  ,backaddress=false% <- remove backaddress
  ,refline=nodate% <- remove date from the refline
  ,subject=titled% <- use a title for the subject
}

\renewcaptionname{french}{\subjectname}{Objet}% like your lettre version
\addtokomafont{subject}{\normalfont}% <- like your lettre version

\renewcaptionname{french}{\ccname}{C.c.}% like your lettre version
\setkomavar{ccseparator}{}
\setkomavar*{ccseparator}{\llap{\ccname\quad}}% like your lettre version

\setkomavar{placeseparator}{, le }

\setkomafont{fromname}{\scshape}
\setkomafont{fromaddress}{\small}

\setkomavar{emailseparator}[E-Mail]{~:~}% <- like your lettre version
\setkomavar{enclseparator}{ > }
\setkomavar{fromaddress}{7-13 rue dejourney\\  49000 ANGERS}
\setkomavar{fromemail}{\url{gigiair@gigiair.fr}}% <- like your lettre version
\setkomavar{fromname}{Gigiair}
\setkomavar{fromphone}{0123 456 789}
\setkomavar{phoneseparator}[Tél]{.~}% <- like your lettre version
\setkomavar{place}{Angers}
\setkomavar{signature}{\hspace{26em}\includegraphics[width=2.5cm]{example-image}}% <- changed
\setkomavar{subjectseparator}{~:~}% <- like your lettre version
\setkomavar{subject}{Modèle}

\makeatletter
\setkomavar{firsthead}{{%
  \usekomafont{fromaddress}%
  \parbox[b]{\useplength{firstheadwidth}}{%
    {\usekomafont{fromname}\usekomavar{fromname}}
    \hfill{\usekomafont{placeanddate}%
      \ifkomavarempty{place}{}{\usekomavar{place}\usekomavar{placeseparator}}%
      \usekomavar{date}%
    }%
    \\\usekomavar{fromaddress}%
    \medskip% similar to the lettre version
    \if@phone\\\usekomavar*{fromphone}\usekomavar{fromphone}\fi
    \if@mobilephone\\\usekomavar*{frommobilephone}\usekomavar{frommobilephone}\fi%
    \if@fax\\\usekomavar*{fromfax}\usekomavar{fromfax}\fi
    \if@email\\\usekomavar*{fromemail}\usekomavar{fromemail}\fi
    \if@www\\\usekomavar*{fromurl}\usekomavar{fromurl}\fi
  }}%
}
\makeatother

\begin{document}

\begin{letter}{\`A Madame la centurion\\
    Camps de Babaurum\\
    Bretagne conquise}
\def\concname{Objet :~} 

  \opening{Madame la centurion,}
  C'est une invitation pour manger du sanglier roti.
  \closing{à la tienne !}

  \cc{Panoramix et Obleix}
\end{letter}
\end{document}

Result:

screenshot

4
  • Thank you esdd, but how do you know about all these options ? And is there no specific zone for the signature ? using a hspace{26em} does not seem best practice. Idealy the signature should be aligned with the receiver adress – Malik Koné Apr 8 '19 at 11:42
  • I think page 193 of the web.mit.edu/texsrc/source/latex/koma-script/scrguien.pdf (closing section) will be usefull. It mention sigindent and sigindent to position the signature – Malik Koné Apr 8 '19 at 12:10
  • 1
    The \hspace{26em} is only a short version of all the \qquad and \quad in your signature variable. I did not thought about it, because you did not ask for the alignment of the signature. – esdd Apr 9 '19 at 6:49
  • If you want to align the signature and the addresse use the answer by @Schweinebacke to your follow-up question. – esdd Apr 9 '19 at 18:13

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.