Is there any MathML support in Sphinx (by mathjax extension)? - python-sphinx

Is there anyway to render MathML in the rst file with Sphinx?
I enabled mathjax extension in conf.py. It works very well with latex using like
However, if I replace it with math ML, it does render it but instead display all the xml code. For example,
produces
In Sphinx math is rendered by a mathjax extension. On https://www.mathjax.org/ mathjax claims they support MathML.

It's difficult to answer without knowing your desired output, but from the doc
The "math" directive inserts blocks with mathematical content (display
formulas, equations) into the document. The input format is LaTeX math
syntax with support for Unicode symbols
So, no way to use MMl with ..math::
If you output in HTML, you can try raw or literal directives instead to let the block as is. The block will be displayed correctly in a MML browser compliant. If you include mathjax libraries with a correct configuration it will also process.

Related

Converting page range from docx to pdf using pandoc

I'm trying to convert certain pages of a docx to pdf using pandoc but I can't find any sources hinting at where should I start. After taking a look into the pandoc documentation I still couldn't figure it out, so I just assumed that pandoc doesn't support this.
This might just act as a confirmation for future readers, Does pandoc support page range converting?
Pandoc has no concept of pages.
Putting text on pages happens during rendering with Word and LaTeX, but pandoc does not render the text before converting. Therefore it cannot know on which page a specific letter will be placed.

Sphinx can't generate link text as literal

With Markdown, I can simply:
[`a link with monospace font`](https://www.example.com)
a link with monospace font
Note how the above line is properly rendered by SO's MD renderer: the link text is in code (monospace) syntax.
I'm trying to achieve the same with reST:
I've tried to do this in reST with
```a link with monospace font`` <https://www.example.com>`_
But that breaks the linking, I get a monospaced text with a link with monospace font and then a link with https://www.example.com as the link text.
The problem seems to be Docutil's lack of support for nested inline markup. Frankly, I don't understand how's that possible. Docutils ToDo lists a discussion from 2001! We're in 2022! Not only this really basic feature is missing, but my impression is also that there's no real interest in ever implementing it.
I don't think the different workarounds are reasonable for such a simple feature.
Pandoc has an open bug for the exact same problem/
How can I get an HTML link test rendered as a literal without any workaround when using reStructuredText?

How do I use a different highlighter in R Bookdown?

I am trying to change the syntax highlighting color scheme in my book when rendering to a GitBook-style webpage. The color schemes available in Pandoc aren't very informative for my code (HTML/CSS/JavaScript). I can modify the CSS directly to change the color scheme, but the underlying problem seems to be that the highlighting-kate library used isn't doesn't do very descriptive parsing of these languages to produce effective color schemes.
The compiled book looks like it contains a highlight.js (HLJS) based plugin for Gitbook, but I can't figure out how to enable that so that I can drop in a hljs CSS file.
Is there anyway to utilize HLJS instead of Kate for code parsing? Or is there a good way to inject my own custom parsing into Pandoc's markdown rendering process?

How can I insert mathematical formulas into a markdown file with visual studio code?

I have used vscode to write markdown-file for several months, and it is a
perfect tool.
But how can I insert mathematical formulas into a markdown file with Visual Studio Code?
I can not find an effective solution by Google search. Does vscode support?
vscode v1.58 will have support for Katex:
Math formula rendering in the Markdown preview
VS Code's built-in Markdown preview can now render math equations using KaTeX
Inline math equations are wrapped in single dollar signs:
Inline math: $x^2$
While you can create a math equation block with double dollar signs:
Math block:
$$
\displaystyle
\left( \sum_{k=1}^n a_k b_k \right)^2
\leq
\left( \sum_{k=1}^n a_k^2 \right)
\left( \sum_{k=1}^n b_k^2 \right)
$$
You can set "markdown.math.enabled": false to disable this feature.
See https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_58.md#math-formula-rendering-in-the-markdown-preview
Markdown does not have a standard notation for mathematical formulas.
You can embed your formulas as images, and some formulas can be reasonably well approximated using Unicode. Furthermore, you can embed arbitrary tags, so you might conceivably be able to enter MathML. But some browsers, Chrome to mention an important one, don't support MathML and never will. Some sites like the Math Stack Exchange allow entering formulas to be rendered by MathJax. But that's non-standard Markdown as it disables Markdown semantics for the content of such equations.
Since there is no standard way to write formulas in Markdown, I'm not surprised if editors don't support editing it. After all, which of these various approaches should they follow?
If it's just a few formulas, I suggest you write them in LaTeX notation, feed them to KaTeX to turn them into statis HTML and then copy&paste that into your document. Of course, that process might conceivably be turned into an editor plugin. If someone knows of a plugin along these lines, they will sure write an answer to that effect.
Checkout the Markdown+Math extension in Code - works wonders in converting your equations in markdown using latex notation.

Html editor - Text to HTML convertor

I want to convert my text into HTML format, it would be just like this: that I just copy paste the text from word, pdf [with formatting & colors] to the editor and it will convert it into HTML tags, so that when I decode it again it would give me the same format that I have pasted.
I am mostly happy with PageBreeze but sometimes it destroys the formatting.
Are there any other editor suggestions?
Though I think it's a crude solution, you can try using the on-the-fly generated comment below, highlight, view source and copy it or pretty much any of the Rich Text Editor Javascript plugins out there such as RTE, the simplest I could find. (I'm not sure if those preserves copy-pasted formatting)
However, you won't be assured that any formatting (font/color) you get from here will be carried over to your website. In addition to HTML, CSS plays a huge part in styling, especially text-color, highlighting, spacing, etc.
I think in word you can do file >saveas > html
However it's going to be junky and nasty.
Your best option is to learn basic HTML (it really is super easy) and manually do it yourself.

Resources