12

I need to put a subject line in a letter so after looking around most suggestions seem to point towards using the document class scrlttr2 instead of letter since it is much more flexible.

However, the look of the letter when I change to scrlttr2 becomes totally messed up from the simple letter format I prefer. More specifically:

  1. The from address is moved to the top left instead of the right over the date.
  2. OMR markers introduced on the left of the page.
  3. A separate underlined from address added on the top with a different font.
  4. The indentation and paragraphing is really ugly. It indents new paragraphs instead of putting whitespace. (While this is OK for a normal document, its totally ugly for a letter)
  5. While the normal letter style allowed me to leave the address of the recipient empty like this \begin{letter}{}, I am forced to put something in scrlttr2 even if I don't want to put anything. (If I leave it empty or just put a space it gives a very cryptic error Line 0: There's no line end here even if its not on line 0.)

Is there anyway I can make it look like the letterstyle? I am just going through this to add a subject line, so if there's a simpler way it would be equally good.

UPDATE

The output from scrlttr2 when I use \KOMAoptions{foldmarks=off,backaddress=false,fromalign=right} is now as follows:

enter image description here

This is because it is inserted in the page header rather than the page content. I need it to look at least as it is generated by letter as follows:

enter image description here

The best thing would be if it is also right aligned, but if I manage to get it like letter it should be enough.

3
  • Not much of a solution to your real problem, but to leave the address blank, try giving it as ~ (unbreakable space) or \strut. The error is probably because there's a `\` in the expansion of the address, and it doesn't like empty lines.
    – alexis
    Commented Mar 22, 2013 at 12:29
  • Thanks, ~ works. The 'to' address is empty, there is no `\` or anything. It took me a while to discover that it was the problem because the error line number it was reporting was 0.
    – jbx
    Commented Mar 22, 2013 at 13:54
  • I meant, the class probably inserts a line break (\\, miscoded that before) when typesetting the address. Glad it worked.
    – alexis
    Commented Mar 22, 2013 at 14:02

2 Answers 2

3

Is there anyway I can make it look like the letterstyle? I am just going through this to add a subject line, so if there's a simpler way it would be equally good.

It sounds like what you really want is to be able to add a subject line to the standard letter class, and that you really do not want to use scrlttr2. If that is the case you can just modify the letter class \opening macro. I use the etoolbox \patchcmd, but I am sure there are other ways. The key part is

\makeatletter
  \newcommand{\subject}[1]{\def\@subject{#1}}
  \patchcmd{\opening}{#1\par\nobreak}{\ifundef{\@subject}{}{\textbf{\@subject}\par\vspace{2\parskip}}#1\par\nobreak}{}{}
\makeatother

You would then specify the subject with \subject, just like you specify \name. A full MWE is

\documentclass{letter}

\usepackage{etoolbox}
\makeatletter
\newcommand{\subject}[1]{\def\@subject{#1}}
\patchcmd{\opening}{#1\par\nobreak}{\ifundef{\@subject}{}{\@subject\par\vspace{2\parskip}}#1\par\nobreak}{}{}
\makeatother

\name{My name}
\signature{My signature}
\address{My road\\My city}
\location{My location}
\telephone{my telephone}

\subject{My subject}

\begin{document}
\begin{letter}{To name\\To road\\To city}
  \opening{Dear \toname}
  Hello World
\end{letter}
\end{document}
1
  • Thanks! That's what I was actually looking for! The hell with scrlttr2, its flexible but so difficult to get something simple like the sender address on top of the date, like normal letters! I modified your suggestion a little to make the subject bold as follows: \patchcmd{\opening}{#1\par\nobreak}{\ifundef{\@subject}{}{\textbf{\@subject}\par\vspace{2\parskip}}#1\par\nobreak}{}{}
    – jbx
    Commented Mar 23, 2013 at 12:26
15

The nice thing about scrlttr2 is that it's easily customizable.

  • The ORM markers you mentioned are probably the foldmarks, to be switched off using \KOMAoptions{foldmarks=off}
  • The From address can be put to the right, check the manual for "firsthead" and "nexthead". Or take the example I put online here as a starter: uweziegenhagen.de/?page_id=132, snippet 47 or snippet 40.
  • The small back adress over the to address can be switched off using \setkomavar{backaddress}{} The default setting is that it is composed from komavars such as fromaddress and fromname.

  • EDIT: To put the address to the right you can use a simple tabular in firsthead:

    \documentclass[12pt,english]{scrlttr2}
    
    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage[]{babel}
    
    \newkomavar{fromplace}
    \setkomavar{fromname}{Some other Dude}
    \setkomavar{fromaddress}{Fairytail-Lane 1}
    \setkomavar{fromplace}{12345 Cologne}
    
    
    \firsthead{%
    \begin{tabular}{p{0.7\textwidth}p{0.3\textwidth}}
    & \usekomavar{fromname} \newline \usekomavar{fromaddress}  \newline \usekomavar{fromplace} 
    \end{tabular}
    }
    
    \begin{document}
    
    \begin{letter}{Some Address \\ Far, far away}
    \opening{Hello Dude,}
    
    
    \closing{Best wishes,}
    \end{letter}
    
    \end{document}
    

example using tabular in firsthead

Give scrlttr2 a chance, I have been working with this magnificient class for proably a decade now and never stopped loving it!

Here's another approach based on your comments, I modified an existing letter template from my 'collection', so it does a few other tricks as well.

\documentclass[12pt,english]{scrlttr2}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[]{babel}

\date{} %we do that manually!

\newkomavar{fromplace} % a few koma vars
\setkomavar{fromname}{Some other Dude}
\setkomavar{fromaddress}{Fairytail-Lane 1}
\setkomavar{fromplace}{12345 Cologne}

\KOMAoptions{foldmarks=off,fromrule=false}
\setkomavar{backaddress}{}

\makeatletter % indention of the address fields
\@setplength{toaddrhpos}{27mm}
\@setplength{toaddrwidth}{92mm}
\@setplength{sigindent}{0mm}
\makeatother

\renewcommand*{\raggedsignature}{\raggedright}

% Define new letter header
\firsthead{
  \null\hfill
  \parbox[t][\headheight][t]{4cm}{%
  \vspace*{7cm}

\usekomavar{fromname} \newline 
\usekomavar{fromaddress}  \newline 
\usekomavar{fromplace} \vspace*{1cm}

    \today
      }
    }%


\begin{document}\raggedright

\begin{letter}{Some Address \\ Far, far away}
\opening{Hello Dude,}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus mollis, felis vel eleifend elementum, lectus eros faucibus nisl, pellentesque eleifend nunc nibh sit amet nisi. Vivamus dictum, eros eu tincidunt mollis, ante odio scelerisque leo, vel pharetra risus justo id nibh. Nam mollis elementum sem, vel porttitor erat fringilla vitae. Suspendisse potenti. Cras quis orci vel elit faucibus consectetur non ut felis. In lacinia dictum congue. Vivamus vel sapien nec velit pharetra semper non nec eros. Donec laoreet mi at odio molestie varius. Nullam et ornare velit. Ut laoreet pulvinar orci, ac lobortis nisi fermentum vel.


\closing{Best wishes,}
\end{letter}

\end{document}

another approach

10
  • Thanks, so got the foldmarks off, and the backaddress removed. I still haven't understood how the firsthead and nexthead work because your snippet 47 is a bit too complicated, no idea what all the stuff inside it means, and snippet 40 doesn't seem to be using it. Any idea how to fix the paragraph indents and spacing between them? Thanks a lot!
    – jbx
    Commented Mar 22, 2013 at 14:00
  • I noticed that \firsthead really puts the address at the header of the letter, not on top of the date on the right as I want it. I want it to be on the right on top of the date just like the letter class does it. Is there any other way to change it to be on the right?
    – jbx
    Commented Mar 22, 2013 at 14:09
  • OK, so actually scrlttr2 has an option parskip=full which does it automatically. The \closing indent can also be fixed with \renewcommand*{\raggedsignature}{\raggedright}. All's left is the from address on the right instead of the left.
    – jbx
    Commented Mar 22, 2013 at 14:29
  • Please put a picture online what you want to achieve. I'll look into it, shouldn't take long. Commented Mar 22, 2013 at 17:41
  • I added 2 pictures of how the fromaddress is being generated. One using scrlttr2 and one using letter. I want to achieve the one generated by letter and ideally even better if they are right aligned to the right margin.
    – jbx
    Commented Mar 22, 2013 at 21:50

You must log in to answer this question.

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