Oh Bob, you are too fast for me...
That <sup> way sounds easy and good.

OK, now with my trick. I looked up some Unicode characters for the scripted 
numbers. 
Last time I did this, I was searching for several arrows, some work, some not. 
But the 
subscripts and superscripts all work OK. Codes are below.

Instead of directly coding the chars (which also works), I engineered a little 
bit to have 
some reusable solution:

function JmolLabelSuperscript(n)
{       if (n==0 || n>3) { return '\\u207' + n }
        if (n==1) { return '\\u00B9' }
        return '\\u00B' + n 
}
function JmolLabelSubscript(n)
{       return '\\u208' + n 
}

and then:
jmolButton('font label 24 serif; select atomno=3; label "Ca' + 
JmolLabelSubscript(3) + '(' 
+ JmolLabelSuperscript(3) + JmolLabelSuperscript(3) + 'PO' + 
JmolLabelSubscript(4) 
+ ')'+ JmolLabelSubscript(2) +'"', 'symbols in label')

Oh, now I see that superscripted 1, 2 and 3 are smaller than the others (they 
come 
from a separate CharCode table)

/*
        \u2070 = superscript 0
        \u00B9 = superscript 1
        \u00B2 = superscript 2
        \u00B3 = superscript 3
        \u2074 = superscript 4
        \u2075 = superscript 5
up to 
        \u2079 = superscript 9

        \u2080 = subscript 0
up to 
        \u2089 = subscript 9
*/

I will post this in JmolWiki, Recycling Corner, so that all of us can find it 
in the future.



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to