Configuring MathJax in Sphinx documentation - python-sphinx

I am using restructured text and Sphinx to create content for a class. The content is hosted on readthedocs (an example is here).
Below is an image of one portion of that site that I would like to improve:
By adding the following to my conf.py file, I can get some improvement:
mathjax3_config = {
'chtml' : {
'mtextInheritFont' : 'true',
}
}
Is it possible to adjust the MathJax configuration so that numbers and units rendered with MathJax (250 uA in this case) appear identical to (or closely match) text not rendered in MathJax (0.250 mA in this case)?

Related

Left-align all math blocks in Sphinx HTML output

I have Sphinx documentation containing math blocks via the math directive. By default, they are centered in the HTML output. I want them all to appear aligned at the left, but with some indentation with respect to the surrounding text.
For example, if this is in index.rst
For :math:`|r| < 1`:
.. math::
\sum\limits_{k=0}^{\infty} r^k = \frac{1}{1-r}
Text in following paragraph put here to demonstrate that the math block
is in fact centered on the page.
and conf.py is completely empty, then running sphinx-build . output in the same folder produces the following HTML page as viewed in the browser:
I want that formula and all other math blocks left-aligned with something like 2 "em" indentation. This question asks how to left-align a single math block. I'm hoping there is a way to achieve the same effect throughout the documentation without changing each and every math directive in the reStructuredText source.
This answer applies to MathJax, the default mathematics renderer in HTML output.
The following setting in conf.py left-aligns all math directive content:
mathjax3_config = {'chtml': {'displayAlign': 'left'}}
Indentation can be customized with displayIndent:
mathjax3_config = {'chtml': {'displayAlign': 'left',
'displayIndent': '2em'}}
References:
https://www.sphinx-doc.org/en/master/usage/extensions/math.html#confval-mathjax3_config
https://docs.mathjax.org/en/v3.0-latest/options/output/index.html#options-common-to-all-output-processors

How to process image width/height in TYPO3?

I built a website in plain html/css with my own design. Now I need to put this website in TYPO3 CMS 9.5.4. Unfortunately it's my first time working with TYPO3 and I don't really know what I'm doing.
What I got so far:
Most of the website is already working fine. I included fluid_styled_content and my setup basically looks like this:
page = PAGE
page.1 = FLUIDTEMPLATE
page.1 {
file = fileadmin/sitedesign/Resources/Private/Templates/Page.html
variables {
content < styles.content.get
}
}
The Page.html file is basically my whole html template and I put
{content->f:format.raw()}
where I want my content.
All content I create in the backend is displayed as I want except of images.
My question:
I can display images by creating a "Text & Images" content element and adding the images in the "Images" tab. In the "Media Adjustments" section I can now set the width and height of each element and below I can choose the number of columns.
However these do not change anything in the source code of my website i.e. in the content variable, so all images are displayed in full size.
What can I do to make the width/height appear in the source code (ideally as width/height attribute of that element)?
Hey Erik and welcome to TYPO3. Usually TYPO3 will take care of the correct images sizes when using the default Content Elements (e.g. Text & Images). But TYPO3 requires ImageMagick or GraphicsMagick installed on the server to modify the pictures.
You can check out if your system matches all requirements using the "Environment" module in the TYPO3 backend (modules on the left side of the backend). Then you will see a function called "Image processing" which will test the required image functions of your server.

Asciidoc: how to get page headers & footers?

Is there a correct way to get Asciidoc to include headers and footers?
I am trying to work out whether Asciidoc is a serious contender for printed material. I know that it is supposed to be docbook compatible, but I can’t find out how to create chapters, headers and footers.
I am trying to create instructional material. Currently I am using Atom with the asciidoc plugin to create the text, and Marked 2 on the Mac to get a better look and to export it to PDF.
Running page headers and footers are not part of the AsciiDoc language but the tool you use for PDF conversion. From my view you have (at least) 2 options:
Follow the instructions in Exporting Print/PDF of your Marked 2 user manual to create page headers and footers (this might turn out difficult using the AsciiDoc processor instead of MultiMarkdown).
"You can specify headers and footers on a per-document basis using MultiMarkdown metadata at the very top of the document"
Since you probably have installed Asciidoctor anyway to support asciidoc in Marked 2 you could use an Asciidoctor PDF theme to generate PDF with headers/footers using Asciidoctor PDF. You would have to find an appropriate theme or create one yourself, though.
The most frequently used way to generate PDF output, however, seems to be generating DocBook output first and convert that to PDF using dblatex with DocBook XSL stylesheets (see AsciiDoc homepage). Maybe someone else can say more about that.

Can't insert html with <object> tag

I'm struggling with ckeditor 4.5, as I'm creating plugins to insert specific tags in current document after having uploaded a file on my server.
For some specific file types, I want to embed the element. I can add <audio> or <video> tags (by using allowContent=true in my config file), but when I insert an <object> tag (to embed a pdf file), the tag is just ignored.
I already tested adding config.extraAllowedContent = 'object[id, name, width, height, data, type] to the config file, with no avail.
I found some workarounds by adding a <div> around the <object>, but the pdf viewer is not displayed in the editor (but the <object> tag is there).
I think I'm doing something wrong with ACF, but I really don't see what.
only wrapped the tag with or , and if you use wordpress , or drupal try to disable Advanced content filter from cms
<object> is not recommended for PDF and should not be a part of an editable area. There is no way it can be editable like text or paragraph. However, it can be a non-editable element inside the editor, with some editable parts. This is what CKEditor call widget, here is a tutorial how to create it: https://ckeditor.com/docs/ckeditor4/latest/guide/widget_sdk_intro.html
Note PDF format is not normally classed as "Media" more generally "Document" but there are two ways to embed. One is to use the allMedia plugin that does include PDF as a media format ;-) the other is to include content via google docs. So review the various "Demonstrations" on the website.

Where is the actual documentation for highlight js / CKeditor theme values?

whether it be ckeditor themes, or codesnippet themes, where are the actual string values to pass as arguments to the config options? I'm having trouble finding the actual string values, or something pointing to the convention/pattern the value follows.
The ckeditor documentation is huge, and the links send you around in circles, referring you to generic documentation pages, but either the actual string values for possible arguments are not available.
the one example for plugins follows all lower case, no separation between words.
the highlight js themes that ckeditor requires seems to be snake case, but some are inconsistent and not working.
For instance, I'm looking to find values for
<script>
CKEDITOR.replace( 'editor1', {
skin: 'kama',
codeSnippet_theme:'tomorrow_night_dark'
} );
</script>
http://cdn.ckeditor.com/4.4.7/full-all/plugins/codesnippet/lib/highlight/styles/
A link to to this in the ckeditor documentation would help, with a short liner saying to copy the file name excluding the paths and the file type suffixes.
reference the file name without the .css suffix to get the correct string format for the codeSnippet_theme,
the files are named inconsistently.
you might think you need
'atelier_forest_dark', since 'school_book' works, but it's actually
'atelier-forest.dark'
It's also
'tomorrow-night-bright'
hybrid, which is available from the demos is not available from this list of CDN files hosted by ckeditor.

Resources