You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Quarto PDF格式书籍中添加自定义图片封面与封底?

实现Quarto PDF书籍自定义封面与封底的方法

方法一:结合Quarto内置参数与LaTeX命令

步骤1:配置封面

在YAML的book字段下指定封面图片,同时关闭Quarto默认标题页避免样式冲突。

步骤2:添加封底处理

通过自定义LaTeX命令,在文档末尾插入封底图片并确保单独成页。

以下是修改后的完整代码:

---
book:
  title: "Title"
  author: "MYaseen208"
  cover-image: "https://i.sstatic.net/iUjF2.png" # 指定封面图片
  titlepage: false # 关闭默认标题页
format:
  pdf:
    documentclass: scrreprt
    toc: true
    toc-depth: 3
    include-in-header:
      - text: |
          \usepackage{lipsum}
          \usepackage{geometry}
          \usepackage{graphicx} # 显式加载图片处理包
          \geometry{a4paper, total={170mm,257mm}, left=20mm, top=20mm, bottom=20mm, right=50mm}
          % 定义封底插入命令
          \newcommand{\backcover}{
            \clearpage
            \thispagestyle{empty}
            \vspace*{\fill}
            \includegraphics[width=\textwidth, height=\textheight, keepaspectratio]{https://i.sstatic.net/iUjF2.png}
            \vspace*{\fill}
          }
---

# Introduction

\lipsum[1-50] 

# Material and Methods

\lipsum[1-20] 

% 在文档末尾调用封底命令
\backcover

方法二:完全自定义LaTeX标题页(更灵活)

如果需要精细控制封面布局,可直接用LaTeX环境替换默认封面,同时手动添加封底:

---
book:
  title: "Title"
  author: "MYaseen208"
  titlepage: false # 关闭默认标题页
format:
  pdf:
    documentclass: scrreprt
    toc: true
    toc-depth: 3
    include-in-header:
      - text: |
          \usepackage{lipsum}
          \usepackage{geometry}
          \usepackage{graphicx}
          \geometry{a4paper, total={170mm,257mm}, left=20mm, top=20mm, bottom=20mm, right=50mm}
---

% 自定义封面
\begin{titlepage}
  \thispagestyle{empty}
  \includegraphics[width=\textwidth, height=\textheight, keepaspectratio]{https://i.sstatic.net/iUjF2.png}
\end{titlepage}

# Introduction

\lipsum[1-50] 

# Material and Methods

\lipsum[1-20] 

% 自定义封底
\clearpage
\thispagestyle{empty}
\vspace*{\fill}
\includegraphics[width=\textwidth, height=\textheight, keepaspectratio]{https://i.sstatic.net/iUjF2.png}
\vspace*{\fill}

关键注意事项

  • 必须加载graphicx包:LaTeX处理图片依赖该包,显式声明更稳妥。
  • keepaspectratio参数:防止图片拉伸变形,保持原比例。
  • thispagestyle{empty}:去掉封面、封底的页码,符合书籍排版规范。
  • 本地图片路径:若使用本地图片,直接填写相对路径(如./cover.png),确保图片与Quarto文件路径匹配。

内容的提问来源于stack exchange,提问作者MYaseen208

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 05:42:55