Replies: 3 comments
-
If something is possible it would be a hack of the Math JavaScript library you are using (MathJax is the default in Quarto and it works on "body"). Note that you should not have such metadata as those informations are read by many tools (including browser). |
Beta Was this translation helpful? Give feedback.
-
I assumed you tried
And got an error from YAML validation. Just assumptions as you did not shared detailed nor error you got. If this is what happens, this is not because Math is not working. This is because you are tryting to write Markdown syntax (for Pandoc to interpret) using YAML configuration. So you need to handle YAML syntax and Markdown Syntax compatibility, which is escaping. In YAML,
So you can do
or
Visually in your HTML output you'll get math rendered in your Title. However, as mentioned already in previous answer, it can have undesired side effect. Let me give details. <title>This is Math: \pi</title> which also will show in your browser tab as name For this specific case you could adapt using
Anyhow, you know how to do this now. Hope it helps! |
Beta Was this translation helpful? Give feedback.
-
Thank you for the detailed explanation, excellent!!!
On October 17, 2024 at 8:48:21 AM, Christophe Dervieux ***@***.******@***.***>) wrote:
[EXTERNAL SENDER]
Backslashes are forbidden characters, therefore π is not processed as an inline math formula
I assumed you tried
title: "This is Math: $\pi$"
And got an error from YAML validation. Just assumptions as you did not shared detailed nor error you got.
If this is what happens, this is not because Math is not working. This is because you are tryting to write Markdown syntax (for Pandoc to interpret) using YAML configuration. So you need to handle YAML syntax and Markdown Syntax compatibility, which is escaping.
In YAML, "" or '' does not mean the same thing, and it does not escape the same.
* https://yaml.org/spec/1.2.2/#731-double-quoted-style
This is the only style<https://yaml.org/spec/1.2.2/#node-styles> capable of expressing arbitrary strings, by using “\” escape sequences<https://yaml.org/spec/1.2.2/#escaped-characters>. This comes at the cost of having to escape the “\” and “"” characters.
* https://yaml.org/spec/1.2.2/#732-single-quoted-style
The single-quoted style is specified by surrounding “'” indicators. Therefore, within a single-quoted scalar, such characters need to be repeated. This is the only form of escaping performed in single-quoted scalars. In particular, the “\” and “"” characters may be freely used. This restricts single-quoted scalars to printable<https://yaml.org/spec/1.2.2/#character-set> characters. In addition, it is only possible to break a long single-quoted line where a space<https://yaml.org/spec/1.2.2/#white-space-characters> character is surrounded by non-spaces<https://yaml.org/spec/1.2.2/#white-space-characters>.
So you can do
title: 'This is Math: $\pi$'
or
title: "This is Math: $\\pi$"
Visually in your HTML output you'll get math rendered in your Title.
However, as mentioned already in previous answer, it can have undesired side effect. Let me give details.
title can be used also in metadata of the document usually in <head> and for example you'll end up with
<title>This is Math: \pi</title>
which also will show in your browser tab as name
image.png (view on web)<https://github.com/user-attachments/assets/e0f7e6ce-304c-49a1-846e-3ab8012a88c6>
where \pi can't be rendered like in document
image.png (view on web)<https://github.com/user-attachments/assets/780131de-a30c-4b4b-8e00-9b439c7479fa>
For this specific case you could adapt using
…---
title: 'This is Math: $\pi$'
pagetitle: This is Math !
format: html
---
Content
Anyhow, you know how to do this now. Hope it helps!
—
Reply to this email directly, view it on GitHub<#11089 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AG5T666YWBWKVXTM4BNFURDZ36WZLAVCNFSM6AAAAABQCRNGYWVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAOJXGEZDSNI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there any way to include math formulas (TeX) in the title (metadata) for html and revealjs format?
Backslashes are forbidden characters, therefore$\pi$ is not processed as an inline math formula
Beta Was this translation helpful? Give feedback.
All reactions