Using Superscript and Subscript in Fields
Paul Charlesworth
pcharles at chartermi.net
Fri Jun 6 23:14:01 EDT 2003
Thanks for posting the application, but it didn't seem to work on my
PowerBook with RR-2 and led to repeated force-quits even when I made a
build, I am not sure what is wrong at this point.
What I have found so far with messing is that to create the electron
configurations I would need to code something like this:
[Ne]2<i>s</i><small><sup> 2</sup></small> 2<i>p</i><small><sup>
2</sup></small> and so on,
The space before the 2 in "<sup> 2</sup>" is needed to prevent the
italicized "s" from interfering with the superscripted number. I then
write it in to the field as described in the dictionary using the set
htmltext command. It looks great, but I will probably need a large
bottle of something if I have to code 100 elements in this manner. It
can be done with a lot of copying and pasting, but the scope for error
is huge. The interesting thing is that once you have been through one
period, then it is just a matter of duplicating the period and
adjusting the numbers:
[Ar]3<i>s</i><small><sup> 2</sup></small> 3<i>p</i><small><sup>
2</sup></small> and so on,
I might try and adapt Jim's scripts, but it would take me longer than
just coding them by hand, even though it would be a good learning
exercise. What I think the script needs to do is:
1. Look for the letters s, p, d, f, g, or h that follow a number,
select that letter and enclose it in <i></i>. I assume this needs some
kind of search and replace loop until all are done.
2. look for a number that immediately follows the s, p, d, f, g, or h
and select that number. The number would then need to have a space
placed in front of it and the two enclosed with
<small><sup></sup></small>. Again, using a repeat loop.
The problem is preventing the search and replace from picking up the
next number which should remain as normal text. 1s^2 2s^2 2p^6 and so
on. By placing a space between each subshell configuration I think it
would work.
Now I just need to figure it out. I actually wonder if an applescript
would work? How hard can it be to learn two separate languages in one
weekend?
Paul
On Friday, Jun 6, 2003, at 05:50 America/Detroit, Jim Hurley wrote:
>>
>> --__--__--
>>
>> Message: 4
>> Date: Thu, 5 Jun 2003 00:12:56 -0400
>> Subject: Using Superscript and Subscript in Fields
>> From: Paul Charlesworth <pcharles at chartermi.net>
>> To: use-revolution at lists.runrev.com
>> Reply-To: use-revolution at lists.runrev.com
>>
>> Hello All:
>>
>> I would like to represent the electron configuration of elements using
>> superscript and subscripts and would like to know what the best
>> approach my be. So far, I have the following approach working, but the
>> superscripted text is not a smaller font size as it should be:
>
>
> Superscripting and subscripting of text is something I use regularly.
> And so I have written a parser which takes text in one field, using
> the carrot to denote a superscript and tilde to denote a subscript and
> formats this text in another field.
>
> For example, the equation:
>
> x^2 + y^2 = z^2
>
> would be formatted with the squares as superscripts, reduced in font
> size. You can use a combo such as x^1~2 which would format as x super
> 1 sub 2.
>
> I have put the stack on my web site (control-click to download)
> http://home.infostations.net/jhurley/
>
> There are two situations I haven't worked out.
>
> The program need to recognize a delimiter to denote the end of the
> sub/superscript. Such common delimiter area: comma, period, and space.
> (In the above equation, a space appears after each superscript,
> *except* the last--end of line.
>
> But I haven't been able to include "return" or just the end of the
> field. Anyone????
>
> The line that needs fixing is:
>
> repeat until char tNum+1+j of field 1 is in quote & " " & "," & "." &
> quote then
>
> How do I get a "return" and end of field into this--between the quote
> pair?
>
> Jim
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list