gpt4 book ai didi

latex - pandoc "titleformat"标尺

转载 作者:行者123 更新时间:2023-12-02 02:48:57 26 4
gpt4 key购买 nike

我对 YAML 数据 block 有疑问。给定以下 pandoc 文档:

---
papersize: a4
geometry: "left=1.5cm,right=1.5cm,top=3cm,bottom=3cm"
fontsize: 12pt
# https://stackoverflow.com/a/43659664/2069099
subparagraph: yes
#documentclass: extarticle
header-includes:
- \usepackage[explicit]{titlesec}
- \titleformat{\section}[hang] {\filleft\huge\sc} {label}{20pt}{#1}

---

Hello World
===========

Lorem ipsum

我正确地将标题对齐到右侧。现在,假设我需要标题下方有一个全角标尺,如 https://tex.stackexchange.com/a/84062 中所述。 ,需要将\titleformat语句修改为:

---
papersize: a4
geometry: "left=1.5cm,right=1.5cm,top=3cm,bottom=3cm"
fontsize: 12pt
# https://stackoverflow.com/a/43659664/2069099
subparagraph: yes
#documentclass: extarticle
header-includes:
- \usepackage[explicit]{titlesec}
- \titleformat{\section}[hang] {\filleft\huge\sc} {label}{20pt}{#1}[\titlerule\vspace*{4pt}]

---

Hello World
===========

Lorem ipsum

但这会导致以下错误:

Error producing PDF.
! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.49 {[

事实上,tex 文件显示了奇怪的代码:

...
\usepackage[explicit]{titlesec}
\titleformat{\section}[hang] {\filleft\huge\sc} {label}{20pt}{#1}

{[}\titlerule\vspace*{4pt}{]}

\date{}

\begin{document}
...

最佳答案

好的,在 YAML block 中传递普通 Latex 解决了问题:

--
papersize: a4
geometry: "left=1.5cm,right=1.5cm,top=3cm,bottom=3cm"
fontsize: 12pt
# https://stackoverflow.com/a/43659664/2069099
subparagraph: yes
#documentclass: extarticle
header-includes:
- \usepackage[explicit]{titlesec}
- |
```{=latex}
\titleformat{\section}[hang] {\filleft\huge\sc} {label}{20pt}{#1}[\titlerule\vspace*{4pt}]
```
---

Hello World
===========

Lorem ipsum

关于latex - pandoc "titleformat"标尺,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62375809/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com