Using Superscript and Subscript in Fields

Jim Hurley jhurley at infostations.com
Mon Jun 9 08:10:21 EDT 2003


>
>Message: 10
>Date: Fri, 6 Jun 2003 19:01:07 -0600
>Subject: Re: Using Superscript and Subscript in Fields
>From: Dar Scott <dsc at swcp.com>
>To: use-revolution at lists.runrev.com
>Reply-To: use-revolution at lists.runrev.com
>
>
>On Friday, June 6, 2003, at 03:50 AM, Jim Hurley wrote:
>
>>  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?
>
>put " ,." & return into endingChars
>repeat until (char tNum+1+j of field 1 is in endingChars) \
>             or (char tNum+1+j of field 1 is empty)
>
>Or something like that?
>
>Dar
>


Thanks Dar. That is perfect! So simple.

Jim



>--__--__--
>
>Message: 11
>Date: Sat, 7 Jun 2003 00:05:28 -0400
>Subject: Re: 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
>
>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:

Paul,

I'm really sorry about  your crashes. I can't imagine what the 
problem is. I haven't tested this script thoroughly. I too am using a 
PowerBook (G4 OS 9.2) and have found RR 2.0 quite stable.

I have modified the stack just a bit, incorporating Dar Scott's very 
helpful suggestion.

(http://home.infostations.net/jhurley/ )

It also now includes a field which shows the HTML text. For example 
for the text as written:

 From the Pythagorean theorem we know that x^2 + y^2 = z^2.
The coordinate axes are x~1, x~2 and  x~3.
z^123 z~124
x^1~2.
x^34 + x^2.

This translated to the following HTML output and is shown in a second field:

<p>From the  Pythagorean theorem we know that x <font 
size="8"><sup>2</sup></font> + y<font size="8"><sup>2</sup></font> = 
z<font size="8"><sup>2</sup></font>.</p>
<p>The coordinate axes are x<font size="8"><sub>1</sub></font>, 
x<font size="8"><sub>2</sub></font> and  x<font 
size="8"><sub>3</sub></font>.</p>
<p>z<font size="8"><sup>123</sup></font> z<font 
size="8"><sub>124</sub></font> </p>
<p>x<font size="8"><sup>1</sup><sub>2</sub></font>.</p>
<p>x<font size="8"><sup>34</sup></font> + x<font 
size="8"><sup>2</sup></font>.</p>

And of course you also get the formatted product in a third field 
which I can't show here.

To get the space before the super 2 in x^2 you would simply type x ^2.

Let me know how this new version works. Perhaps you could use this or 
some modification thereof to deal with the bulk of the HTML super and 
subscripting and then tweak the resulting HTML text. As you can see, 
it would save a lot of laborious typing.

Jim




More information about the use-livecode mailing list