I would like to express a superscript and a subscript in the same vertical space. For example, consider a variable called X with a subscript 1 that is squared.

I have searched for examples of what I want to do but cannot find anything close.

X<sub>1</sub><sup>2</sup>

The above is the best I can do, but I want the 1 and the 2 aligned vertically.

Does anyone know if this is possible and, if so, how to do it?

Thanks in advance.

PS: Word processors call this overstrike, but most search hits treat overstrikes as strike throughs.

You can use CSS to move the second one to the left:

<style>
sup {margin-left: -5px;} // or whatever suits
</style>

Thank you very much, Hericles. Your suggestion worked perfectly!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.