HOW TOs (MathML)
Associated Product: MathTools 2.0
Last change: Mar 13, 2015NOTE: Below features require a Math Enabled document!
Improving MathML export results
HOW TO Assign an expression type to a selection
(and why/when this is a good idea)
InDesign does not care much about semantics of content. It does not distinguish numbers or variables from other text.
MathML, to some degree, does. MathTools therefore added a Type
attribute - available inside MathZones, only - to explicitly mark content accordingly.
Available settings for Type are:
- Variable: identifies a variable
- Text: Identifies literal text
- Number: identifies a number
- Operator: Identifies an operator
- Symbol: Identifies a math symbol
- Function: Identifies function name
Assume a MathZone contains characters "102,345.34". By default, this would export to MathML as three different numbers separated by comma and period: 102 , 345 . 34.
To have it exported as a single number to MathML, it is necessary to explicitly assign Type Number
to the entire thing "102,345.34":
- select MathZone content
102,345.34
- popup the text context menu and
- perform Math > Type > Apply Type: Number
If you've setup the KBSC for the MathZone context menu, you would instead
- select MathZone content
102,345.34
- popup the MathZone context menu (e.g.: Ctrl+A) and
- perform Type > Apply Type: Number
As a result, MathZone content 102,345.34
got marked as Type: Number and will export to MathML accordingly.
Exchanging MathML
MathTools can exchange MathZones as MathML in various workflows:
- Copy as MathML (requires a MathZone)
- Paste as MathZone (requires MathML on clipboard)
- XML export -- converts MathZones into MathML
- XML import -- converts MathML to MathZones; requires Math Enabled document
- HTML + MathML export
- EPUB (Reflowable) + MathML export
HOW TO Copy a MathZone as MathML
MathTools V2 adds a Copy as MathML
action which is available in the top-level Edit menu and in the text context menu.
Copy as MathML
is enabled if the selection is a MathZone (or a text range inside a MathZone). The operation copies the resulting MathML to the clipboard.
HOW TO Paste MathML as MathZone
MathTools V2 adds a Paste as MathZone
action which is available in the top-level Edit menu and in the text context menu.
Paste as MathZone
is enabled if all of the following conditions are met
- document is Math Enabled
- selection context is a story
- MathML is available on the clipboard
The resulting MathZone is inserted the selection start.
HOW TO Export MathZones as MathML in XML Export
MathTools V2 integrates with InDesign's XML Export and converts any MathZone in the exported stories into MathML on the fly.
There's no additional step required in order to tell InDesign's XML Export to export MathML.
HOW TO Import MathML as MathZones during XML Import
MathTools V2 integrates with InDesign's XML Import and converts any MathML in the imported XML stream into MathZones on the fly.
There's no additional step required in order to tell InDesign's XML Import to import MathML.
However, the document needs to be Math Enabled. Otherwise, MathTools V2 will ignore MathML in the XML Import.
HOW TO Export MathZones to MathML with HTML export
MathTools V2 integrates with InDesign's native HTML export and converts any MathZone in the exported stories into MathML on the fly.
To export MathML along with InDesign's HTML, you need to select the Export Format "HTML with MathML".
Be sure you've followed the Installation Guide to install the MergeMath extension. MergeMath post-processes the HTML file exported by InDesign and merges MathML into it. If MergeMath is not installed, the HTML has no MathML embedded.
And, be sure to uncheck View HTML after Exporting
in HTML Export Options to allow MergeMath to process the HTML file.
HOW TO Export MathZones to MathML with EPUB (Reflowable) export
MathTools V2 integrates with InDesign's native EPUB (reflowable) export and converts any MathZone in the exported stories into MathML on the fly.
To export MathML along with InDesign's EPUB (Reflowable), you need to select the Export Format "EPUB with MathML".
Be sure you've followed the Installation Guide to install the MergeMath extension. MergeMath post-processes the HTML file exported by InDesign and merges MathML into it. If MergeMath is not installed, the HTML has no MathML embedded.
And, be sure to uncheck View EPUB after Export
in EPUB Export Options to allow MergeMath to process the EPUB file exported by InDesign.
If MergeMath was successful, it creates a copy of the original EPUB with _MathML
appended to the file name.