Features & Development



by Alex Jordan -
Number of replies: 1
In `PGbasicmacros.pl`, the following display macros are defined:

sub BM { MODES(TeX => '\\(', Latex2HTML => '\\(', HTML => ''); }; # begin math mode
sub EM { MODES(TeX => '\\)
', Latex2HTML => '\\)', HTML => ''); }; # end math mode
sub BDM { MODES(TeX => '\\[', Latex2HTML => '\\[', HTML => '<P ALIGN=CENTER>'); }; #begin displayMath mode
sub EDM { MODES(TeX => '\\]
', Latex2HTML => '\\]', HTML => '</P>'); }; #end displayMath mode

I searched the OPL and found no problem uses `$BM`, and only one problem uses `$BDM` (`Utah/AP_Calculus_I/set1_Reviews_of_Fundamentals/1210s2p16.pg`). And when I view that one problem, the math that is in "display mode" does not render as math. So either the macro is not being used correctly in this problem, or the macro is not doing what it is supposed to do.

I also find that `EV2` makes use of these macros, replacing `\(`, `\)`, `\[`, and `\]`. However, prior to that, `EV2` makes substitutions using `&math_ev3` and `&display_math_ev3` which I think renders the use of the four macros above pointless.

I'm looking at these in the first place, because I am making a PreTeXt display mode (PTX) and I am trying to give a PTX option for all of these display macros. But I don't really understand what these four do in the first place, so I'm having trouble understanding what the right PTX output should be. If I mimic what happens with that one problem that uses `$BDM`, then it does nothing to wrap math tags around the contents, so I'll do nothing for PTX too. But this seems wrong.

Does anyone know what these macros are supposed to do?
In reply to Alex Jordan


by Michael Gage -
I believe these were supposed to be aliases for beginMath, beginDisplayMath, endMath, and endDisplayMath. They
should function exactly as \( \[ and \) and \] function in latex and do nothing in HTML mode or only do centering and line breaks in the case of display math
It doesn’t look like they were found to be useful and were largely ignored. If we preserve them they should probably
do the “right thing” for MathJax as well. It seems they weren’t updated when MathJax was introduced.

EV2 was a previous version of EV3 and is not used very much. It does have one significant feature which is worth
remembering. If I remember correctly EV3 first processes the contents of \{ \} (perl code), then interpolates variables
($var.) and finally processes the tex expressions inside \(\) and \[ \]. EV3 interpolates the variables first, then
evaluates perl code and finally the TeX expression. Often these two processes are equivalent but not always.
EV3 caused the fewest surprises so it is almost always used. Most problems using EV2 for legacy reasons
would work using EV3.

— Mike