在创建单个四开 PDF 输出时,在横向页面上使用 `geometry`。

huangapple go评论60阅读模式
英文:

Use `geometry` on landscape pages when creating multiple page orientation in a single quarto PDF output

问题

我正在使用KOMA-Script的typearea包来在单个PDF文档中生成纵向和横向页面 - 请参见此处的选项2。然而,仅适用于纵向页面,而不适用于横向页面。有没有什么方法:

  1. 使用我的标题中的页面设置?

  1. 在KOMA命令中为横向页面设置页面设置?

标题: "纵向和横向"
格式:
pdf:
页面设置:
- 顶部=80mm
- 底部=30mm
- 左侧=30mm
- 右侧=30mm
包含在页眉中:
文本: |
\usepackage{typearea}

Quarto

Quarto允许您将内容和可执行代码编织到一个完整的文档中。要了解更多关于Quarto的信息,请访问<https://quarto.org>。

新页面

<!-- 将方向更改为横向 --------------------------------- -->

\KOMAoptions{纸张=横向,页面大小}
\recalctypearea

运行代码 (横向)

当您单击渲染按钮时,将生成包含内容和嵌入代码输出的文档。您可以像这样嵌入代码:

您可以像这样为可执行代码添加选项

echo: false选项禁用代码的打印(仅显示输出)。

新页面

<!-- 将方向再次更改为纵向 -------------------------- -->

\KOMAoptions{纸张=纵向,页面大小}
\recalctypearea

Quarto (纵向)

Quarto允许您将内容和可执行代码编织到一个完整的文档中。要了解更多关于Quarto的信息,请访问<https://quarto.org>。

英文:

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: &quot;Portrait and Landscape&quot;
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 &lt;https://quarto.org&gt;.

\newpage

&lt;!-- changing the orientation to landscape --------------------------------- --&gt;

\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

&lt;!-- % changing the orientation to portrait again -------------------------- --&gt;

\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 &lt;https://quarto.org&gt;.

答案1

得分: 3

"usegeometry" 选项在这种情况下可能会有所帮助。从手册第20章,第471页,

通常,typearea 不太关心您如何在任何配置中与 geometry 包一起使用它。特别是这意味着 geometry 不会识别使用 typearea 更改的页面参数,例如更改纸张大小,这是 geometry 本身不提供的功能。

一旦设置了 usegeometry 选项,typearea 尝试将其所有选项翻译成 geometry 的选项。如果您在文档内激活新的参数,typearea 甚至会调用 \newgeometry。由于 geometry 不支持使用 \newgeometry 更改纸张大小或页面方向,typearea 使用内部命令和 geometry 长度来提供所需的更改。

---
title: "纵向和横向"
format:
  pdf:
    geometry:
      - showframe
      - top=80mm
      - bottom=20mm
      - left=30mm
      - right=30mm
    include-in-header: 
      text: |
                \usepackage{typearea}
---

# 四开

四开使您能够将内容和可执行代码编织在一起,制作成成品文档。要了解更多关于四开的信息,请查看&lt;https://quarto.org&gt;。

\newpage

<!-- 将方向更改为横向 --------------------------------- -->
\KOMAoptions{usegeometry, paper=landscape, pagesize}
\recalctypearea
\newgeometry{right=80mm, left=20mm, top=30mm, bottom=30mm}

# 运行代码(横向)

当您单击“渲染”按钮时,将生成一个包含内容和嵌入式代码输出的文档。您可以像这样嵌入代码:

您可以像这样为可执行代码添加选项

`echo: false` 选项禁用了代码的打印(仅显示输出)。

\newpage

<!-- 将方向更改为纵向 --------------------------------- -->
\KOMAoptions{paper=portrait, pagesize}
\recalctypearea
newgeometry{top=80mm, bottom=20mm, left=30mm, right=30mm}

# 四开(纵向)

四开使您能够将内容和可执行代码编织在一起,制作成成品文档。要了解更多关于四开的信息,请查看&lt;https://quarto.org&gt;。
---

此外,还请参考TeXStackExchange的优秀回答,展示了如何在使用或不使用 geometry 包的情况下进行此操作。

注:我仅使用了 geometry 包选项 showframe 来显示边距。

在创建单个四开 PDF 输出时,在横向页面上使用 `geometry`。

英文:

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 with typearea, 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 of geometry. If you activate new parameters inside the document, typearea even calls \newgeometry. Since geometry 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: &quot;Portrait and Landscape&quot;
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 &lt;https://quarto.org&gt;.

\newpage

&lt;!-- changing the orientation to landscape --------------------------------- --&gt;

\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

&lt;!-- % changing the orientation to portrait again -------------------------- --&gt;

\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 &lt;https://quarto.org&gt;.

<hr>

Also, refer to this excellent answer from TeXStackExchange which demonstrates ways to do this with and without geometry package.

<hr>

Note: I have use geometry package option showframe just to show the margins

在创建单个四开 PDF 输出时,在横向页面上使用 `geometry`。

huangapple
  • 本文由 发表于 2023年2月14日 21:33:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/75448582.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定