Gavin Smith wrote:
On Fri, Oct 14, 2022 at 09:27:22PM -0500, Jacob Bachmeyer wrote:
TeX has an \ifmmode conditional that is true in math mode; @var/\var and
other marking macros could be adjusted to mark their arguments appropriately
when invoked in math mode. Are there other macros that would be appropriate
in @math? At first glance, @var seems unique here.
It's a good question. I understand why someone would want to use @var
inside @math, for consistent appearance of variables.
It already appears to work well with texinfo.tex, with
@math{@var{foo}\over @var{bar}} finds the quotient of @var{foo} by
@var{bar}. @math{\sqrt{@var{radicand}}} finds the square root of
@var{radicand}.
producing good results (even using the smaller font for foo and bar).
Since @math is defined to use TeX syntax in its argument, would it be
better to extend the other Texinfo processors to recognize \var inside
@math and do whatever is needed to make it act as @var in that case?
The manual could add:
Because math expressions will often contain variables also mentioned
in running text, Texinfo supports one extension to plain TeX in
@math: the Texinfo @var{...} command is available as \var{...}
inside the argument of a @math command.
... or something similar. There is no (good) way to make this /not/
work with texinfo.tex (for TeXnical reasons) but the other Texinfo
processors would need to be extended to support it.
It also works well enough with MathJax with Patrice's latest change,
using \mathit for the variable names (there appears to be no "\mathsl" so
there is a slight difference in font style in and out of math - this
seems unavoidable).
If I am reading my copy of /TeX for the Impatient/ correctly, the
ordinary plain TeX \sl command should work in math mode. Note that I am
not sure that HTML normally has slanted fonts at all, so MathJax may be
stuck with substituting italics for slanted; this would be an output
format limitation, much as plain text and Info lack the ability to
change fonts at all, but should also be consistent: if HTML substitutes
italics for slanted, the normal use of @var would also produce italic text.
-- Jacob