superscript

How do I write superscript word for checkbox text in java?

允我心安 提交于 2019-11-28 14:11:37
I made few checkboxes using swing in Java. I want to write a superscript text for the checkboxes but I'm not sure how. The code currently looks like this. JCheckBox hCheckBox = new JCheckBox("[M + H]+"); I want to have "+" sign inside the JCheckBox parameter superscripted. What's an easy way to do this? Thank you in advance. Java buttons support html in their text. You need to format the string a little differently though. Try this: JCheckBox hCheckBox = new JCheckBox("<html>[M + H]<sup>+</sup></html>"); package infonode; /** * * @author Deepak */ import java.awt.*; import java.awt.event.*;

How to create vertically aligned superscript and subscript in TextView

橙三吉。 提交于 2019-11-28 06:57:32
In the example of image below: How can I make both the superscript and subscript numbers to be aligned to produce a common scientific notation like below in TextView ? If there is a way using Spannable or ReplacementSpan I would like to see a working example. Thank you. You might want to try something like this. It's basicall a ReplacementSpan that takes the text it's applied on, separates it into two parts, and draws them on the canvas. The size factor and y translation are somewhat hand-picked. I hope it's useful (or at least that you or someone else can build on it). public class

Adding superscript <sup> tags around all trademark and registered trademark symbols

这一生的挚爱 提交于 2019-11-28 06:03:51
I am trying to add <sup></sup> tags around every ™, ®, © in my page. I found this question: CSS superscript registration trademark which helped get me started. The script works in the sense that the tags are being placed in the proper locations, but it is adding two <sup></sup> tags around each instead of just one. Here is my JS adding the tags: jQuery("body").html( jQuery("body").html().replace(/®/gi, '<sup>®</sup>').replace(/®/gi, '<sup>®</sup>'). replace(/™/gi, '<sup>™</sup>'). replace(/™/gi, '<sup>™</sup>'). replace(/©/gi, '<sup>©</sup>'). replace(/©/gi, '<sup>©</sup>') ); How can I make

Special characters and superscripts on plot axis titles

被刻印的时光 ゝ 提交于 2019-11-28 04:06:49
I am trying to make a y-axis title with both a special character and a superscript. I am able to do this, but I want the closing parentheses not to be superscripted. And that's what I'm having a problem with. I think its just a placing of my parenthesis, but I've tried (seemingly) everything. plot(WatexCl, ConcuM, col = as.numeric(1), pch = as.numeric(Depth), xlab = expression(paste("Concentration Cl ( ", mu, "moles/g dry wt)")), ylab = expression(paste("Average Conc of S- on plates ( ", mu, "Moles/cm"^"2"),)), data = plates) The one thing that often users fail to grasp is that you invariably

HTML <sup /> tag affecting line height, how to make it consistent?

匆匆过客 提交于 2019-11-28 02:51:18
If I have a <sup> tag in a multi-line <p> tag, the line with the superscript on it has a larger line spacing above it than the other lines, irregardless of what line-height I put on the <p> . Edit for clarification : I don't mean i have lots of <p> s, each which is on a single line. I have a single <p> with enough content in it to cause wrapping onto multiple lines. Somewhere (anywhere) in the text there may be a <sup> or <sub> . This affects the line height for that line by adding extra spacing above/below. If I set a larger line-height on the <p> this makes no difference to the problem. The

How to create vertically aligned superscript and subscript in TextView

旧时模样 提交于 2019-11-27 01:38:12
问题 In the example of image below: How can I make both the superscript and subscript numbers to be aligned to produce a common scientific notation like below in TextView ? If there is a way using Spannable or ReplacementSpan I would like to see a working example. Thank you. 回答1: You might want to try something like this. It's basicall a ReplacementSpan that takes the text it's applied on, separates it into two parts, and draws them on the canvas. The size factor and y translation are somewhat

Special characters and superscripts on plot axis titles

烈酒焚心 提交于 2019-11-27 00:17:09
问题 I am trying to make a y-axis title with both a special character and a superscript. I am able to do this, but I want the closing parentheses not to be superscripted. And that's what I'm having a problem with. I think its just a placing of my parenthesis, but I've tried (seemingly) everything. plot(WatexCl, ConcuM, col = as.numeric(1), pch = as.numeric(Depth), xlab = expression(paste("Concentration Cl ( ", mu, "moles/g dry wt)")), ylab = expression(paste("Average Conc of S- on plates ( ", mu,

HTML <sup /> tag affecting line height, how to make it consistent?

不问归期 提交于 2019-11-26 23:55:10
问题 If I have a <sup> tag in a multi-line <p> tag, the line with the superscript on it has a larger line spacing above it than the other lines, irregardless of what line-height I put on the <p> . Edit for clarification : I don't mean i have lots of <p> s, each which is on a single line. I have a single <p> with enough content in it to cause wrapping onto multiple lines. Somewhere (anywhere) in the text there may be a <sup> or <sub> . This affects the line height for that line by adding extra

Set superscript and subscript in formatted text in wpf

瘦欲@ 提交于 2019-11-26 22:38:22
How can I set some text as subscript/superscript in FormattedText in WPF? You use Typography.Variants : <TextBlock> <Run>Normal Text</Run> <Run Typography.Variants="Superscript">Superscript Text</Run> <Run Typography.Variants="Subscript">Subscript Text</Run> </TextBlock> You can use something like <TextBlock>5x<Run BaselineAlignment="Superscript">4</Run> + 4</TextBlock> . However, as far as I know, you will have to reduce the font-size yourself. I used a layout transform, because Typography.Variants often doesn't work: <TextBlock Text="MyAmazingProduct"/> <TextBlock Text="TM"> <TextBlock

Regex to replace all superscript numbers

落爺英雄遲暮 提交于 2019-11-26 22:07:18
问题 I'm struggling to figure out a reasonable solution to this. I need to replace the following characters: ⁰¹²³⁴⁵⁶⁷⁸⁹ using a regex replace. I would think that you would just do this: item = item.replace(/[⁰¹²³⁴⁵⁶⁷⁸⁹]/g, ''); However, when I try to do that, notepad++ converts symbols 5-9 into regular script numbers. I realize this probably relates to the encoding format I am using, which I see is set to ANSI. I've never really understood the difference between the various encoding formats. But I