Re: MathJax support in texi2any

2020-10-25 Thread Patrice Dumas
On Sun, Oct 25, 2020 at 07:16:20PM +, Gavin Smith wrote:
> On Sun, Oct 25, 2020 at 07:21:22PM +0100, Patrice Dumas wrote:
> > It already doesn't work for @math but we nevertheless encourage it.
> > The long term solution is probably to convert to TeX/LaTeX inside
> > of @math.  It seems a bit strange to me to treat @math and @displaymath
> > differently in that regard.
> 
> Since @displaymath is a new command, there's no need to support @sup or
> @sub inside it, whereas there are already documents using @sup inside of
> @math.  It would be hard to remove support for this, but perhaps a warning
> could be given, encouraging use of ^ or _ instead.

Then, the documentation should be modified to be clearer that no
@-commands are expected in @displaymath, right now there is nothing
said, such that it appears as if what is said about @math is also valid
for @displaymath.

-- 
Pat



Re: MathJax support in texi2any

2020-10-25 Thread Gavin Smith
On Sun, Oct 25, 2020 at 07:21:22PM +0100, Patrice Dumas wrote:
> > People might also put other Texinfo commands inside the block, like
> > @sub or @sup, but that shouldn't be encouraged, as that won't work
> > with MathJax.  (Also, \mathopsup won't work with MathJax either.)
> 
> It already doesn't work for @math but we nevertheless encourage it.
> The long term solution is probably to convert to TeX/LaTeX inside
> of @math.  It seems a bit strange to me to treat @math and @displaymath
> differently in that regard.

Since @displaymath is a new command, there's no need to support @sup or
@sub inside it, whereas there are already documents using @sup inside of
@math.  It would be hard to remove support for this, but perhaps a warning
could be given, encouraging use of ^ or _ instead.




Re: MathJax support in texi2any

2020-10-25 Thread Patrice Dumas
On Sun, Oct 25, 2020 at 05:15:13PM +, Gavin Smith wrote:
> 
> Processing @-commands within @displaymath could be useful for using
> @macro's and consistency with @math.  Apart from that, the only
> command that I can imagine people having to use inside @displaymath
> would be @@ to get an @.
> 
> I don't think it matters that much.  Would you be able to implement it?

At least in the perl parser, I think so as it is already that way for
@math.

> I made @displaymath a lot like @verbatim, but maybe there is another
> command that is more appropriate.

If it is discouraged to use @-commands, then @verbatim is a good choice.

> People might also put other Texinfo commands inside the block, like
> @sub or @sup, but that shouldn't be encouraged, as that won't work
> with MathJax.  (Also, \mathopsup won't work with MathJax either.)

It already doesn't work for @math but we nevertheless encourage it.
The long term solution is probably to convert to TeX/LaTeX inside
of @math.  It seems a bit strange to me to treat @math and @displaymath
differently in that regard.

-- 
Pat



Re: MathJax support in texi2any

2020-10-25 Thread Gavin Smith
On Sun, Oct 25, 2020 at 05:55:28PM +0100, Patrice Dumas wrote:
> On Sat, Oct 17, 2020 at 09:48:15PM +0100, Gavin Smith wrote:
> > On Tue, Oct 13, 2020 at 01:40:44AM +0200, Patrice Dumas wrote:
> > > @displaymath
> > > a+b
> > > @end displaymath
> > 
> > @displaymath is implemented now (in both texi2any and texinfo.tex).
> 
> In texi2any, @displaymath is processed as raw environment which means
> that the @-commands are not interpreted.  I think that it would be
> better if it was parsed like @math, that is matching braces and
> @-commands are considered.
> 
> What do you think?

Processing @-commands within @displaymath could be useful for using
@macro's and consistency with @math.  Apart from that, the only
command that I can imagine people having to use inside @displaymath
would be @@ to get an @.

I don't think it matters that much.  Would you be able to implement it?
I made @displaymath a lot like @verbatim, but maybe there is another
command that is more appropriate.

People might also put other Texinfo commands inside the block, like
@sub or @sup, but that shouldn't be encouraged, as that won't work
with MathJax.  (Also, \mathopsup won't work with MathJax either.)



Re: MathJax support in texi2any

2020-10-25 Thread Patrice Dumas
On Sat, Oct 17, 2020 at 09:48:15PM +0100, Gavin Smith wrote:
> On Tue, Oct 13, 2020 at 01:40:44AM +0200, Patrice Dumas wrote:
> > @displaymath
> > a+b
> > @end displaymath
> 
> @displaymath is implemented now (in both texi2any and texinfo.tex).

In texi2any, @displaymath is processed as raw environment which means
that the @-commands are not interpreted.  I think that it would be
better if it was parsed like @math, that is matching braces and
@-commands are considered.

What do you think?

-- 
Pat



Re: MathJax support in texi2any

2020-10-24 Thread Patrice Dumas
On Sat, Oct 17, 2020 at 09:48:15PM +0100, Gavin Smith wrote:
> On Tue, Oct 13, 2020 at 01:40:44AM +0200, Patrice Dumas wrote:
> > @displaymath
> > a+b
> > @end displaymath
> 
> @displaymath is implemented now (in both texi2any and texinfo.tex).

Ok. I'll see to add it to init/latex2html.pm and init/tex4ht.pm.

> > > DocBook has the  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 
> > .  Looks like using an image would probably be the best in
> > that case.
> 
> Is there not the same issue with the output of @math for DocBook?

There is the same issue, indeed.

-- 
Pat



Re: MathJax support in texi2any

2020-10-13 Thread Raymond Toy
On Thu, Oct 8, 2020 at 12:37 PM Gavin Smith 
wrote:

> On Thu, Oct 08, 2020 at 12:26:28PM -0700, Raymond Toy wrote:
> > Does this also mean I can use AMSTeX features in @math?  I guess that
> also
> > means I still need @iftex and @ifhtml versions since tex output only
> > understands plain TeX, right?  Still this is a very nice feature!
>
> I couldn't tell you about AMSTeX (or other LaTeX macros) with MathJax, but
> it wouldn't work with TeX output unless the macros were defined.
>

Played around a bit.  This does look quite nice.  As others have mentioned,
a @displaymath would be very nice.

Since maxima's manual supports info, pdf, and html output, it has been
quite a bit of work to keep it all organized.  Until now, we didn't really
expect @math to do anything special for pdf and html.  But now that it can,
it's really tempting to use plain tex in @math to get nice inline formulas
for pdf and html. But these may not look so good in info format.

I think it's ok if someone wants to use the full capabilities of MathJax or
to have readable math in info files, then they'll have to do the
appropriate set of @iffoo @end iffoo.  Not great, but I don't see how you
can have @math with TeX that also would produce something nice for info.

For maxima, I think that instead of @math{\int_0^1 x dx}, we'd want to say
in maxima syntax 'integrate(x,x,0,1)', which probably wouldn't be done
using @math at all.

-- 
Ray


Re: MathJax support in texi2any

2020-10-13 Thread Christopher Dimech



Sent: Tuesday, October 13, 2020 at 4:05 PM
From: "Patrice Dumas" 
To: "Christopher Dimech" 
Cc: "Gavin Smith" , "Texinfo" , 
"Oliver Heimlich" 
Subject: Re: MathJax support in texi2any
On Tue, Oct 13, 2020 at 01:35:56PM +0200, Christopher Dimech wrote:
>
> The distinction between the variant of Tex the user codes should remain.
>
> For plain tex, the command should remain "@tex @end tex". As Latex Syntax
> is much different, there should be some command like @latex @end latex.
>
> Mixing creates too many problems to those making modifications. One should
> stick with the same syntax type according to the variant a user is actually
> coding with.

I agree in principle, but note that some manuals have already used @tex
for LaTeX, for instance the Singular manual. Right now texi2any
actually more or less accepts that with the --init latex2html.pm (for
LaTeX in @tex and @math) and --init tex4ht.pm (for TeX in @tex and a mix
of texinfo and TeX in @math), but I agree that it is confusing and it
would be better to have @latex, but LaTeX is not supported by texi2any.
I wanted to do an output in LaTeX, but I haven't found the time in like
5 years...

C*: I consider that authors with too much latex to be a mistake in planning.
One can write a script to print the tex and latex code and simplify it with
plain tex. If Latex is not supported by texi2any, it should say: latex is not
supported in texinfo.  And when it becomes supported, we can have the specific
declaration @latex in there.

C*: My suggestion would be that if html is going to support mathematical 
expression,
the implementation should be done first for plain tex. So manuals with latex
sections would only be processed with plain tex. 

> However, when transforming to html, texinfo should parse the respective 
> variant
> without having the user specify any html tags.

You mean without?

C*: Yes, I meant without.


In any case, there is no perfect solution here, as when outputting html
it is not easy to select the @tex/@latex blocks tht should be used. One
can use the conditionals, but then there is an ambiguity on whether they
are for html or TeX output. It is possible to use double conditionals
but then it becomes tedious.

There is no perfect solution, but a bad solution would be to have a
convoluted acceptance of various variants in the same section, that
maintainers could regret having done later on, as people would start
coding all sort of mixed code. That would be a parsing nightmare - to
myself anyway.

--
Pat



Re: MathJax support in texi2any

2020-10-13 Thread Patrice Dumas
On Tue, Oct 13, 2020 at 01:35:56PM +0200, Christopher Dimech wrote:
> 
> 
> The distinction between the variant of Tex the user codes should 
> remain.
> 
> 
> 
> For plain tex, the command should remain @tex @end tex. As 
> Latex Syntax
> 
> is much different, there should be some command like @latex @end 
> latex.
> 
> 
> 
> Mxing creates too many problems to those making modifications. One 
> should
> 
> stick with the same syntax trype according to the variant a user is 
> actually
> 
> coding with.

I agree in principle, but note that some manuals have already used @tex
for LaTeX, for instance the Singular manual.  Right now texi2any
actually more or less accepts that with the --init latex2html.pm (for
LaTeX in @tex and @math) and --init tex4ht.pm (for TeX in @tex and a mix
of texinfo and TeX in @math), but I agree that it is confusing and it
would be better to have @latex, but LaTeX is not supported by texi2any.
I wanted to do an output in LaTeX, but I haven't found the time in like
5 years...

> 
> 
> However, when transforming to html, texinfo should parse the respective 
> variant
> 
> with having the user specify any html tags.

You mean without?

In any case, there is no perfect solution here, as when outputting html
it is not easy to select the @tex/@latex blocks tht should be used.  One
can use the conditionals, but then there is an ambiguity on whether they
are for html or TeX output.  It is possible to use double conditionals
but then it becomes tedious.

-- 
Pat



Re: MathJax support in texi2any

2020-10-13 Thread Christopher Dimech
 

The distinction between the variant of Tex the user codes should remain.

 

For plain tex, the command should remain "@tex @end tex". As Latex Syntax

is much different, there should be some command like "@latex @end latex".

 

Mxing creates too many problems to those making modifications. One should

stick with the same syntax trype according to the variant a user is actually

coding with.
 

However, when transforming to html, texinfo should parse the respective variant

with having the user specify any html tags.

 

Regards

Christopher

 

-
Christopher Dimech
Chief Administrator - Naiad Informatics - GNU Project (Geocomputation)
- Geophysical Simulation
- Geological Subsurface Mapping
- Disaster Preparedness and Mitigation
- Natural Resource Exploration and Production
- Free Software Advocacy

 
 

Sent: Tuesday, October 13, 2020 at 1:27 PM
From: "Gavin Smith" 
To: "Patrice Dumas" , "Texinfo" , "Christopher Dimech" , "Oliver Heimlich" 
Subject: Re: MathJax support in texi2any

On Tue, Oct 13, 2020 at 01:40:44AM +0200, Patrice Dumas wrote:
> @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...

It would also be incompatible with documents that already used this
syntax and provided other options for other output formats - the block
would be output twice.

> Indeed, instead of using a
> format specifc command, specific environements like
>
> @displaymath
> a+b
> @end displaymath
>
> @equation
> a+b
> @end equation
>
> could be used.

I like @displaymath better, as an equation would have to have an equals sign.

> 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.

There is the same issue with the existing command @math. I say just leave
it as plain TeX and worry about AMS-LaTex another time.

> > DocBook has the  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
> . Looks like using an image would probably be the best in
> that case.

I see, so you wouldn't want TeX syntax in the DocBook output.

> > > 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  by default, and
> >  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.

I think  marks it as math and this would allow it to be
processed by some other tool. Just using  would give no way to find
the unprocessed TeX code in the file.

> Also I may be wrong, but it seems that 
> would not be correct, it should be
> 
> 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.

I see. I only used  for HTML_MATH=mathjax
so that should be OK.






Re: MathJax support in texi2any

2020-10-13 Thread Gavin Smith
On Tue, Oct 13, 2020 at 01:40:44AM +0200, Patrice Dumas wrote:
> @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...

It would also be incompatible with documents that already used this
syntax and provided other options for other output formats - the block
would be output twice.

> Indeed, instead of using a
> format specifc command, specific environements like
> 
> @displaymath
> a+b
> @end displaymath
> 
> @equation
> a+b
> @end equation
> 
> could be used.

I like @displaymath better, as an equation would have to have an equals sign.

> 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.

There is the same issue with the existing command @math.  I say just leave
it as plain TeX and worry about AMS-LaTex another time.

> > DocBook has the  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 
> .  Looks like using an image would probably be the best in
> that case.

I see, so you wouldn't want TeX syntax in the DocBook output.

> > > 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  by default, and
> >  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.

I think  marks it as math and this would allow it to be
processed by some other tool.  Just using  would give no way to find
the unprocessed TeX code in the file.

> Also I may be wrong, but it seems that  class='tex2jax_process'>
> would not be correct, it should be
> 
> 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.

I see.  I only used  for HTML_MATH=mathjax
so that should be OK.



Re: MathJax support in texi2any

2020-10-12 Thread Patrice Dumas
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  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 
.  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  by default, and
>  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 
would not be correct, it should be

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



Re: MathJax support in texi2any

2020-10-09 Thread Christopher Dimech

 

@tex ... @end tex with details inside needs to be supported, rather than with

commands specific to html.

 

Regards

C*

 


Sent: Friday, October 09, 2020 at 5:51 PM
From: "Gavin Smith" 
To: "Patrice Dumas" , "Texinfo" , "Christopher Dimech" , "Oliver Heimlich" 
Subject: Re: MathJax support in texi2any

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).

In fact, an alternative is to detect when there is input like

@tex
$$a+b$$
@end tex

and process this as display math.

I think the display math problem is a lesser problem than how/whether to
distribute MathJax.

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

> I wanted to check the mathjax support for the singular manual for
> example, which has maths written in LaTeX, but it uses @tex all over,
> and not @math.
>
>
> I propose to add a test with mathjax in tp/tests/layout/list-of-tests:
> formatting_mathjax formatting.texi --html -c HTML_MATH=mathjax
> Would that be ok?
>
> The @math is rendered in that example correctly with mathjax.
>

Yes, please.

> 3 remarks:
>
> In _convert_math_command, the condition
> if (!defined($self->get_conf('L2H'))) {
> will never be true. Indeed, if L2H is set, latex2html.pm should be
> loaded, in that file texinfo_register_command_formatting('math', ..) is
> called which means that Texinfo::Convert::HTML::_convert_math_command
> will not be called.

OK.

I think -c HTML_MATH=l2h should be made a synonym for -c L2H=1, but I haven't
looked at how to do this.

>
> I think that there should not be a warning if there is @math in a
> document and HTML_MATH is not set.

I don't have strong feelings about this and it seems fairly harmless
to keep things as they are, with no warning.

>
> 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  by default, and
 for MathJax?





Re: MathJax support in texi2any

2020-10-09 Thread Gavin Smith
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).

In fact, an alternative is to detect when there is input like

@tex
$$a+b$$
@end tex

and process this as display math.

I think the display math problem is a lesser problem than how/whether to
distribute MathJax.

DocBook has the  element which could be used for DocBook
output (https://tdg.docbook.org/tdg/4.5/equation.html).
 
> I wanted to check the mathjax support for the singular manual for
> example, which has maths written in LaTeX, but it uses @tex all over,
> and not @math.
> 
> 
> I propose to add a test with mathjax in tp/tests/layout/list-of-tests:
> formatting_mathjax formatting.texi --html -c HTML_MATH=mathjax
> Would that be ok?
> 
> The @math is rendered in that example correctly with mathjax.
> 

Yes, please.

> 3 remarks:
> 
> In _convert_math_command, the condition
>   if (!defined($self->get_conf('L2H'))) {
> will never be true.  Indeed, if L2H is set, latex2html.pm should be
> loaded, in that file texinfo_register_command_formatting('math', ..) is 
> called which means that Texinfo::Convert::HTML::_convert_math_command
> will not be called.

OK.

I think -c HTML_MATH=l2h should be made a synonym for -c L2H=1, but I haven't
looked at how to do this.

> 
> I think that there should not be a warning if there is @math in a
> document and HTML_MATH is not set.

I don't have strong feelings about this and it seems fairly harmless
to keep things as they are, with no warning.

> 
> 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  by default, and
 for MathJax?



Re: MathJax support in texi2any

2020-10-08 Thread Patrice Dumas
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.

I wanted to check the mathjax support for the singular manual for
example, which has maths written in LaTeX, but it uses @tex all over,
and not @math.


I propose to add a test with mathjax in tp/tests/layout/list-of-tests:
formatting_mathjax formatting.texi --html -c HTML_MATH=mathjax
Would that be ok?

The @math is rendered in that example correctly with mathjax.


3 remarks:

In _convert_math_command, the condition
  if (!defined($self->get_conf('L2H'))) {
will never be true.  Indeed, if L2H is set, latex2html.pm should be
loaded, in that file texinfo_register_command_formatting('math', ..) is 
called which means that Texinfo::Convert::HTML::_convert_math_command
will not be called.


I think that there should not be a warning if there is @math in a
document and HTML_MATH is not set.


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.

-- 
Pat



Re: MathJax support in texi2any

2020-10-08 Thread Gavin Smith
On Thu, Oct 08, 2020 at 12:26:28PM -0700, Raymond Toy wrote:
> Does this also mean I can use AMSTeX features in @math?  I guess that also
> means I still need @iftex and @ifhtml versions since tex output only
> understands plain TeX, right?  Still this is a very nice feature!

I couldn't tell you about AMSTeX (or other LaTeX macros) with MathJax, but
it wouldn't work with TeX output unless the macros were defined.



Re: MathJax support in texi2any

2020-10-08 Thread Raymond Toy
On Thu, Oct 8, 2020 at 9:31 AM Gavin Smith  wrote:

> On Thu, Oct 08, 2020 at 08:06:05AM -0700, Raymond Toy wrote:
> > On Wed, Oct 7, 2020 at 12:01 PM Gavin Smith 
> > wrote:
> >
> > > I've implemented basic MathJax support in texi2any in commit
> > > 7ff3cbdc4. To use it, run texi2any as "texi2any --html -c
> > > HTML_MATH=mathjax". Feedback would be appreciated on how well it works
> > > with Texinfo manuals containing math typesetting.
> > >
> >
> > This is really great news!  Maxima's manual has many formulas, but
> they're
> > all wrapped in @ifhtml and @iftex.
> >
> > With this new version, how do I get formulas typeset?  @math?  Something
> > else?
>
> Just use @math with no conditional.
>
> I downloaded maxima 5.44.0 and to build the documentation without building
> the package, I did
>
> texi2any.pl --html maxima.texi --no-validate -c HTML_MATH=mathjax
>
> and this worked.  For example, the file
> maxima/Functions-and-Variables-for-zeilberger.html in the output
> had math displayed OK in most cases if JavaScript is enabled (although
> there
> may be a few problems I need to look at).
>

This is really awesome!  And thanks for testing it out; I'll try myself
soon.

Does this also mean I can use AMSTeX features in @math?  I guess that also
means I still need @iftex and @ifhtml versions since tex output only
understands plain TeX, right?  Still this is a very nice feature!


-- 
Ray


Re: MathJax support in texi2any

2020-10-08 Thread Gavin Smith
On Thu, Oct 08, 2020 at 08:06:05AM -0700, Raymond Toy wrote:
> On Wed, Oct 7, 2020 at 12:01 PM Gavin Smith 
> wrote:
> 
> > I've implemented basic MathJax support in texi2any in commit
> > 7ff3cbdc4. To use it, run texi2any as "texi2any --html -c
> > HTML_MATH=mathjax". Feedback would be appreciated on how well it works
> > with Texinfo manuals containing math typesetting.
> >
> 
> This is really great news!  Maxima's manual has many formulas, but they're
> all wrapped in @ifhtml and @iftex.
> 
> With this new version, how do I get formulas typeset?  @math?  Something
> else?

Just use @math with no conditional.

I downloaded maxima 5.44.0 and to build the documentation without building
the package, I did

texi2any.pl --html maxima.texi --no-validate -c HTML_MATH=mathjax

and this worked.  For example, the file
maxima/Functions-and-Variables-for-zeilberger.html in the output
had math displayed OK in most cases if JavaScript is enabled (although there
may be a few problems I need to look at).



Re: MathJax support in texi2any

2020-10-08 Thread Raymond Toy
On Wed, Oct 7, 2020 at 12:01 PM Gavin Smith 
wrote:

> I've implemented basic MathJax support in texi2any in commit
> 7ff3cbdc4. To use it, run texi2any as "texi2any --html -c
> HTML_MATH=mathjax". Feedback would be appreciated on how well it works
> with Texinfo manuals containing math typesetting.
>

This is really great news!  Maxima's manual has many formulas, but they're
all wrapped in @ifhtml and @iftex.

With this new version, how do I get formulas typeset?  @math?  Something
else?

I can also try this out this weekend.

>
> I think the main concern at the moment is making sure that the source
> code for MathJax is easily accessible from pages that reference it,
> and that users do not need to be dependent on MathJax's hosting.
>
>

-- 
Ray


Re: MathJax support in texi2any

2020-10-07 Thread Christopher Dimech
I could test it in the weekend Gavin.

-
Christopher Dimech
Chief Administrator - Naiad Informatics - GNU Project (Geocomputation)
- Geophysical Simulation
- Geological Subsurface Mapping
- Disaster Preparedness and Mitigation
- Natural Resource Exploration and Production
- Free Software Advocacy


> Sent: Wednesday, October 07, 2020 at 9:00 PM
> From: "Gavin Smith" 
> To: "Texinfo" 
> Cc: "Christopher Dimech" , "Oliver Heimlich" 
> Subject: MathJax support in texi2any
>
> I've implemented basic MathJax support in texi2any in commit
> 7ff3cbdc4. To use it, run texi2any as "texi2any --html -c
> HTML_MATH=mathjax". Feedback would be appreciated on how well it works
> with Texinfo manuals containing math typesetting.
>
> I think the main concern at the moment is making sure that the source
> code for MathJax is easily accessible from pages that reference it,
> and that users do not need to be dependent on MathJax's hosting.
>



MathJax support in texi2any

2020-10-07 Thread Gavin Smith
I've implemented basic MathJax support in texi2any in commit
7ff3cbdc4. To use it, run texi2any as "texi2any --html -c
HTML_MATH=mathjax". Feedback would be appreciated on how well it works
with Texinfo manuals containing math typesetting.

I think the main concern at the moment is making sure that the source
code for MathJax is easily accessible from pages that reference it,
and that users do not need to be dependent on MathJax's hosting.