bug-texinfo
[Top][All Lists]
Advanced

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

Re: behavior of @math with HTML output


From: Patrice Dumas
Subject: Re: behavior of @math with HTML output
Date: Wed, 12 Oct 2022 21:23:25 +0200

On Wed, Oct 12, 2022 at 11:34:45AM +0200, Vincent Lefevre wrote:
> > 
> > There are now other options for math formatting in HTML, but they are
> > suitable for TeX/LaTeX math, not much for text describing math.  If I
> > understand well your need, I think that using CSS to change how @math is
> > formatted is probably the best with --css-include.  And probably
> > something like
> > 
> > em.math { font-family:inherit }
> > 
> > It is possible that in 6.8 there is no math class, but in the upcoming
> > release there is.
> 
> With 6.8, I can see, for instance in the generated MPFR manual:
> 
>   <em class='math'><var>d</var> times 2 raised to <var>exp</var></em>
> 
> However, the CSS solution won't work with lynx. There is no italic in
> this case, but the text is still emphasized (with a different color),
> which is rather disturbing.

Another option which does not use CSS is to do an init file to replace
the function formatting @math.  The following code in the init file
should return the argument without formatting if HTML_MATH is not
mathjax:


sub my_convert_math_command$$$$)
{               
  my $self = shift;
  my $cmdname = shift;
  my $command = shift;
  my $args = shift;
  
  my $arg = $args->[0]->{'normal'};
  
  my $math_type = $self->get_conf('HTML_MATH');
  if ($math_type and $math_type eq 'mathjax') {
    $self->register_file_information('mathjax', 1);
    return $self->html_attribute_class('em', [$cmdname, 'tex2jax_process'])
                                          .">\\($arg\\)</em>";
  }
  #return $self->html_attribute_class('em', [$cmdname]).">$arg</em>";
  return $arg;
}


texinfo_register_command_formatting('math', \&my_convert_math_command);

1;


-- 
Pat



reply via email to

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