0. The hack
The hack that (for the time being) may solve your problem, is using \linebreak
instead of \\
.
\documentclass{scrlttr2}
\begin{document}
\setkomavar{fromname}{Company Name\linebreak\ John Public} % \_ before name typeset
% the `back address`
% correctly.
\begin{letter}{empfaenger}
\opening{Hallo}
text
\closing{schluss}
\end{letter}
\end{document}
(Works for me; your mileage may vary!)
1. Company name in signature
To add the company name in the signature, you may try to redefine the KOMA-variable signature
. Here is how I have set up my system:
In a general company .LCO
\newkomavar{companyname}
\setkomavar{companyname}{Incognito Ltd}
\setkomavar{fromname}{Nomen Nescio}
\setkomavar{signature}{\usekomavar{fromname}\\%
\footnotesize{\chairPerson}}
\providecaptionname{UKenglish}{\salutation}{Yours sincerely\linebreak\ Company Ltd.}
\providecaptionname{norsk}{\salutation}{Med vennlig hilsen\linebreak\ Company Ltd.}
In my personal .LCO
\setkomavar{fromname}{My Name}
\providecaptionname{UKenglish}{\chairPerson}{General Counsel/attorney at law \textsc{mna}}
\providecaptionname{norsk}{\chairPerson}{juridisk direkt\o r/advokat \textsc{mna}}
Using \closing
gives me the desired output. I load the company .LCO and my personal .LCO in a template .tex-file. \providecaptionname
gives you the possibility to use babel
and multiple language. I use \linebreak\
instead of \\
, and
\renewcommand{\raggedsignature}{\raggedright}
2. Company name in back address
To have company name in back address line (see manual page 160 ff.):
\newkomavar{companyname}
\setkomavar{companyname}{Incognito Ltd}
\setkomavar{backaddress}{%
\usekomavar{companyname}\\%
\usekomavar{fromname}\\%
\usekomavar{fromaddress}% % remember to define this
}
\setkomavar{backaddressseparator}{$\cdot$} % or a comma
3. Company name in first page header
You have to redefine firsthead
to achieve this:
\setkomavar{firsthead}{%
\centering\usekomavar{companyname}\\%
\usekomavar{fromname}\\%
\rule{12em}{0.75pt}\\%
\usekomavar{fromaddress}%
}
AFAIK there is no way to add this information at the top of the default first head
. Using the option fromalign=Center
and the variable firsthead
you can define your own header.
Maybe you are looking for something like that
\setkomavar{firsthead}{%
\parbox{\linewidth}{\centering
\textbf{ex.tex}c1cf35eef2c30d69fd2c41171434f4f1acd32c0d 2015-03-15 20:17 +0530\\
\usekomavar{fromname}\\
\usekomavar{fromaddress}\\
\usekomavar*{fromphone}\usekomavar{fromphone}\\
\usekomavar*{fromemail}\usekomavar{fromemail}
}%
}
There is no relative space between firsthead
and toaddress
. The vertical position of toaddress
is determined by the pseudolength toaddrvpos
absolutely. But there should be a minimum distance, so you get a warning that your first head is too high. That means the first head is too close to the address field.
The space for the first head can be enlarged using
\makeatletter
% enlarge the first head by 5pt to avoid the warning
\@addtoplength[-]{firstheadvpos}{5pt}
\makeatother
Then -5pt
will be added to the pseudolength firstheadvpos
So the distance between the upper edge of the paper and the upper edge of the first head is decreased by 5pt. That means the margin above of the first head gets 5pt smaller.
Another possibility is adding 5pt
to toaddrvpos
by
\makeatletter
% enlarge the first head by 5pt to avoid the warning
\@addtoplength{toaddrvpos}{5pt}
\makeatother
So the address field moves 5pt down and is no longer at the best place for a german window envelope.
The pseudolengths and the related commands are explained in the KOMA-Script documentation, chapter »Additional Information about the Letter Class scrlttr2 and the Letter Package scrletter«. There is also a figure showing the pseudolengths.
Code:
\documentclass[12pt,foldmarks=true,foldmarks=blmtP,fromalign=center,
fromphone,fromemail,version=last, backaddress=false,
subject=titled% <- added
]{scrlttr2}
\usepackage{fouriernc}
\setkomavar{fromname}{Someone Else}
\setkomavar{fromaddress}{Some Other Bldg.\\ Some Road\\ Some City}
\setkomavar{fromphone}{22019466}
\setkomavar{fromemail}{faheem@faheem.info}
\setkomavar{subject}{Some subject}% <-added
\setkomavar{firsthead}{%
\parbox{\linewidth}{\centering
\textbf{ex.tex}c1cf35eef2c30d69fd2c41171434f4f1acd32c0d 2015-03-15 20:17 +0530\\
\usekomavar{fromname}\\
\usekomavar{fromaddress}\\
\usekomavar*{phoneseparator}\usekomavar{phoneseparator}\usekomavar{fromphone}\\
\usekomavar*{emailseparator}\usekomavar{emailseparator}\usekomavar{fromemail}
}%
}
\makeatletter
% enlarge the first head by 5pt to avoid the warning
\@addtoplength[-]{firstheadvpos}{5pt}
\makeatother
\def\today{13th March, 2015}
\begin{document}
\begin{letter}{Someone\\ Some Org\\ Some Place\\ Some Road\\ Some City}
\opening{Someone,}
\closing{Yours Sincerely,}
\end{letter}
\end{document}
Of course you can customize the firsthead
and firstfoot
. As an example
\makeatletter
\@addtoplength{firstheadvpos}{5pt}
\makeatother
\setkomavar{firsthead}{%
\begin{tabular}[b]{l@{}}%
\usekomavar{fromname}\\
\usekomavar*{fromphone}\usekomavar{fromphone}\\
\usekomavar*{fromemail}\usekomavar{fromemail}
\end{tabular}
\hfill
\normalsize
\begin{tabular}[b]{r@{}}%
\usekomavar{fromaddress}
\end{tabular}\\
\rule[2mm]{\textwidth}{0.5pt}%
}
\setkomavar{firstfoot}{%
\parbox{\linewidth}{\centering\textbf{ex.tex}
c1cf35eef2c30d69fd2c41171434f4f1acd32c0d 2015-03-15 20:17 +0530}\\[.5\baselineskip]
}
But may be you only want to add the information above the first head without changing the letter layout. Then you can load the package scrlayer
and add a layer to the pagestyle empty
\usepackage{scrlayer}
\DeclareNewLayer[
background,head,align=b,voffset=\useplength{firstheadvpos},height=\baselineskip,
contents={\makebox[\layerwidth]{\textbf{ex.tex}
c1cf35eef2c30d69fd2c41171434f4f1acd32c0d 2015-03-15 20:17 +0530}}
]{versioncontrol.head}
\AddLayersToPageStyle{empty}{versioncontrol.head}
Code:
\documentclass[12pt,foldmarks=true,foldmarks=blmtP,fromalign=center,
fromphone,fromemail,version=last, backaddress=false,
subject=titled,% <- added
]{scrlttr2}
\usepackage{fouriernc}
\setkomavar{fromname}{Someone Else}
\setkomavar{fromaddress}{Some Other Bldg.\\ Some Road\\ Some City}
\setkomavar{fromphone}{22019466}
\setkomavar{fromemail}{faheem@faheem.info}
\setkomavar{subject}{Some subject}% <-added
\usepackage{scrlayer}
\DeclareNewLayer[
background,head,align=b,voffset=\useplength{firstheadvpos},height=\baselineskip,
contents={\makebox[\layerwidth]{\textbf{ex.tex}
c1cf35eef2c30d69fd2c41171434f4f1acd32c0d 2015-03-15 20:17 +0530}}
]{versioncontrol.head}
\AddLayersToPageStyle{empty}{versioncontrol.head}
\def\today{13th March, 2015}
\begin{document}
\begin{letter}{Someone\\ Some Org\\ Some Place\\ Some Road\\ Some City}
\opening{Someone,}
\closing{Yours Sincerely,}
\end{letter}
\end{document}
Best Answer
It is not possible to use the
fromrule
option together withfirsthead
. But here is an suggestion how you can get the same line as in your MWE: