m4_dnl ---------------------------------------------------------------------- m4_dnl M4 macros for expressing mathematical formulas m4_dnl m4_dnl m4_dnl These macros attempt to make it easier to write mathematical formulas m4_dnl for Maxima's user manual so that nice TeX-style formulas can be used m4_dnl for html and pdf docs and plain text for info. m4_dnl m4_dnl For displayed formulas use m4_displaymath(). For inline formulas use m4_dnl m4_math(). m4_dnl m4_dnl In general, each macro takes up to 3 args. The first arg for html m4_dnl docs using MathJax. The second arg is for simple text suitable for m4_dnl info (text) formulas, and the third arg is for TeX output. This is m4_dnl optional; if not provided the first arg is used. This occurs if the m4_dnl same TeX formula can be used for both MathJax and TeX. (MathJax m4_dnl supports LaTeX.) m4_dnl m4_dnl It is probably best to quote each arg to these macros like m4_dnl <<>> to prevent any confusion in parsing the arg, especially if m4_dnl the arg has commas in it. m4_dnl m4_dnl NOTE: that there's an issue if m4_math is at the beginning or end of a m4_dnl line. Then an extra newline is produced. Hence, m4_math should have m4_dnl a word before and after it. It can be helpful to add "@w{}" before or m4_dnl after m4_math. For m4_displaymath, be careful not to have extra blank m4_dnl lines within the formula; Tex amy complain about the m4_dnl blank lines. m4_dnl m4_dnl If m4_math is supposed to end a sentence, use m4_mathdot. If you m4_dnl don't then the ending period is spaced too far from the end of the m4_dnl equation. m4_dnl m4_dnl If you have sevaral inline formulas separated by commas, use m4_dnl m4_mathcomma(). Otherwise, the comma (like a period), is spaced too m4_dnl far from the formula. m4_dnl m4_dnl ---------------------------------------------------------------------- m4_dnl Maxima has an # operator, so disable comment delimiters completely so m4_dnl we don't accidentally comment out text m4_changecom()m4_dnl m4_dnl Change the quote characters to something that isn't likely to m4_dnl show up in the manual. m4_changequote(`<<<', `>>>')m4_dnl m4_dnl m4_dnl If makeinfo is too old, we don't have @displaymath, so we'll m4_dnl have to use something else. m4_define(<<>>, @NO_DISPLAYMATH@)m4_dnl m4_dnl m4_dnl For writing formulas suitable for various output formats. For m4_dnl simplicity two or three arguments are required: m4_dnl m4_dnl 1: HTML output with MathJAX enabled m4_dnl 2: HTML output without MathJax. Also used for info m4_dnl 3: If given, this is for TeX output. If not, then use arg 1. m4_dnl m4_dnl For easiest use, it's best to quote each arg, so use m4_dnl m4_displaymath(<<>>, <<>>, <<>>) m4_dnl m4_dnl m4_displaymath is used for displayed math equations. m4_dnl m4_dnl Be careful not to leave extra blank lines; TeX may complain about the m4_dnl blank lines. m4_define(<<>>, <<<@html m4_ifelse(m4_no_displaymath(), <<>>, <<<$$ $1 $$>>>, <<<@displaymath $1 @end displaymath>>>) @end html @ifinfo $2 @end ifinfo @tex $$m4_ifelse(<<<$#>>>, <<<3>>>, <<<$3>>>, <<<$1>>>)$$ @end tex >>>)m4_dnl m4_dnl m4_dnl m4_math(jax, info) or m4_math(jax, info, tex) m4_dnl Like m4_displaymath, but this is meant for inline math equations. m4_define(<<>>, <<< @html m4_ifelse(m4_no_displaymath(), <<>>, <<<\($1\)>>>, <<<@math{$1}>>>) @end html @ifinfo @math{$2} @end ifinfo @iftex @math{m4_ifelse(<<<$#>>>, <<<3>>>, <<<$3>>>, <<<$1>>>)} @end iftex >>>)m4_dnl m4_dnl m4_dnl m4_mathdot(jax, info) or m4_mathdot(jax, info, tex) m4_dnl m4_dnl Like m4_math, but automatically add a dot at the end of the m4_dnl equation to end a sentence. If you place a dot after m4_math(), there's m4_dnl an extra space in the output that looks weird. This is analogous to mrefdot. m4_define(<<>>, <<>>, <<<3>>>, <<>>, <<<$2.>>>, <<<$3.>>>)>>>, <<>>, <<<$2.>>>)>>>)>>>)m4_dnl m4_dnl m4_dnl Like m4_mathdot, but adds a comma at the end instead of a dot. m4_dnl Using m4_math() followed by a comma leaves an extra space that looks m4_dnl weird. This is analogous to mrefcomma. m4_define(<<>>, <<>>, <<<3>>>, <<>>, <<<$2,>>>, <<<$3,>>>)>>>, <<>>, <<<$2,>>>)>>>)>>>)m4_dnl