Configuring markup export

### 2.7.8 Configuring markup export

Export to LATEX, MathML and TeXmacs Scheme has some configuration options that can be set by using the markup_cfg command. This applies to latex and export_mathml commands as well as to TeXmacs sessions (note that mathml command does not support this configuration).

- markup_cfg takes a sequence of one or more arguments, each of which being one of:
  - simplify=[simp], where simp is a sequence containing one or more of the following: product, apply, or pow. If simp has only one element, square brackets may be omitted.
  - mathml=[comp], where comp is a sequence of one or more of the following: display or content. If comp has only one element, square brackets may be omitted.
- markup_cfg returns 1 if the configuration is successful, else it returns 0.
- The simplify argument refers to enabling/disabling automatic simplification of mathematical notation. Precisely:
  - Multiplication is made implicit where possible, hence the export commands favor e.g. 2x instead of 2· x. If simp contains product, then implicit multiplication is allowed, else it is not allowed (in that case the · symbol is always inserted).
  - Parentheses are omitted from function application when possible, i.e. when the argument is sufficiently simple. Therefore the export commands favor e.g. sinx instead of sin(x). If simp contains apply, then parentheses may be omitted when appropriate, otherwise they are always present.
  - Elementary function powers are simplified according to the traditional way of writing where the exponent moves between the function name and its argument; export commands therefore favor e.g. sin2 x instead of sin(x)2. If simp contains pow, then exponents may be moved, else this feature is disabled (by default it is eanbled).
- The mathml argument specifies which MathML components should be included in the output by default. If the sequence comp contains display, the presentation markup block will be present, and if comp contains content, then the content block will be present in the output. If one of these is not specified, the corresponding block will not appear in the MathML output. Note that you have to specify at least one component (by default, both are enabled).

#### Examples

With default configuration:

latex(x*sin(x)^2)

x \sin ^{2}x |  |  |  |  |  |  |  |  |  |

which is xsin2x when typeset.

To enable only implicit multiplication, enter:

markup_cfg(simplify=product)

1 |  |  |  |  |  |  |  |  |  |

Then:

latex(x*sin(x)^2)

x \sin \left(x\right)^{2} |  |  |  |  |  |  |  |  |  |

which is x sin(x)2 when typeset.

The command

markup_cfg(simplify=[product,apply],mathml=display)

enables only implicit multiplication and function application; additionally, it prevents content MathML from appearing in the output of export_mathml.