On 13 February 2017 at 16:27, Julio Iglesias <[email protected]> wrote:
> How can I include mathematical fractions in texinfo?

Dear Julio, thank you for writing. Unfortunately, there is no easy way
in Texinfo to specify a mathematical fraction that will work in all
output formats. If you are only interested in printed output (that is,
PDF or DVI), you can use the @math command, e.g.:

a divided by b is written as @math{a \over b}.

If you want to support other output formats such as HTML or Info, you
have to specify the output for each individually.

I came up with the following:

@macro Frac{a,b}
@inlinefmtifelse{tex, @math{\a\ @over \b\}, \a\ / \b\}
@end macro

c divided by d is written as @Frac{c,d}.

Unfortunately, this may not work for some Texinfo versions. In Texinfo
6.1 an error message is reported "unknown command `over' (possibly
involving @Frac)". You would think that you would replace @over with
\\over (two backslashes because it is inside @macro), but this does
not work either for PDF output at present.

The following may work better

@macro Frac{a,b}
@iftex
@math{\a\ \\over \b\}
@end iftex
@ifnottex
\a\ / \b\
@end ifnottex@c

@end macro

c divided by d is written as @Frac{c,d}.

except for a warning "warning: @iftex should only appear at the
beginning of a line (possibly involving @Frac)" that you may get with
texi2any.

Some people have said that they would like to see better support of
mathematical notation in Texinfo for output formats like HTML, and I
think that would be great to have, if someone can work out the
complications involved.

Reply via email to