[tex4ht] [bug #488] \over does not give the same result as equivalent \frac

2020-10-26 Thread Michal Hoftich
Follow-up Comment #1, bug #488 (project tex4ht):

The simplest thing you can do is to convert your whole inline math to image,
using for example:

httex filename "xhtml,html5,pic-m"

Also, it works in MathML:

htttex filename "xhtml,html5,mathml,mathjax"

As it works in MathML, it is obvious that it is possible to configure \over to
produce sensible output in plain HTML. Here is a sample HTML document:

\documentclass{article}
\begin{document}
${a+2 \over b} $

$  1 + \begingroup a \over b \endgroup + 2$

$  1 + \bgroup a \over b \egroup + 2$

$  1 + { a \over b \egroup + 2$


$  1 + \bgroup a \over b } + 2$
\end{document}


And here is a config file:


\Preamble{xhtml}
\catcode`\:=11
\def\IgnoreRule{\ht:special{t4ht@\string_}}
\def\EndIgnoreRule{\ht:special{t4ht@\string_\string_}}

\Configure{over}
   {\Send{GROUP}{0}{}\IgnoreRule\HCode{}}
   {\HCode{}\EndIgnoreRule\Send{EndGROUP}{0}{}}

\Css{
.fraction {
  display: inline-flex;
  flex-direction: column;
  padding: 0 2px;
  align-items: center;
  font-size:130\%;
}}
\Css{.top {
  border-bottom: 2px solid grey;
}}

\Configure{$}{\DviMath}{\EndDviMath}{}
\catcode`\:=12
\begin{document}
\EndPreamble


It uses CSS flex box to render fractions. 

I don't really understand how \Send command works, as it is not really
documented anywhere in TeX4ht sources. But it can be used in these cases to
insert HTML code at beginning and end of the current group. It works only in
\DviMath mode, which is why the following configuration is necessary:

\Configure{$}{\DviMath}{\EndDviMath}{}

I don't know if it will have any side effects on other math configurations,
hopefully not.

Compile the example using 

make4ht -c config.cfg sample.tex


___

Reply to this item at:

  

___
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/



Re: [tex4ht] [bug #488] \over does not give the same result as equivalent \frac

2020-10-26 Thread William F Hammond
Patrice, Karl, and all:

LaTeX math and plain TeX math are different.  I'm inclined to think that
there is a clear language standard for MathJax although I do not know if
there is full documentation for it.  All I know is that when I cross the
line MathJax catches it.

I think that the MathJax standard makes sense for Texinfo if one is to
continue to allow "TeX math" in Texinfo's @math.  But that is hybrid
markup, and, moreover, it breaks the syntactic rigor of Texinfo, which is a
shame.  Before one would want to think seriously about clean math for
Texinfo, one would want to know if Texinfo has full support for UTF-8.  If
so, then one would not need to spend time on things like \alpha.

Is there experience processing Texinfo documents with xetex?

   -- Bill



On Mon, Oct 26, 2020 at 2:23 PM Karl Berry  wrote:

> > you shouldn't use \over with latex. With amsmath you would also get a
>
> \over is supported in LaTeX, to the best of my knowledge (despite all
> the ensuing parsing pain). There is no warning without amsmath, and the
> output is correct.
>
> And that's good, because surely millions of LaTeX documents use it. -k
>


Re: [tex4ht] [bug #488] \over does not give the same result as equivalent \frac

2020-10-26 Thread Ulrike Fischer


> > you shouldn't use \over with latex. With amsmath you would also get a

> \over is supported in LaTeX, to the best of my knowledge (despite all
> the ensuing parsing pain). There is no warning without amsmath, and the
> output is correct.

> And that's good, because surely millions of LaTeX documents use it. -k

sure, \over works in latex and tex. But this is no longer enough in a
world where sources should be output to more than one format.
As the question here shows, the \over syntax is
difficult for converters.

See also https://tex.stackexchange.com/a/365332/2388

Ulrike



Re: [tex4ht] [bug #488] \over does not give the same result as equivalent \frac

2020-10-26 Thread Karl Berry
> you shouldn't use \over with latex. With amsmath you would also get a

\over is supported in LaTeX, to the best of my knowledge (despite all
the ensuing parsing pain). There is no warning without amsmath, and the
output is correct.

And that's good, because surely millions of LaTeX documents use it. -k


Re: [tex4ht] [bug #488] \over does not give the same result as equivalent \frac

2020-10-26 Thread Patrice Dumas
On Mon, Oct 26, 2020 at 08:15:13PM +0100, Ulrike Fischer wrote:
> > Details:
> 
> > {a \over b} does not give the same output as \frac{a}{b}, processed by 
> > htlatex
> 
> you shouldn't use \over with latex. With amsmath you would also get a
> warning
> 
> Package amsmath Warning: Foreign command \over;
> (amsmath)\frac or \genfrac should be used instead
> (amsmath) on input line 16.

It is actually in plain TeX, but htlatex needs to be used to have a
reference output with the equivalent \frac, to give a better idea of the
output that should be produced by tex4ht with httex.  Also, even if
there is a warning, the output is exactly the same with LaTeX and it
allows to have a code that works both in TeX and in LaTeX which may be
desirable in some cases.  I may be wrong, but my first idea would be
that it is better if tex4ht does the same and the right thing both for
TeX and LaTeX for constructs that exist in both, even if there is a
warning in LaTeX.

-- 
Pat 


Re: [tex4ht] [bug #488] \over does not give the same result as equivalent \frac

2020-10-26 Thread Ulrike Fischer
> Details:

> {a \over b} does not give the same output as \frac{a}{b}, processed by htlatex

you shouldn't use \over with latex. With amsmath you would also get a
warning

Package amsmath Warning: Foreign command \over;
(amsmath)\frac or \genfrac should be used instead
(amsmath) on input line 16.


-- 
Mit freundlichen Grüßen
Ulrike Fischer




[tex4ht] [bug #488] \over does not give the same result as equivalent \frac

2020-10-26 Thread Patrice Dumas
URL:
  

 Summary: \over does not give the same result as equivalent
\frac
 Project: tex4ht
Submitted by: pertusus
Submitted on: Mon 26 Oct 2020 09:08:38 PM EET
Category: None
Priority: 5 - Normal
Severity: 3 - Minor
  Status: None
 Privacy: Public
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any

___

Details:

{a \over b} does not give the same output as \frac{a}{b}, processed by htlatex
(or httex, though there is no real comparison possible as \frac is not
available in plain TeX), in inline math, like ${a \over b}$. \frac is
formatted as an image, ${a \over b}$ becomes 
a_ b 

which corresponds actually to html code 

a_
b

In displaymath $$ the results is the same with \over and \frac, with images in
both cases.



___

File Attachments:


---
Date: Mon 26 Oct 2020 09:08:38 PM EET  Name: t.tex  Size: 130B   By: pertusus
example file


___

Reply to this item at:

  

___
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/


Re: [tex4ht] issue with raw html output with httex

2020-10-26 Thread Patrice Dumas
Hello,

On Mon, Oct 26, 2020 at 01:57:43AM -0700, William F Hammond wrote:
> It's always easier to look at an example.
> 
> I've played with it a bit and used "makeinfo", then manually linked to
> MathJax.  That is,
> 
>   makeinfo  -- html  -o foo  foo.texi
> 
> Modified texinfo source attached.

Ok.  Indeed, we can always use TeX/LaTeX only in math.  The reason why
we may be interested in using @-commands is for the output to other
formats which do not have images nor free placement of the text.  The
main format concerned is Info, which can be read on a terminal.

> Maybe Karl can create a mathjax option to makeinfo.  

The Texinfo maintainer is now Gavin Smith, and he actually implemented a
MathJax option for math rendering in the HTML output recently, very
similar to what you propose.  It is only available in the development
version, not in any release for now.  It gives nice results but also has
some disavantages, such as relying on a dynamic code, or not offering
offline browsing, which is not the case when using tex4ht or latex2html.

> It looks to me as if
> the math in HTML is now being written to work in a terminal window browser
> using pseudo-TeX.

As I said above, it partly is.  We indeed want to produce, from Texinfo,
content suitable for reading on a terminal through the Info format, but
also books, as well as HTML (and other).  The constraints and capacities
of those different formats are quite different.  Mixing @-commands and
TeX/LaTeX format is a kind of compromise for the formats.

The documentation of the previous release gives a description:
https://www.gnu.org/software/texinfo/manual/texinfo/html_node/Inserting-Math.html

However, now that we are moving towards proper expansion of TeX/LaTeX
math in HTML, using either tex4ht, mathjax or latex2html, we will change
the documentations, and the recommendation to be more like what you
propose, that is consistently use TeX/LaTeX in @math and in the new
@-command @displaymath, and use httex for @math expansion in the tex4ht
case too, in the default case.

-- 
Pat


Re: [tex4ht] issue with raw html output with httex

2020-10-26 Thread William F Hammond
It's always easier to look at an example.

I've played with it a bit and used "makeinfo", then manually linked to
MathJax.  That is,

  makeinfo  -- html  -o foo  foo.texi

Modified texinfo source attached.   See comments in the source.  The HTML
output will need straightforward post processing.

Maybe Karl can create a mathjax option to makeinfo.  It looks to me as if
the math in HTML is now being written to work in a terminal window browser
using pseudo-TeX.

Good luck.

-- Bill



On Sun, Oct 25, 2020 at 3:19 PM Patrice Dumas  wrote:

> . . .
>
> Here it is.  It is a somewhat artificial example as it is what is used
> to test tex4ht and latex2html conversion of @tex and @math to html in
> the testsuite, it is not a real manual example.
>
> --
> Pat
>


texi_math.texi
Description: Binary data