Re: [XeTeX] Combined sub- and superscript - solved

2010-08-08 Thread Sebastian Gerecke
Am Sonntag 08 August 2010, 05:23:27 schrieb Michael Lynch:
> On 07/08/2010 23:32, Ross Moore wrote:
> > Hi Peter, Sebastien,
> > 
> > On 08/08/2010, at 7:33 AM, Peter Dyballa
> > 
> > wrote:
> >> Am 07.08.2010 um 22:44 schrieb Sebastian Gerecke:
> >>> BUT: This just has to be an utter hack and I can not believe it
> >>> is the way it is supposed to be done.
> >> 
> >> This hack is necessary because mhchem is not aware of font
> >> features, it's a simple LaTeX package that maltreats simple TeX
> >> fonts in the usual ways.
> >> 
> >>> I'm putting the scientific inferior numbers in the upper
> >>> position, and the scientific superiors in the lower position.
> >>> Does that make sense to anyone?
> > 
> > The usual LaTeX way to do this would be to use the \sideset command
> > from AMSMath, that is with \usepackage{amsmath}.
> > 
> > But this would be placing the usual ASCII numerals, and not using the
> > Unicode inferior and superior numerals. Those characters are very new
> > to the TeX world. A Google search brings up only a few mentions of
> > them on Microsoft pages. Thus you are not likely to find a good
> > solution having easy syntax, until someone writes a macro specially
> > for it, for use with XeTeX and other Unicode-aware TeX processing.
> > 
> > If I've understood this correctly, you want the positioning of
> > \sideset with the characters being the Unicode superiors and
> > inferiors, which are full-sized glyphs. Furthermore, the input syntax
> > should be intuitive, allowing use of either ASCII numerals or the
> > Unicode points directly, for maximum flexibility.
> > 
> > Should such support be in the unicode-math package? Probably not, as
> > super-/subscripts in math usually have the usual numerical meaning,
> > so it would be wrong to use separate characters, just for a purely
> > visual effect.
> > 
> > Is a chemist going to learn about Unicode and XeTeX just to typeset
> > isotope names correctly? We could be so lucky!
> > 
> > However maybe if someone on this list develops such a macro, it could
> > go into xltxtra.sty .
> > 
> >> Well, otherwise it would look much worse...
> > 
> > Indeed.
> > 
> >> -- Mit friedvollen Grüßen
> >> 
> >> Pete
> > 
> > Hope this helps,
> > 
> > Ross
> > 
> Hello all,
> 
> I don't know anything about \sideset, but does this do what's needed?
> 
> \newlength{\atomicwidth}
> \DeclareRobustCommand{\elem}[3]{%
>   \settowidth{\atomicwidth}{\textsubscript{#2}}%
>   \textsuperscript{#1}\hspace{-\atomicwidth}\textsubscript{#2}#3
> }
> 
> \elem{14}{6}{C}
> 
> (I've attached an example file demonstrating it.)
> 
> This seems to produce the desired output, is easy to use, and has the
> advantage of playing equally nicely with fonts that don't have the
> required features.
> 
> Mike

Hello Mike,

thanks for your code -- it works perfectly :-)
Much better actually than my own solution which is having a problem with 
different font sizes.

This really solves my problem. Thanks to everyone your help and attention.

Cheers
Sebastian



--
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex


Re: [XeTeX] Combined sub- and superscript - solved

2010-08-08 Thread Sebastian Gerecke
Am Sonntag 08 August 2010, 00:32:59 schrieb Ross Moore:
> Hi Peter, Sebastien,
> 
> On 08/08/2010, at 7:33 AM, Peter Dyballa  wrote:
> > Am 07.08.2010 um 22:44 schrieb Sebastian Gerecke:
> >> BUT: This just has to be an utter hack and I can not believe it is the
> >> way it is supposed to be done.
> > 
> > This hack is necessary because mhchem is not aware of font features, it's
> > a simple LaTeX package that maltreats simple TeX fonts in the usual
> > ways.
> > 
> >> I'm putting the scientific inferior numbers in the upper position, and
> >> the scientific superiors in the lower position. Does that make sense to
> >> anyone?
> 
> The usual LaTeX way to do this would be to use the \sideset command from
> AMSMath, that is with \usepackage{amsmath}.
> 
> But this would be placing the usual ASCII numerals, and not using the
> Unicode inferior and superior numerals. Those characters are very new to
> the TeX world. A Google search brings up only a few mentions of them on
> Microsoft pages. Thus you are not likely to find a good solution having
> easy syntax, until someone writes a macro specially for it, for use with
> XeTeX and other Unicode-aware TeX processing.
> 
> If I've understood this correctly, you want the positioning of \sideset
> with the characters being the Unicode superiors and inferiors, which are
> full-sized glyphs. Furthermore, the input syntax should be intuitive,
> allowing use of either ASCII numerals or the Unicode points directly, for
> maximum flexibility.

That is exactly what I want, yes.
The Libertine webpage promotes the sub/superscipt feature and explicitly gives 
the example of chemical formulars. That is why I thougt it would be easy to 
use that feature.


> 
> Should such support be in the unicode-math package?
> Probably not, as super-/subscripts in math usually have the usual numerical
> meaning, so it would be wrong to use separate characters, just for a
> purely visual effect.
> 
> Is a chemist going to learn about Unicode and XeTeX just to typeset isotope
> names correctly? We could be so lucky!
> 
> However maybe if someone on this list develops such a macro, it could go
> into xltxtra.sty .

The macro Mike has written works really well for me. Perhaps that could be 
included somewhere?

> 
> > Well, otherwise it would look much worse...
> 
>Indeed.
> 
> > --
> > Mit friedvollen Grüßen
> > 
> >  Pete
> 
> Hope this helps,
> 
>   Ross
> 
> 
> --
> Subscriptions, Archive, and List information, etc.:
>   http://tug.org/mailman/listinfo/xetex




--
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex


Re: [XeTeX] Combined sub- and superscript - solved

2010-08-08 Thread Khaled Hosny
On Sun, Aug 08, 2010 at 08:32:59AM +1000, Ross Moore wrote:
> 
> Hi Peter, Sebastien,
> 
> On 08/08/2010, at 7:33 AM, Peter Dyballa  wrote:
> 
> > 
> > Am 07.08.2010 um 22:44 schrieb Sebastian Gerecke:
> > 
> >> BUT: This just has to be an utter hack and I can not believe it is the way 
> >> it
> >> is supposed to be done.
> > 
> > This hack is necessary because mhchem is not aware of font features, it's a 
> > simple LaTeX package that maltreats simple TeX fonts in the usual ways.
> > 
> >> I'm putting the scientific inferior numbers in the upper position, and the
> >> scientific superiors in the lower position. Does that make sense to anyone?
> 
> 
> The usual LaTeX way to do this would be to use the \sideset command from 
> AMSMath, that is with \usepackage{amsmath}.
> 
> But this would be placing the usual ASCII numerals, and not using the Unicode 
> inferior and superior numerals. Those characters are very new to the TeX 
> world. A Google search brings up only a few mentions of them on Microsoft 
> pages. Thus you are not likely to find a good solution having easy syntax, 
> until someone writes a macro specially for it, for use with XeTeX and other 
> Unicode-aware TeX processing.
> 

Actually, the OpenType features he is using, map ASCII numbers to
special glyphs designed for subscript/superscript, but unlike TeX's
optical sizes, those glyphs are scaled and raised/lowered to give the
desired size and position, and thus can't be used with normal TeX
super/subscript mechanisms. May be Will Robertson can extend his new
realscripts package to handle such situations as well, if it does not
already since I didn't test it.

Regards,
 Khaled

-- 
 Khaled Hosny
 Arabic localiser and member of Arabeyes.org team
 Free font developer


--
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex