How to use MathML please

Newbie question for my non-fiction project…

I am writing a Maths textbook and would like to use MathML to write Maths equations. I have read about Scrivener integrating with MathML but I have no clue how to get it set up and how to use it.

Any help/suggestions gratefully received.

TIA

Graeme

PS I’ve used Scrivener for fiction writing for 7 years but this is my first non-fiction foray.

I don’t use MathML but I thought that Scrivener only supports MathType (a paid GUI app) natively and it can convert MathType to MathML when generating EPub? If you only want to use Scrivener’s native tools, AFAIK then you need to consider MathType…

Most people however write their maths using TeX syntax, it is much easier to write:

ax^{2}+bx+c
<mrow><mi>a</mi><msup><mi>x</mi><mn>2</mn></msup>
<mo>+</mo><mi>b</mi><mi>x</mi><mo>+</mo><mi>c</mi></mrow>

MathML is not really for humans, but for machines! TeX maths can be converted to MathML, for example this is done automatically by Pandoc, but there are many other tools around. Given Pandoc’s robust ability with converting TeXMath to many different outputs and the fact it integrates directly into Scrivener’s compile, that is one avenue to consider…

There are great free online tools like https://formulasheet.com/ that uses a GUI to allow you to write and render equations as TeX or also copy as MathML. That site also saves equations so you can keep them available to modify and tweak later on…

What output formats are you intending to generate? How much flexibility do you need in layout, do you need numbered cross references to your equations etc?

Thanks for the response.

I’m trying to write in scrivener and compile to pdf.

Graeme

MathType appears to have abandoned MacOS, particularly for 64-bit operating systems. We recommend LaTeXiT as an alternative for Mac OS users. It’s part of the MacTeX package.

And how comfortable are you in terms of technical ability? @kewms mentions that MathType is not macOS friendly any more, but I realise we don’t know what OS you use?

LaTeXiT seems like a nice tool, it basically uses a latex engine to render TeX maths to PDF / SVG which you can directly embed in Scrivener. This should allow you a simple route to have equations in the editor (and I think these can be re-edited by LaTeXiT if needed).

Another option is to think about using the non-fiction LaTeX template for scrivener. This compiles from Scrivener to LaTeX directly, which you can then render to a PDF. LaTeX is the tool 99.99% :stuck_out_tongue_winking_eye: of all maths texts are written in and rendered by. LaTeX should allow cross-referencing of equations (though I don’t know how that is handled by the template), and things like bibliographies, indexes that proper books require. But LaTeX does have quite a learning curve, and certainly may require an investment of time.

As I mentioned, markdown processor pandoc will also allow you to compile maths heavy documents from Scrivener to many formats including LaTex, HTML, DOCX etc. I prefer using markdown as it is simpler and more flexible when needing to switch between formats, and tweak the outputs. Direct pandoc use is simple, but like LaTeX it has many functions and requires some time if you want to master it. Recently a new tool based on Pandoc that aims to scientific publishing has been released, called quarto that can also be integrated into Scrivener’s compile. Though based on Pandoc, it simplfies the workflow.

@nontroppo Thanks for the comments.
I’ve been looking at my complete workflow today. I aim to write pages with equations and screenshots to output in a Wordpress site, in a pdf for paperback and epub for ebook.

The ‘easiest’ approach looks like markdown in scrivener, output using scrivomatic, or at least pandoc, to generate the books. I’ve found a couple of Wordpress plugins to import the markdown into the website.

The images are going to actually prove to be the hardest to deal with. I have 300dpi calculator images which I need in all formats and I’m using screenshots with 72dpi which seem ok in pdf and ebook. I won’t know about their resolution for paperback until I have a proof copy much later on (gulp).

The silver lining is that if I start a PhD next year, I’ll be set for the tech of creating a dissertation in scrivener - I used Word for my MA as I couldn’t get to grips with the Zotero citations in scriv.

What are your thoughts about my web/pdf/epub plans?

TIA

PS I forgot to say I am on Mac Catalonia.

Yeah, I honestly don’t know much about WordPress, but certainly PDF and EPub will be very well served by using Markdown. Out of curiosity why use WordPress? There is a new technical publishing system built on top of pandoc called Quarto, and the HTML versions of their books are really nice and featureful. Though I haven’t personally tried to set it up, Quarto should play well with Scrivener; when I get time I will make a sample Scrivener project using it. It is basically pandoc + filters + templates so it is worth giving it a look: Gallery

Regarding 72dpi images, the good news is that superscaling tools now work very well, and you may find they can “normalise” your DPI across images. I use Pixelmator Pro which is superb pixel-based editor which uses AI for superscaling and has lots of automation hooks.

And yes, Scrivener + Pandoc makes a great combination for academic work like a thesis!

@nontroppo The reason I am using WordPress is that I want the content the same in my paperback, epub and also on a website that students will be able to quickly search and read content on their phones. The publication is aimed at 16-18 year olds.

I’ll keep hammering at the image question, but it looks like I have a workflow that I can use over this month to build up some content by schools/colleges come back to life in September.

Thanks again

Graeme

Because it’s the number one content management tool for websites, by a pretty wide margin. If it’s going on the web, there’s a pretty good chance it will need to work with WordPress at some point.