bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MathJax support in texi2any


From: Patrice Dumas
Subject: Re: MathJax support in texi2any
Date: Tue, 13 Oct 2020 01:40:44 +0200

On Fri, Oct 09, 2020 at 04:51:08PM +0100, Gavin Smith wrote:
> On Fri, Oct 09, 2020 at 01:00:03AM +0200, Patrice Dumas wrote:
> > On Wed, Oct 07, 2020 at 08:00:50PM +0100, Gavin Smith wrote:
> > > I've implemented basic MathJax support in texi2any in commit
> > > 7ff3cbdc4.
> > 
> > Should there be new @-environement commands for display math and 
> > equation ($$...$$ and \[...\] in Mathjax and Tex/LaTeX)?  If not, I guess 
> > that users will use @tex (possibly with LaTeX in @tex blocks) 
> > or custom @macros and still not use the now 'native' mathjax support.
> 
> There needs to be some way of getting display math, either with
> a new command (@displaymath?) or by putting @math inside @display (but
> then it's not clear what
> 
>   @display
>   line @math{a+b} text
>   @end display
> 
> should do).

@display already means something unrelated to math, I would suggest not
using it especially.

> In fact, an alternative is to detect when there is input like
> 
> @tex
> $$a+b$$
> @end tex
> 
> and process this as display math.

That's exactly what I proposed to avoid...  Indeed, instead of using a
format specifc command, specific environements like

@displaymath
a+b
@end displaymath

@equation
a+b
@end equation

could be used.  Actually, it is not perfect, as the language used for
the math in those @-command could be LaTeX or TeX, or something else, 
for example MathML, as there is nothing like a Texinfo math language.
Not sure what to do about this issue.  There could be an argument
stating the format inside, like

@equation latex
a+\frac{r}{g}
@end equation

and texinfo.tex or texi2any would know that LaTeX language is used for
the math in the environment, but it would also require a possibility 
to convert all the math formats to all the output formats...

> DocBook has the <equation> element which could be used for DocBook
> output (https://tdg.docbook.org/tdg/4.5/equation.html).

Indeed, but only if there is something similar in Texinfo, and also
what is inside should be expanded to a format thta can be nested in 
<equation>.  Looks like using an image would probably be the best in
that case.

> > Another remark, I think that the class that enables mathjax should be
> > specific and not 'math', as we may want, for example to have the math
> > class be added to @math element irrespective of mathjax being handled
> > or not.  For example, tex2jax_process could be used to be similar with 
> > tex2jax_ignore.
> 
> So <em class='math'> by default, and
> <em class='math' class='tex2jax_process'> for MathJax?

I would favor no class by default and class='tex2jax_process' for MathJax.
I think that we should avoid using class='math' unless there is a need,
such as a specific css style.  Or we shold start doing that for all the
@-commmands consistently.

Also I may be wrong, but it seems that <em class='math' class='tex2jax_process'>
would not be correct, it should be
<em class='math tex2jax_process'>
Which means that it would probably be better to call _attribute_class
if both a class for css that can be inlined and another class, such as 
tex2jax_process is needed, by adding, for example an array argument to
_attribute_class to pass additional classes not corresponding to css
style, and also maybe handling the case of the $class argument set to
undef.  No need to do anything until there is a concrete case, though.

-- 
Pat



reply via email to

[Prev in Thread] Current Thread [Next in Thread]