Superscrip with NSStrings and stuff

Ok, so I've got a program that does nuclear reaction calculations and stuff. As part of the interface I display the current reaction, such as, 19O(2H,1H)20O. I would really really like to be able to superscript the 19, 2, 1, and 20. To that end I've just finished reading Apple's NSAttributedString Programming Guide, and I can confidently say that I learned nothing from it. But it's got me wondering, are there any LaTeX libraries around that would let me make use of the clear, well defined formatting rules of LaTeX? If not, can someone PLEASE shed some light on this whole attributed strings nonsense? Maybe some sample code?

Thanks,

Paul

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

hi- You probably don't want

hi-

You probably don't want NSAttributedString. What I suspect you want is NSMutableString and then load it up with the UNICODE characters you need. For example: unicode superscript 9 is unicode number 00002079 or in UTF8: E281B9. NSMutableString is a wrapper for unicode characters and unicode has super and subscripts characters. Then insert the string you make into something like a NSTextView (or UILabel) for display. You can also use HTML sup and sub tags and a WebView to load in HTML if you want but I suspect that you simply want a single line of text. If you need attributes not defined in unicode then you have to resort to a some NSAttributedString attributions. You can also handle all the character positioning yourself if you want, there is nothing to prevent you from positioning characters at arbitrary locations and drawing them.

thanks!-

-lance