useblocks / sphinx-simplepdf

A simple PDF builder for Sphinx documentations
https://sphinx-simplepdf.readthedocs.io
MIT License
32 stars 14 forks source link

Math Not Rendering Correctly in PDF Output #99

Open sachin-suresh-rapyuta opened 2 months ago

sachin-suresh-rapyuta commented 2 months ago

I am experiencing issues with LaTeX math rendering in the PDF output generated using sphinx-simplepdf. The HTML output is correct, but the PDF output shows LaTeX notation as raw text, e.g., (2^{31} -1).

What I have tried:

  1. Installed sphinx-mathjax-offline via pip (link: https://pypi.org/project/sphinx-mathjax-offline/)
  2. Configured conf.py
extensions = [
    'sphinx.ext.mathjax',
    'sphinx-mathjax-offline',
]
mathjax2_config = {
    'tex2jax': {
        'inlineMath': [['$', '$'], ['\\(', '\\)']],
        'displayMath': [['$$', '$$'], ['\\[', '\\]']],
        'processEscapes': True,
    }
}

RST content:

1 to :math:`2^{31} - 1`

Result: HTML output renders math correctly:

image

But PDF output displays raw LaTeX text:

image

Expected Behavior: Math expressions should be rendered correctly in both HTML and PDF outputs.