# How can I get US letter output from KOMA-script's scrlttr2 class?

I use KOMA-script for most everything, including correspondence. This is painless when I am using A4 paper, but when I try to use US letter, the problems start.

With the scrartcl class, \KOMAOptions{paper=letter} does the trick.

With the scrlttr2 class:

If the default class option file is used (DIN.lco, I believe), then \KOMAOptions{paper=letter} has no effect. The document compiles with this warning:

Class scrlttr2 Warning: Letter option file DIN.lco'
(scrlttr2) needs paper size a4'.
(scrlttr2) Current paper size is not a4'!
(scrlttr2) You should add paper=a4' at the
(scrlttr2) option list of \documentclass!
(scrlttr2) Maybe you know what you are doing,
(scrlttr2) so I do not change this myself.


and the output is A4.

If I use UScommercial9.lco without paper=letter, it compiles with this warning:

Class scrlttr2 Warning: Letter option file UScommercial9.lco'
(scrlttr2)              needs paper size letter'.
(scrlttr2)              Current paper size is not letter'!
(scrlttr2)              You should add paper=letter' at the
(scrlttr2)              option list of \documentclass!
(scrlttr2)              Maybe you know what you are doing,
(scrlttr2)              so I do not change this myself.


If I use the UScommercial9.lco, as in this MWE:

\documentclass[UScommercial9]{scrlttr2}
\usepackage[english]{babel}

\listfiles

\KOMAoptions{paper=letter,fromphone=true,fromfax=false}

\begin{document}

\setkomavar{fromname}{Stephen Bosch}
\setkomavar{fromaddress}{10 Lemon Lane \\ Sour Orchards BC V0E 0B0}
\setkomavar{fromphone}{+1 250 377 4141}

\begin{letter}{Tremulor Nocharme \\ Compliance Officer \\ Special TPS Police
\\ Fram Jammer Building \\ 320, 220 -- 4 Street \\ Treacleton AB T0M 0M0}

\setkomavar{subject}{Late TPS reports 2008, 2009, 2010, 2011, 2012}

\opening{Dear Mr. Nocharme,}

Attached please find the TPS reports you requested. Please accept my apologies for the delay.\\

\closing{Sincerely,}

\end{letter}

\end{document}


I no longer receive the warning, but the output is still A4.

In addition, when I try to simplify my MWE further by removing the

\usepackage[english]{babel}


line, I get a series of very strange errors:

! Undefined control sequence.
\select@language ... \@empty }\languageshorthands
{none}\babel@beginsave \cs...
l.8 \begin{document}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\select@language ...me \relax \babel@savevariable
\lefthyphenmin \babel@save...
l.8 \begin{document}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\select@language ...hyphenmin \babel@savevariable
\righthyphenmin \expandaft...
l.8 \begin{document}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

Class scrlttr2 Info: used language is english'.
(scrlttr2)           Supported languages are english', UKenglish',
(scrlttr2)           british', american', USenglish',
(scrlttr2)           german', ngerman', austrian', naustrian',
(scrlttr2)           dutch', italian', spanish',
(scrlttr2)           croatian', finnish', norsk' on input line 8.


Note: I get this error even though I have deleted all the output files (including aux)! To my knowledge, koma-script and DIN.lco do not require babel, and yet the error messages suggest that there are babel leftovers somewhere. If so, I know not where, because I have deleted everything that I can see prior to compiling. I have read this post and this post already.

The files used (from \listfiles) are:

 *File List*
scrlttr2.cls    2012/07/29 v3.11b KOMA-Script document class (letter)
scrkbase.sty    2012/07/29 v3.11b KOMA-Script package (KOMA-Script-dependent ba
sics and keyval usage)
scrbase.sty    2012/07/29 v3.11b KOMA-Script package (KOMA-Script-independent
basics and keyval usage)
keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
scrsize12pt.clo    2012/07/29 v3.11b KOMA-Script font size class option (12pt)
typearea.sty    2012/07/29 v3.11b KOMA-Script package (type area)
DIN.lco    2012/07/29 v3.11b KOMA-Script letter-class-option
UScommercial9.lco
***********


In case it is relevant, I am using XeTeX when compiling.

-
As for the second error, if you look at the examples given in the KOMA script documentation, all the scrlttr2 examples had a \usepackage[language]{babel}, apparently it's required although I couldn't find a direct statement saying so. It makes since though why it is needed. I get a more sensible error message: ! Package babel Error: You haven't loaded the option english yet....... – pythonista Mar 17 '13 at 18:37
Does option pagesize work? This should be enough to write the page size into the pdf. – Josef Mar 17 '13 at 19:14
@AbdulhaqElhouderi Just remember that KOMA-Script has a German author. And for German babel is necceccary ... – Kurt Mar 17 '13 at 19:15
@Speravir No, the option pagesize is not for choosing the output driver. It writes the specified page size into the output file. Otherwise the distribution's page size default is used. If i add pagesize to Stephen'S MWE as global option i get a PDF in letter size. Without pagesize i get A4. You can add something like pagesize=pdftex, but in general koma script is clever enough to detect the output driver itself. – Josef Mar 18 '13 at 10:27
@Speravir pagesize needs to know the output driver because the code to specify the page size is depending on the output driver. pdftex for example offers the primitives \pdfpagewidth and \pdfpageheight. In case of dvips the page size is written in so called special into the dvi, which is read by dvips, which then writes the page size into the postscript file. So, pagesize is really not for specifying the output driver in general. It's just a indicator for pagesize, which commands should be used. And in general even this is not necessary, as the koma classes can detect themselves. – Josef Mar 18 '13 at 23:22

Please try the following MWE (I have changed your MWE a little bit). It should do what you want:

\documentclass[UScommercial9,paper=letter]{scrlttr2} % <==== changed
\usepackage[english]{babel}
\usepackage[pass]{geometry}                          % <==== changed

\KOMAoptions{fromphone=true,fromfax=false}           % <==== changed

\begin{document}

\setkomavar{fromname}{Stephen Bosch}
\setkomavar{fromaddress}{10 Lemon Lane \\ Sour Orchards BC V0E 0B0}
\setkomavar{fromphone}{+1 250 377 4141}

\begin{letter}{Tremulor Nocharme \\ Compliance Officer \\ Special TPS Police
\\ Fram Jammer Building \\ 320, 220 -- 4 Street \\ Treacleton AB T0M 0M0}

\setkomavar{subject}{Late TPS reports 2008, 2009, 2010, 2011, 2012}

\opening{Dear Mr. Nocharme,}

Attached please find the TPS reports you requested. Please accept my apologies for the delay.\
\closing{Sincerely,}

\end{letter}

\end{document}


The trick is that your tex distribution has a standard paper size of A4. With the command \usepackage[pass]{geometry} you advice LaTeX to use the given paper size of the MWE. With pdfLaTeX and XeTeX it works.

Update: I didn't know KOMA-Script option pagesize (thanks @Josef) which also forces LaTeX to write a pdf file with the given paper size, here letter. So you can change my MWE to (only first changed lines):

\documentclass[%
paper=letter  % paper size
,pagesize      % force given paper size in pdf
,UScommercial9 % Beta version for testing
]{scrlttr2}
\usepackage[english]{babel}

\KOMAoptions{fromphone=true,fromfax=false}

-
It works fine with XeTeX as well. – pythonista Mar 17 '13 at 18:39
This worked with XeTeX, but I don't understand why geometry should be necessary at all. First, 'paper=<paper_size>' is a KOMA option that is designed for exactly this purpose, and in fact if I use UScommercial9.lco without providing paper=letter as a KOMAOption, I get an error message saying scrlttr2 is expecting 'paper=letter'! Second, 'paper=<paper_size>' works exactly as expected with scrartcl. – Stephen Bosch Mar 18 '13 at 0:05
@StephenBosch The problem is that every installed tex distribution uses a defined paper size (you have to answer a question about this while installing). I suppose you have a4 defined. Now you have to pass letter to LaTeX (like I insist in having letter paper) to get a pdf file with letter format. The call of package geometry with the option pass does exactly this. BTW: KOMA-Script has changed in the last time, are you sure you have the current version? Who gave the error message with paper=letter? Can you add the complette message into your question? – Kurt Mar 18 '13 at 0:46
@StephenBosch You just have to add the global option pagesize, see my comment. Then the specified page size is written to the output file, instead of the distribution's default. – Josef Mar 18 '13 at 10:30
@StephenBosch I didn't know option pagesize`. I tested it and it works. I added the changed parts of my MWE to my answer ... – Kurt Mar 18 '13 at 21:44