shyamd/mkdocs-bibtex

Minor incompatibility with pymdown.arithmatex

Closed this issue · 4 comments

The pymdownx.arithmatex extension may inject some MathJax code into the \bibliography section resulting in some characters being rendered as inline LaTeX code.

mkdocs-bibtex

Yikes. Just saw this.

It's not obvious to me what the original bibtex would have to look like to cause this. Can you post that?

I encountered a similar problem. Basically if a bibtex entry has ( and ), the underlying rendering backend escapes them into \( and \), which then triggers the inline mode of pymdownx.arithmatex.

Here's a bibtex that I used for testing, in case it helps:

@inproceedings{bock2018return,
  title={{Return Of Bleichenbacher’s Oracle Threat ({ROBOT})}},
  author={B{\"o}ck, Hanno and Somorovsky, Juraj and Young, Craig},
  booktitle={27th USENIX Security Symposium (USENIX Security 18)},
  pages={817--849},
  year={2018}
}

I added an option of unescape_for_arithmatex to let users opt-in for a simple hack (of replacing \( with ( and \) with ) in entry_text after line 155)

entry_text = entry_text.replace("\n", " ")

A pull request has been created, which also addresses issue #72. See if you're OK with it.

This should be taken care of by default in the new release. Breaking out the pybtex formatting from the pandoc formatting let me figure out that pybtex backslashes ALL special characters. So, now it unbackslashes parenthesis and periods.