3

I am trying to change pagesize using KOMA but not able to

\usepackage[paper=A4]{typearea}
\usepackage{pdfpages}
\usepackage{geometry}
\begin{document}

\KOMAoptions{paper=2.5in:6.0in,DIV=1}
\recalctypearea
"POTRAIT"

\KOMAoptions{paper=6in:2.5in,DIV=1}
\recalctypearea
"LANDSCAPE"

\end{document}

Using KOMA i am trying to setup two page sizes 2.5in:6.0in and 6in:2.5in.

But the output pdf shows two pages of size 2.5in:6.0in no 6in:2.5in.

enter image description here

SOLUTION1: WHICH I FOUND WORKING (ALSO I AM ADDING PAGENUMBER)

Note:

1) use \documentclass[version=3.21]{scrartcl}
2) mention page size as width:height
3) no need of landscape



\documentclass[version=3.21]{scrartcl}
% this is required for pagenumber and also KOMAoptions to work
\usepackage[automark,headsepline,footsepline]{scrlayer-scrpage}
% the above both are required to show page number 

\usepackage
  [showframe]% to show the page layout
  {geometry}

\begin{document}

\KOMAoptions{paper=2.5in:6.0in,DIV=calc}
 % widht:height
\recalctypearea
\newgeometry{layoutwidth = 2.5in,layoutheight = 6.0in,left=0mm,right=0mm,top=0mm,bottom=0mm,footskip=1mm}
"POTRAIT"

\KOMAoptions{paper=6in:2.5in,DIV=calc}
% here widht:height mention 6in:2.5in instead of 2.5:6in
\recalctypearea
\newgeometry{layoutwidth =6in,layoutheight = 2.5in,left=0mm,right=0mm,top=0mm,bottom=0mm,footskip=1mm}
"LANDSCAPE"

\end{document}

The output is (i also wanted to add the page number at the bottom. So newgeometry is used to reset the margins

enter image description here

SOLUTION2: WHICH I FOUND WORKING (ALSO I AM ADDING PAGENUMBER)

Here irrespective of widht:height it will show portrait. We have to specifically mention portrait or landscape. Recently i have made a spell mistake i was using potrait instead of portrait and i thought its not working.

\documentclass{scrartcl}
\usepackage{pdfpages}
\usepackage{geometry}
\usepackage[automark]{scrlayer-scrpage}
\begin{document}

    \KOMAoptions{paper=432pt:566.36717pt,paper=portrait}
    \recalctypearea
    \newgeometry{layoutwidth = 432pt,layoutheight = 566.36717pt,left=0mm,right=0mm,top=0mm, bottom=0mm,footskip=1mm}
    POTRAIT

    \KOMAoptions{paper=432pt:226.15027pt,paper=landscape}
    \recalctypearea
    \newgeometry{layoutwidth = 432pt,layoutheight = 226.15027pt,left=0mm,right=0mm,top=0mm, bottom=0mm,footskip=1mm}
    LANDSCAPE

    \KOMAoptions{paper=432pt:566.36717pt,paper=portrait}
    \recalctypearea
    \newgeometry{layoutwidth = 432pt,layoutheight = 566.36717pt,left=0mm,right=0mm,top=0mm, bottom=0mm,footskip=1mm}
    EXPECTING SAME POTRAIT

\end{document}

2 Answers 2

2

Unfortunately your example does not compile because you omitted to show the \documentclass declaration with options that you may have set for KOMAscript.

Note:

  • KOMAScript documentation says that an explicit loading of the typearea package is not necessary; it also notes that it is not advised, in general, to use typearea functionality together with the geometry package. If this is desired, however, there is the usegeometry=true option for the KOMAscript class declaration.
  • Why set paper=A4 at all, if you don't need it?
  • A DIV of 1 would result in a very "bad" dividing of the page; indeed, typearea warns about this very low DIV value.

A solution to your question that sets the portrait size first and then simply switches to landscape orientation could be:

\documentclass[pagesize, usegeometry=true]{scrartcl}

\usepackage{pdfpages}  %%although it is not needed for your example
\usepackage{geometry}
\begin{document}

\KOMAoptions{paper=2.5in:6.0in,DIV=1}
\recalctypearea
"PORTRAIT"

\KOMAoptions{paper=landscape}
\recalctypearea
"LANDSCAPE"

\end{document}
5
  • I have tried \KOMAoptions{paper=6in:2.5in,DIV=1} instead of \KOMAoptions{paper=landscape} . It again shows both the pages as 2.5in:6.0in. I just want to mention the paper size instead of landscape or portrait because i will have a pdf with variable page sizes
    – Santhosh
    Aug 4, 2020 at 6:33
  • 1
    The way I understand the KOMAscript documentation, the two sizes, e.g. 6in:2.5in will always be interpreted according to paper=landscape or paper=portrait, there seems no way around explicitly specifying the orientation when changing page sizes and orientation within a document. See page 49 in the English documentation: link Aug 4, 2020 at 8:43
  • Thank you for the clear understanding. I wanted to use it by pagesize. so \KOMAoptions{paper=6in:2.5in,DIV=1,paper=landscape} will also work then
    – Santhosh
    Aug 4, 2020 at 10:40
  • what is the difference between \documentclass[pagesize, usegeometry=true]{scrartcl} and just \documentclass{scrartcl}
    – Santhosh
    Aug 4, 2020 at 10:54
  • The ´pagesize` option ensures that settings for the page size are passed to the pdfTeX engine, see p. 50-51 in the english documentation. The usegeometry option improves the interaction between typearea options when the geometry package is loaded as well, see pp. 52 and 471 of the doc. IMO there may well be use cases where these options will not make a difference, whereas in other use cases they will. Aug 5, 2020 at 7:49
2

Regarding option paper there was a change in KOMA-Script version 3.22 (current version is 3.31). Your example would work if you add version=3.21 to the typearea options:

\documentclass{article}
\usepackage[paper=A4,
  version=3.21% <- added, but it is a really old version
]{typearea}
\usepackage{pdfpages}
\usepackage
  [showframe]% to show the page layout
  {geometry}
\begin{document}

\KOMAoptions{paper=2.5in:6.0in,DIV=calc}
%\KOMAoptions{paper=2.5in:6.0in,DIV=current}% maybe better
"POTRAIT"

\KOMAoptions{paper=6in:2.5in,DIV=calc}
"LANDSCAPE"

\end{document}

Note that Option DIV results in a recalculation of the typearea. So, if you use the DIV key after the paper key in the argument of \KOMAoptions, you can remove the additional \recalctypearea (does nearly the same as \KOMAoptions{DIV=last}).

Note that DIV=1 is a synonym for DIV=calc. But I think you do not want DIV=calc for the landscape page.

enter image description here

Maybe you want to use DIV=current for the landscape page?

enter image description here

Since version 3.22 it depends on the orientation (portrait or landscape) which value is taken as the height and which as the width. With paper = portrait, both paper=2.5in:6.0in and paper=6.0in:2.5in result in a page with a height of 6.0 inches and a width of 2.5 inches. If you want to switch to landscape, you have to use paper=landscape! But if the width and height are only exchanged, it is also enough to use paper=landscape followed by DIV=current or DIV=last:

\documentclass{article}
\usepackage[paper=A4]{typearea}
\usepackage{pdfpages}
\usepackage[%
  showframe% to show the page layout
]{geometry}

\begin{document}

\KOMAoptions{paper=2.5in:6.0in,DIV=calc}
"POTRAIT"

\KOMAoptions{paper=landscape,DIV=current}
"LANDSCAPE"

\end{document}
4
  • I need pdfpages for incluing some pdf. Also i want to use \documentclass{scrartcl}. Now your solution says Option clash for package typearea. How to resolve this
    – Santhosh
    Aug 4, 2020 at 6:43
  • In your original question there was no documentclass mentioned. The KOMA-Script class scrartcl loads package typearea automatically, so the options should be set as global options for the documentclass.
    – esdd
    Aug 5, 2020 at 21:29
  • How to set paper=A4 and version=3.21 as global options for while using \documentclass{scrartcl}
    – Santhosh
    Aug 6, 2020 at 14:40
  • 1
    \documentclass[paper=A4,version=3.21]{scrartcl}. But I would suggest to use the second suggestion (using an uptodate version) and set the paper orientation explicitly.
    – esdd
    Aug 20, 2020 at 12:56

You must log in to answer this question.

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