[英]How can you change the table of contents line spacing in Quarto when rendering to a PDF?
我在論文中使用 Quarto,並希望在渲染到 PDF 時將目錄行間距更改為 1。我使用linestretch: 1.5
。
我嘗試編寫諸如toc-linestretch: 1.5
類的命令,但它對我不起作用。 從基本文檔中,我看不到如何將toc
間距更改為 1 並將文檔間距的 rest 保持為 1.5。 如果有人知道如何在 _quarto.yml 文件中執行此操作,請告訴我!
我還嘗試將自定義 toc.text 文件制作為LaTeX/template partial ,但到目前為止它沒有用。 我的 toc.tex 文件基於Quarto 源代碼中提供的默認模板(滾動到 ~337 行)。 我當前的 toc.tex 文件是:
\usepackage{setspace}
\setstretch{1}
$if(has-frontmatter)$
\mainmatter
$endif$
$body$
我希望\setstretch{1}
可以工作,但這是我第一次使用 LaTeX,所以如果我的 toc.tex 文件有問題我不會感到驚訝,但我不確定接下來要嘗試什么。 謝謝!
您在此處提供的toc.tex
文件不包含生成目錄所需的命令( \tableofcontents
),如果您只需要修改目錄,則無需使用template.tex
,您可以使用只是toc.tex
代替。
因此,您可以嘗試使用以下toc.tex
文件(我通過刪除beamer
格式的行對其進行了一些修改)
toc.tex文件
{\setstretch{1} % set the linestrech from here ------------------------
$if(toc)$
$if(toc-title)$
\renewcommand*\contentsname{$toc-title$}
$endif$
$if(colorlinks)$
\hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$$endif$}
$endif$
\setcounter{tocdepth}{$toc-depth$}
\tableofcontents
$endif$
} % upto here ---------------------------------------------------------
$if(lof)$
\listoffigures
$endif$
$if(lot)$
\listoftables
$endif$
然后將\usepackage{setspace}
放在_quarto.yml
文件中的include-in-header
yaml 鍵下。
_四開本.yml
project:
type: book
book:
title: "Book"
author: "Jane Doe"
date: "1/4/2023"
chapters:
- index.qmd
- intro.qmd
- summary.qmd
- references.qmd
bibliography: references.bib
format:
pdf:
documentclass: scrreprt
linestretch: 1.5
include-in-header:
text: |
\usepackage{setspace}
template-partials:
- toc.tex
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.