I'm using the typearea
package of KOMA-Script to generate portrait and landscape pages within a single PDF document - see Option 2 here.
However, the geometry setting are only respected for portrait, but not for landscape pages. Any ideas how:
1. use the geometry settings from my header?
or
2. set the geometry for the landscape pages within the KOMA-command?
---
title: "Portrait and Landscape"
format:
pdf:
geometry:
- top=80mm
- bottom=30mm
- left=30mm
- right=30mm
include-in-header:
text: |
\usepackage{typearea}
---
# Quarto
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.
\newpage
<!-- changing the orientation to landscape --------------------------------- -->
\KOMAoptions{paper=landscape,pagesize}
\recalctypearea
# Running Code (Landscape)
When you click the **Render** button a document will be generated that includes both content and the output of embedded code. You can embed code like this:
You can add options to executable code like this
The `echo: false` option disables the printing of code (only output is displayed).
\newpage
<!-- % changing the orientation to portrait again -------------------------- -->
\KOMAoptions{paper=portrait,pagesize}
\recalctypearea
# Quarto (Portrait)
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.
usegeometry
option can be helpful in this case. From the manual chapter 20, P. 471,
Usually
typearea
does not care much if you use it with the geometry package in any configuration. In particular, this means that geometry does not recognise any changes to the page parameters done withtypearea
, for example when it changes the paper size — a feature not provided by geometry itself.
Once you set the option
usegeometry
,typearea
tries to translate all of its options into options ofgeometry
. If you activate new parameters inside the document,typearea
even calls\newgeometry
. Sincegeometry
does not support changes of paper size or page orientation with\newgeometry
,typearea
uses internal commands and geometry lengths to provide such changes as needed.
---
title: "Portrait and Landscape"
format:
pdf:
geometry:
- showframe
- top=80mm
- bottom=20mm
- left=30mm
- right=30mm
include-in-header:
text: |
\usepackage{typearea}
---
# Quarto
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.
\newpage
<!-- changing the orientation to landscape --------------------------------- -->
\KOMAoptions{usegeometry, paper=landscape,pagesize}
\recalctypearea
\newgeometry{right=80mm,left=20mm,top=30mm,bottom=30mm}
# Running Code (Landscape)
When you click the **Render** button a document will be generated that includes both content and the output of embedded code. You can embed code like this:
You can add options to executable code like this
The `echo: false` option disables the printing of code (only output is displayed).
\newpage
<!-- % changing the orientation to portrait again -------------------------- -->
\KOMAoptions{paper=portrait,pagesize}
\recalctypearea
\newgeometry{top=80mm,bottom=20mm,left=30mm,right=30mm}
# Quarto (Portrait)
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.
Also, refer to this excellent answer from TeXStackExchange which demonstrates ways to do this with and without geometry
package.
Note: I have use geometry package option showframe
just to show the margins