Skip to content

Enable Braket Notations in mdBook MathJax Support #2987

@Luxque

Description

@Luxque

Problem

Hello.

Thank you so much for making such an amazing tool. I am working the project Open Quantum Computing Textbook, and this tool gave me a very handy way to make and maintain an online book.

As the name of the project suggests, this book project requires a lot of mathematical expressions throughout the entire text. Not to mention that I have to use braket notations since this is a quantum computing book. However, it seems the current MathJax support in mdBook does not support the braket commands that works on typical LaTeX documents.

For instance, when I write this on my repository:

\\(\\bra{\\psi}\\)

I expect mdBook properly renders $\ket{\psi}$; however, it gives me this instead:

\Braψ

There is a possible work-around:

\\(|\\psi\\rangle\\)

But if I want to render something like this:

$$ \ket{\psi} = \cos\left(\frac{\theta}{2}\right)\ket{0} + e^{i\phi}\sin\left(\frac{\theta}{2}\right)\ket{1} $$

I inevitably must use:

\\[
    |\\psi\\rangle = \\cos\\left(\\frac{\\theta}{2}\\right)|0\\rangle + e^{i\\phi}\\sin\\left(\\frac{\\theta}{2}\\right)|1\\rangle
\\]

Also, if I have to use \\left\\langle and \\right\\rangle to fit the size of the inner contents, it easily becomes disastrous to write and debug mathematical expressions in mdBook documents.

I hope there was a support for these macros: \|, \bra, \Bra, \braket, \Braket, \ket, \Ket, \ketbra, \Ketbra, \set, \Set, |.

Thank you.

Proposed Solution

No response

Notes

This document may be relevant to this issue: https://docs.mathjax.org/en/latest/input/tex/extensions/braket.html.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement or feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions