在单个四开 PDF 输出中创建多页面方向

Bra*_*tno 4 pdf latex landscape quarto

这个想法是复制rmarkdownin上的 PDF 输出quarto,在本例中,是在单个文档上创建多页方向。我可以通过使用这个技巧rmarkdown轻松做到这一点。但是,我无法在四开本中执行此操作,它会不断发送错误消息

compilation failed- error 
Undefined control sequence.
l.201 \blandscape
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

---
title: "Portrait and Landscape"
format:
  pdf:
    include-in-header:
      - packages.tex
---

# 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
\blandscape

# Running Code

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).

\elandscape

Run Code Online (Sandbox Code Playgroud)

有趣的是,我可以通过修改 YAML 并插入原始乳胶来开始和结束横向页面来创建多页面方向,但它会删除所有格式rmarkdown并将其转换为横向页面内的普通文本:

---
title: "Portrait and Landscape"
format: 
  pdf:
    include-in-header:
        text: |
           \usepackage{pdflscape}
---


\begin{landscape}

bla bla bla

\end{landscape}


Run Code Online (Sandbox Code Playgroud)

对于这个问题有什么解决办法吗?

PS:我的 header.tex 包含这个东西

\usepackage{pdflscape}
    \newcommand{\blandscape}{\begin{landscape}}
    \newcommand{\elandscape}{\end{landscape}}
Run Code Online (Sandbox Code Playgroud)

sha*_*fee 11

选项01

您可以使用lscape LaTeX包。这会旋转页面内容,但不会旋转页码。

---
title: "Portrait and Landscape"
format:
  pdf:
    include-in-header: 
      text: |
        \usepackage{lscape}
        \newcommand{\blandscape}{\begin{landscape}}
        \newcommand{\elandscape}{\end{landscape}}
---

# 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

\blandscape

# Running Code

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).

\elandscape

Run Code Online (Sandbox Code Playgroud)

选项02

您还可以使用typeareaKOMA-Script 包来执行此操作。据我了解,它不仅改变了页面内容的方向,还设置了pdf页面旋转属性,使得具有此属性的页面在使用PDF查看器查看时将以横向方向显示。并且还保留页码位置。

---
title: "Portrait and Landscape"
format:
  pdf:
    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>.

Run Code Online (Sandbox Code Playgroud)

  • 第二种选择就像一个魅力! (2认同)