我正在四开本中构建一个文档,其中使用版本 1.3.340。我已经安装了基于 TeX Live
tinytex::install_tinytex()
的 LaTeX 发行版,我使用的是 0.45 版本。
我的 YAML 文档如下:
---
title: "Title"
format:
beamer:
pdf-engine: xelatex
number-sections: true
number-depth: 3
editor: visual
---
## Section
This is the content of the section
### Subsection
This is the content of the subsection
但是,我得到以下结果的部分没有编号:
如何为章节标题编号?代码有没有错误?
您所说的
section
和 subsection
不是一个部分或小节。截面是投影仪中的顶级截面级别,在四开本中,您可以通过获得它
# section name
如果您使用较低级别的标题,例如在四开本中使用
##
或 ###
,您将获得投影仪帧标题或块标题。如果你真的有决心,可以将frametitle和block title都编号:
---
title: "Title"
format:
beamer:
pdf-engine: xelatex
editor: visual
header-includes: |
\setbeamertemplate{section in toc}[sections numbered]
\newcounter{block}
\makeatletter
\setbeamertemplate{block begin}{%
\addtocounter{block}{1}%
\par\vskip\medskipamount%
\begin{beamercolorbox}[colsep*=.75ex]{block title}
\usebeamerfont*{block title}\theblock{} \insertblocktitle%
\end{beamercolorbox}%
{\parskip0pt\par}%
\ifbeamercolorempty[bg]{block title}
{}
{\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
\usebeamerfont{block body}%
\begin{beamercolorbox}[colsep*=.75ex,vmode]{block body}%
\ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}
\setbeamertemplate{frametitle}{%
\ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
\@tempdima=\textwidth%
\advance\@tempdima by\beamer@leftmargin%
\advance\@tempdima by\beamer@rightmargin%
\begin{beamercolorbox}[sep=0.3cm,wd=\the\@tempdima]{frametitle}
\usebeamerfont{frametitle}%
\vbox{}\vskip-1ex%
\if@tempswa\else\csname beamer@fteleft\endcsname\fi%
\strut\insertframenumber{} \insertframetitle\strut\par%
{%
\ifx\insertframesubtitle\@empty%
\else%
{\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\strut\insertframesubtitle\strut\par}%
\fi
}%
\vskip-1ex%
\if@tempswa\else\vskip-.3cm\fi% set inside beamercolorbox... evil here...
\end{beamercolorbox}%
}
\makeatother
---
# Section
## frametitle
This is the content of the section
### block
This is the content of the subsection
该问题已由 Christophe Dervieux(quarto 开发者)通过 https://github.com/quarto-dev/quarto-cli/pull/6958 修复。现在您可以获得想要的结果了。