Skip to content

add option to enable inline math $…$ #1772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

add option to enable inline math $…$ #1772

wants to merge 1 commit into from

Conversation

SichangHe
Copy link

add option to enable inline math $…$

We only support \\(…\\) for inline math right now. This PR adds an option to enable using $…$ for inline math.

usage

add this following to book.toml to enable this feature:

[output.html]
mathjax-support = true
inline-math-dollar-sign = true

unwanted usage

If the user enables this option without enabling MathJax support, nothing happens:

[output.html]
inline-math-dollar-sign = true

benefits

This will be helpful for writers that want to use a lot of inline math in their books, especially if it is a Mathematics book.

In equation [1], $x$ is …, $y$ is …

Looks much more friendly than:

In equation [1], \\(x\\) is …, \\(y\\) is …

It is also much easier to type.

Some extensions (for example, Markdown All in One for VSCode) gives a keyboard shortcut to add two $$ and put your cursor in the middle. This is very convenient.

drawback

If this option is enabled, the user will need to escape all their regular dollar signs:

\$

Therefore, this option is set to false by default.

@SichangHe
Copy link
Author

This makes no sense to me now because anyone that writes a lot of math with mdbook should probably use the mdbook-katex preprocesser unless mdbook has proper \ support in math. The MathJax support in mdbook is extremely clunky because all the \ needs to be written as \\, which makes it incompatible with any other markdown math renderer and makes the code look bad.

The takeaway is probably that we need a "math" section in the mdbook book that tells the user that they should opt in mdbook-katex for a better math support, or we should include an easy way to use their features.

@SichangHe SichangHe closed this May 31, 2022
@SichangHe SichangHe deleted the inline-math-$…$ branch May 31, 2022 16:02
@expikr
Copy link
Contributor

expikr commented Apr 16, 2023

Additionally, for those who want to use "vanilla" mdbook, if #2069 is accepted then the inline delimiter becomes the very concise \`...\` using the even more concise AsciiMath syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants