繁体   English   中英

呈现为 PDF 时如何更改 Quarto 中的目录行间距?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM