[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [help-texinfo] Mathematical Fractions
From: |
Gavin Smith |
Subject: |
Re: [help-texinfo] Mathematical Fractions |
Date: |
Tue, 14 Feb 2017 19:17:36 +0000 |
On 13 February 2017 at 16:27, Julio Iglesias <address@hidden> 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 address@hidden
@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.