[Tex/LaTex] How to add company name to return/back address in scrlttr2

koma-scriptscrlttr2

I have taken the simple example from the KOMA script guide from page 166-167 (pdf). I now wish to introduce a company name in the line before (or after) my name. I would naively do so by changing

\setkomavar{fromname}{John Public}

to

\setkomavar{fromname}{Company Name\\John Public}

However, this breaks compilation. The error message is

! Undefined control sequence.
\@gnewline ...\@nolnerr \else \unskip \reserved@e 
                                                  {\reserved@f #1}\nobreak \...
l.24 \closing{Expecting an invitation}

Consequently, removing the \closing{} command correctly renders the document, but, obviously, without a closing. Note, that I am not actually concerned about the closing, I just want it to work as usual.

Questions:

  • How do I properly add a company name to the from variables, i.e., the return address?
  • What causes this weird error?

Full example:

\documentclass[foldmarks=true,foldmarks=blmtP,
fromalign=false,fromrule=afteraddress,
fromphone,fromemail,
version=last]{scrlttr2}
\usepackage[english]{babel}
\begin{document}
%\setkomavar{fromname}{John Public}
\setkomavar{fromname}{Company Name\\John Public}
\setkomavar{fromaddress}{Valley 2\\
54321 Public-Village}
\setkomavar{fromphone}{0\,12\,34~56\,78}
\setkomavar{fromemail}{Peter@Public.invalid}
\begin{letter}{%
Joana Public\\
Hillside 1\\
12345 Public-City%
}
\opening{Dear chairman,}
the last general meeting was about one year ago.
I want to remind you, that the constitution of our
club advises you to make a general meeting every
six month. Because of this I expect the executive
board to detain such a meeting immediately.
\closing{Expecting an invitation}
\ps PS: I hope you accept this as an friendly
demand note.
\setkomavar*{enclseparator}{Enclosure}
\encl{Compendium of the constitution with the
general meeting paragraphs.}
\cc{executive board\\all members}
\end{letter}
\end{document}

Best Answer

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}%
  }