11

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)
scrlfile.sty    2012/06/15 v3.12 KOMA-Script package (loading files)
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.

Schweinebacke
  • 26,336
Stephen Bosch
  • 2,427
  • 4
  • 23
  • 32
  • 3
    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....... – abdulhaq-e Mar 17 '13 at 18:37
  • 1
    Does option pagesize work? This should be enough to write the page size into the pdf. – Josef Mar 17 '13 at 19:14
  • 2
    @AbdulhaqElhouderi Just remember that KOMA-Script has a German author. And for German babel is necceccary ... – Mensch Mar 17 '13 at 19:15
  • @Josef Either you have misunderstood the option pagesize or your comment is misinterpretative … This option is for choosing the output driver, more see in documentation. – Speravir Mar 17 '13 at 22:40
  • I have been unable to find anything in the koma-script documentation that says that babel is a required package (in one place it is even implied that it as optional: "This is particularly recommended when the babel package (see [Bra01]) is used, or language-dependent variables of scrlttr2 are to be changed."). I think the problem has to do with scrlttr2, and not koma-script specifically. – Stephen Bosch Mar 18 '13 at 00:00
  • 2
    @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
  • DIN.lco forces page size A4 with \LetterOptionNeedsPapersize{DIN}{a4}, which is not a surprise. DIN.lco provides the design of a german business letter defined by DIN. I have not checked the norm, but i guess DIN forces A4. No surprise again for the 'inventor' of the A,B,C paper series. – Josef Mar 18 '13 at 11:00
  • @Josef: that DIN.lco forces A4 makes total sense, as DIN 676 and DIN 5008 assume A4. The problem is that UScommercial9.lco specifically asks for a 'paper=letter' which, when provided, is ignored. This behaviour is different from that of scrartcl, to name just one example. – Stephen Bosch Mar 18 '13 at 17:56
  • @Josef I stand corrected. I just noticed that my working example using scrartcl does indeed contain the global option 'pagesize'. There is a section '2.7 Paper Format Selection' in the koma-script docs: "With option pagesize you may select an output driver for writing the paper size into the destination document. Supported output drivers are listed at table 2.6. The default is pagesize=false. Usage of option pagesize without value is same like pagesize=auto... It is recommended always to specify this option. Generally the method without output driver, or with auto or automedia, is useful." – Stephen Bosch Mar 18 '13 at 18:05
  • @Josef Thanks for clarification. I disagree a bit with you, but it may be a lack of my (our?) English knowlegde and of the documentation. And yes, I know writing pagesize means pagesize=auto. – Speravir Mar 18 '13 at 22:28
  • 2
    @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
  • @Josef: Yes, see “lack of my … English knowledge”. I meant lack of writing this in proper English. And then there is this description in scrguien.pdf: “With option pagesize you may select an output driver for writing the paper size into the destination document.” This I was referring in my first reply to you. – Speravir Mar 18 '13 at 23:47
  • Note: Since KOMA-Script 3.17 option pagesize is default. With this using paper=letter is enough to get a PDF with letter page size. And if you use geometry (see answer) it is enough to use option paper=letter before loading geometry or to load geometry with option letterpaper. So the problem should be obsolete. – Schweinebacke Jun 21 '17 at 06:45

1 Answers1

10

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}

Update 2: Since KOMA-Script 3.17 option pagesize is default. So you don't need to set it explicitly or to load geometry (Comment of @Schweinebacke).

Mensch
  • 65,388
  • 1
    It works fine with XeTeX as well. – abdulhaq-e Mar 17 '13 at 18:39
  • 1
    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 00:05
  • 5
    @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
  • 2
    @StephenBosch I didn't know option pagesize. I tested it and it works. I added the changed parts of my MWE to my answer ... – Mensch Mar 18 '13 at 21:44