4

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}{[email protected]}
\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}
3
  • \setkomavar{signature}{Company Name\\john Public}
    – Johannes_B
    Feb 19, 2015 at 14:38
  • You can keep the name that makes trouble now (including the company name) and just add the above comment later. Seems to be a bug.
    – Johannes_B
    Feb 19, 2015 at 15:05
  • I found a new solution using \linebreak.
    – Sveinung
    Feb 28, 2015 at 22:19

1 Answer 1

5

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}%
  }
12
  • Very nice. Thanks also for explaining the possibility to use the same setup for different languages. However, your solution only adds the company name to the closing (which includes the signature variable). I would like the company name to also be in the return and back address displayed in the upper part of the letter. I edited the question title accordingly.
    – Jost
    Feb 19, 2015 at 14:56
  • See edit, and the manual page 160 ff.
    – Sveinung
    Feb 19, 2015 at 15:13
  • I have developed my .LCOs over several years, and they are messy. The main point is: Define variables with suitable names, and use those variables in the standard KOMA-variables (look at the illustration of a letterhead at page 158 in the manual). Variables in the KOMA-letter class are like LEGO bricks.
    – Sveinung
    Feb 19, 2015 at 15:19
  • 2
    Got a reply by the maintainer: Using \\ is fromname is undocumented. Dependent on where ariables are used, everything can happen. AFAIR, using \\ is only docuemented in fromaddress, toaddress and backaddress and not with the function of a line sep, but a field separator. \par Everybody in need of a company name, may define a new variable and also define its use, as is done for example in asymTypB.lco. komascript.de/node/1888#comment-4917
    – Johannes_B
    Feb 19, 2015 at 20:48
  • 1
    Defining a new variable, like you are showing in your answer are better, wouldn't even tell about \newline ;-) btw, tried \newline this afternoon. It messes other stuff up. So, not recommended :-p
    – Johannes_B
    Feb 19, 2015 at 21:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .