This seems like a bug to me, involving a conflict between the storeareas
command and the KOMAoptions
. Here are a few workarounds.
I have simplified the example a little. The one change I have made is to add a clearpage
after each page. Otherwise, in some cases the wrong page is affected or pages are joined together.
You can get it to work by using a second storeareas
command:
\documentclass[pagesize,paper=a4]{scrreprt}
\begin{document}
First page in portrait\\
\clearpage
\storeareas\myvalues
\KOMAoptions{pagesize,paper=landscape,DIV=20}
\storeareas\landscapevalues
Second page in landscape\\
\clearpage
\myvalues
Third page in portrait again\\
\clearpage
\landscapevalues
Fourth page IS in landscape!!!!\\
\end{document}
Or, you can scrap the storeareas
command altogether:
\documentclass[pagesize,paper=a4]{scrreprt}
\begin{document}
First page in portrait\\
\clearpage
\KOMAoptions{pagesize,paper=landscape,DIV=20}
Second page in landscape\\
\clearpage
\KOMAoptions{pagesize,paper=portrait,DIV=calc}
Third page in portrait again\\
\clearpage
\KOMAoptions{pagesize,paper=landscape,DIV=20}
Fourth page IS in landscape!!!!\\
\end{document}
The simplest change is hacky and shows how fragile things are. You can change the paper "back" to a4 right before the second landscape declaration. (It actually also works to simply change the second paper=landscape
to paper=a4
, but this seems even hackier.)
\documentclass[pagesize,paper=a4]{scrreprt}
\begin{document}
First page in portrait\\
\clearpage
\storeareas\myvalues
\KOMAoptions{pagesize,paper=landscape,DIV=20}
Second page in landscape\\
\clearpage
\myvalues
Third page in portrait again\\
\clearpage
\KOMAoptions{paper=a4}
\KOMAoptions{pagesize, paper=landscape,DIV=20}
Fourth page IS in landscape!!!!\\
\end{document}
Best Answer
Let our first step is to prepare such a book (
book.tex
).The fastest way is probably to use the
pdfpages
package, http://www.ctan.org/pkg/pdfpages, with an optionrotateoversize
switched to true. This is an example and its result.The only problem would be if we want to rotate (or ornament, typeset in, sign, watermark them etc.) landscape pages the other way around. This is an improved version. We are testing every single page if it was typeset in a portrait/landscape mode. We will discover that by measuring its page width and page height in a virtual box before typesetting.
The terminal is informing us about the findings.
I enclose an example and a preview of our efforts.