admin管理员组文章数量:1390466
I am trying to pass title, author, and other variables through yaml in quarto. I've managed to get most of it working but I am unable to have the title display in the header. Here's my template:
#let title-page(title: none, author: none,
date: none, name: none, body) = {
set page(fill: rgb("#20746c"), margin: (top: 1.5in, rest: 1.5in))
set text(font: "Source Sans Pro", size: 14pt)
set heading(numbering: "1.1.1")
line(start: (0%, 0%), end: (8.5in, 0%), stroke: (thickness: 2pt))
align(center)[
#text(size: 48pt, fill: white, strong(title))
#v(1em)
#text(size: 24pt, fill: white, strong(name))
#v(1em)
#text(size: 24pt, author)
#v(2em)
#text(size: 16pt, date)
]
pagebreak()
// New page should be "normal"
set page(fill: rgb("#F2F0EF"), margin: auto,
header: [
#rect(fill: rgb("#20746c"),
height: 100%,
width: 100%)
#smallcaps[title]
],
footer: [
#rect(fill: rgb("#20746c"),
height: 100%,
width: 100%)
str(here().page())
])
align(horizon, outline(indent: auto))
body
}
This is my typst-show:
#show: title-page.with(
$if(title)$
title: [$title$],
$endif$
$if(author)$
author: [$author$],
$endif$
$if(date)$
date: [$date$],
$endif$
$if(params.name)$
name: [$params.name$],
$endif$
)
Here is my yaml present in Quarto Markdown Document:
---
title: "A Comprehensive Report"
author: "Report Created by: User"
date: today
params:
name: "ABC Student"
format:
typst:
template-partials:
- typst-template.typ
- typst-show.typ
toc: true
toc-depth: 2
toc-title: Contents
toc-indent: 1.5em
papersize: us-letter
margin:
x: 1cm
y: 1cm
---
My coverpage page And this is my output:
As you see, the "title" field is shown in the cover page but not in the header portion. Why?
I am trying to pass title, author, and other variables through yaml in quarto. I've managed to get most of it working but I am unable to have the title display in the header. Here's my template:
#let title-page(title: none, author: none,
date: none, name: none, body) = {
set page(fill: rgb("#20746c"), margin: (top: 1.5in, rest: 1.5in))
set text(font: "Source Sans Pro", size: 14pt)
set heading(numbering: "1.1.1")
line(start: (0%, 0%), end: (8.5in, 0%), stroke: (thickness: 2pt))
align(center)[
#text(size: 48pt, fill: white, strong(title))
#v(1em)
#text(size: 24pt, fill: white, strong(name))
#v(1em)
#text(size: 24pt, author)
#v(2em)
#text(size: 16pt, date)
]
pagebreak()
// New page should be "normal"
set page(fill: rgb("#F2F0EF"), margin: auto,
header: [
#rect(fill: rgb("#20746c"),
height: 100%,
width: 100%)
#smallcaps[title]
],
footer: [
#rect(fill: rgb("#20746c"),
height: 100%,
width: 100%)
str(here().page())
])
align(horizon, outline(indent: auto))
body
}
This is my typst-show:
#show: title-page.with(
$if(title)$
title: [$title$],
$endif$
$if(author)$
author: [$author$],
$endif$
$if(date)$
date: [$date$],
$endif$
$if(params.name)$
name: [$params.name$],
$endif$
)
Here is my yaml present in Quarto Markdown Document:
---
title: "A Comprehensive Report"
author: "Report Created by: User"
date: today
params:
name: "ABC Student"
format:
typst:
template-partials:
- typst-template.typ
- typst-show.typ
toc: true
toc-depth: 2
toc-title: Contents
toc-indent: 1.5em
papersize: us-letter
margin:
x: 1cm
y: 1cm
---
My coverpage page And this is my output:
As you see, the "title" field is shown in the cover page but not in the header portion. Why?
Share Improve this question asked Mar 14 at 13:37 PssPss 6631 gold badge6 silver badges15 bronze badges1 Answer
Reset to default 0I solved this by using ()
instead of []
.
header: [
#rect(fill: rgb("#20746c"),
height: 100%,
width: 100%)
#smallcaps(title)
]
本文标签: Unable to use title variable in header Typst and Quarto MarkdownStack Overflow
版权声明:本文标题:Unable to use title variable in header: Typst and Quarto Markdown - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744653651a2617835.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论