Re: real subscripts and superscripts?

2014-11-27 Thread Per Bothner



On 11/27/2014 04:13 PM, Karl Berry wrote:

Per and all,

 In TeX inside @math: ^{TEXT}
 In TeX otherwise: use a macro ...

I'm thinking that TeX, either inside or outside @math, should treat TEXT
as text, not math.  That is, if you simply want to produce the math
expression a-to-the-power-of-b, you'd write @math{a^b}, rather than
@math{a@sup{b}}.  The difference is whether b is typeset in math italic
or roman.  After all, sometimes people want to typeset a word in math,
as in @math{a@sup{first}}.

This seems more consistent with the treatment in the other output
formats.  Also, since there's already a way to get math
super/subscripts, but no way to get text super/subscripts, we might as
well provide something new.


Supposed I want to write a formula like e=mc^2 in TexInfo.
In TeX I'd like it to be typeset $e = mc^2$.
In HTML I'd like it to be typeset e = mc2
or similar - i.e. I want to use 2.  Likewise for DocBook and XML.

How would you express this in texinfo?

With your proposal I'd have to write something like:
@iftex
@math{e=mc^2}
@end iftex
@ifnottex
@math{e=mc@sup{2}}
@end ifnottex

This is painful, though I guess you could write a macro:

@iftex
@macro mathsup{THING}
^\THING\
@end macro
@end iftex
@ifnottec
@macro mathsup{THING}
@sup{\THING\|
@end macro
@end ifnottex

It seems kind of klunky.  I suspect most of the time if you have @sup{TEXT}
TEXT is a single number, symbol, or lesser, so you'd probably want it to
be in math italic.

For the rare cases where you *don't* want math italic, an idea is to use @asis.
I.e. @sup{@asis{TEXT}} means typeset TEXT raised and smaller but in a roman 
font.

OTOH for most people it won't really matter is TEXT is math italic or roman.
What they want is to be able to write @sup{TEXT} and have it come out
as a superscript and not looking to weird.

It just seems to be that @sup{TEXT} inside @math using math italic is more
likely to be what you want - most of the time.  It seems a more robust default.
People who don't want math italic formatting would probably not use @math.
Or use @asis to override mathe styling.
--
--Per Bothner
p...@bothner.com   http://per.bothner.com/



Re: real subscripts and superscripts?

2014-11-27 Thread Karl Berry
Per and all,

In TeX inside @math: ^{TEXT}
In TeX otherwise: use a macro ...

I'm thinking that TeX, either inside or outside @math, should treat TEXT
as text, not math.  That is, if you simply want to produce the math
expression a-to-the-power-of-b, you'd write @math{a^b}, rather than
@math{a@sup{b}}.  The difference is whether b is typeset in math italic
or roman.  After all, sometimes people want to typeset a word in math,
as in @math{a@sup{first}}.

This seems more consistent with the treatment in the other output
formats.  Also, since there's already a way to get math
super/subscripts, but no way to get text super/subscripts, we might as
well provide something new.

Unless there's an argument otherwise?

(FYI, Patrice has already implemented @sub and @sup per your suggestion
+ discussion in texi2any.)

Thanks,
Karl