Replies: 2 comments 3 replies
-
I am wondering the same thing. I wanted to render Just in case anybody else runs into broken anchoring in my use case, I just used format:
html:
toc: false
pdf:
toc: false
documentclass: article
hyperref:
- pdfborder={0 0 0}
- breaklinks=false
- colorlinks=true
- urlcolor=blue
include-before-body:
# NOTE: It may be possible to style links using another means.
- text: |
\newcommand{\hreful}[2]{
\href{#1}{
\textcolor{blue}{\ttfamily\underline{#2}}
}
}
geometry:
- margin=0.7in
keep-tex: true
template-partials:
- ./title.tex
format-links:
- text: tex
href: ./index.tex
|
Beta Was this translation helpful? Give feedback.
-
My use case does not pertain to book format, but rather yaml anchoring. Here is a complete example: ---
# example.qmd
title: Example
format:
pdf: &pdf_settings
toc: false
documentclass: article
hyperref:
- pdfborder={0 0 0}
- breaklinks=false
- colorlinks=true
- urlcolor=blue
include-before-body:
# NOTE: It may be possible to style links using another means.
- text: |
\newcommand{\hreful}[2]{
\href{#1}{
\textcolor{blue}{\ttfamily\underline{#2}}
}
}
latex: *pdf_settings
---
This is an example, and everything pertains to anchoring in the front matter. The following python code shows how the front matter anchors should resolve # example.py
import json
import yaml
front_matter = """
title: Example
format:
pdf: &pdf_settings
toc: false
documentclass: article
hyperref:
- pdfborder={0 0 0}
- breaklinks=false
- colorlinks=true
- urlcolor=blue
include-before-body:
# NOTE: It may be possible to style links using another means.
- text: |
\\newcommand{\\hreful}[2]{
\\href{#1}{
\\textcolor{blue}{\\ttfamily\\underline{#2}}
}
}
latex: *pdf_settings
"""
loaded = yaml.safe_load(front_matter)
print(json.dumps(loaded, indent=2)) Running this code gets: {
"title": "Example",
"format": {
"pdf": {
"toc": false,
"documentclass": "article",
"hyperref": [
"pdfborder={0 0 0}",
"breaklinks=false",
"colorlinks=true",
"urlcolor=blue"
],
"include-before-body": [
{
"text": "\\newcommand{\\hreful}[2]{\n \\href{#1}{\n \\textcolor{blue}{\\ttfamily\\underline{#2}}\n }\n}\n"
}
]
},
"latex": {
"toc": false,
"documentclass": "article",
"hyperref": [
"pdfborder={0 0 0}",
"breaklinks=false",
"colorlinks=true",
"urlcolor=blue"
],
"include-before-body": [
{
"text": "\\newcommand{\\hreful}[2]{\n \\href{#1}{\n \\textcolor{blue}{\\ttfamily\\underline{#2}}\n }\n}\n"
}
]
}
}
} However running
which would indicate that something went wrong, possible resolving the anchoring. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The following
_quarto.yml
works:But the chapters are listed twice, which is not a big problem in this small example, but imagine a book with thirty chapters. The following passes the http://www.yamllint.com validator but is not accepted by Quarto:
Here are the Quarto error messages:
Is there a way to include the same list in two places but only have one canonical place to edit the list? Even better if there is a way to concatenate lists - this is not a YAML feature but many CI systems implement some way to specify a flattened list.
Beta Was this translation helpful? Give feedback.
All reactions