user267817
user267817

Reputation:

How to write superscript / upper index in Visual Studio?

It is possible, but I don't know how is it done.

enter image description here

Upvotes: 33

Views: 49592

Answers (9)

minTwin
minTwin

Reputation: 1393

In VsCode download the extension "Fast Unicode Math Characters".

The key inputs for is \_2 then press space key.

The kep inputs for ² is \^2 then press space key.

Upvotes: 4

Gene Sevin
Gene Sevin

Reputation: 25

There are several solutions. Personally, I simply format the label text in Word, use a screen capture and save it as an image that I use with a label.

Upvotes: -2

RBT
RBT

Reputation: 25945

Adding more details to complement Hans Passant's answer. Other frequently used sets which can be used as is by copy/paste:

Superscript small case letters: ᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖʳˢᵗᵘᵛʷˣʸᶻ

Subscript small case letters: ₐ ₑ ₕ ᵢ ⱼ ₖ ₗ ₘ ₙ ₒ ₚ ᵣ ₛ ₜ ᵤ ᵥ ₓ

If you're wondering why few letters are missing in above series then please read below posts:

Upvotes: 7

ZingAju
ZingAju

Reputation: 208

This is how usually I tend to do it on Mac.

  • In the VS code, hit (Control + Command + Space) to bring up the Character selector and search for 'superscript' in the search box.

enter image description here

  • Click on required superscript and add it. And here is the result. Screenshot are from the VS code only.

enter image description here

This approach should work across most of the apps in the Mac. Tested in MacOS 12.5. (Monterey)

Upvotes: 4

narayan
narayan

Reputation: 1

use (Ctrl + Shift + P) command to apply superscript and subscript in Visual Studio.

Upvotes: 0

Shannon
Shannon

Reputation: 11

Looks like there are some simple tags that you can use to make any text superscript/subscript. The superscript tag is <sup> and the subscript tag is <sub>.

https://www.w3schools.com/tags/tag_sup.asp

Upvotes: 1

Hans Passant
Hans Passant

Reputation: 942040

Use the Windows Charmap.exe applet. In the Font combobox select a font that has a lot of glyphs, Arial Unicode MS is a very good choice. Tick the Advanced view checkbox and type "super" in the Search box. The grid will show all superscript glyphs, select and copy from that and paste into your source code.

Or copy/paste one of these: ¹²³⁴⁵⁶⁷⁸⁹⁰

Subscript characters: ₀₁₂₃₄₅₆₇₈₉

Upvotes: 72

andselisk
andselisk

Reputation: 1019

Since there is a tag , I assume you are running Windows. There is a great opensource program called WinCompose, which allows to use easy-to-remember and intuitive shortcuts for a huge amount of Unicode symbols, including numerical super- and subscripts. Every shortcut is invoked via a Meta key (e.g. Right Alt), for example:

  • Meta + ^ + 1 gives ¹;
  • Meta + _ + 9 gives .

WinCompose also supports search, can be run in background, and eliminates tedious procedure of calling Character Map with subsequent copy-pasting or remembering the Unicode charsets (but the latter are also listed):

enter image description here

P. S. I'm not affiliated with this software by any means. Just a happy user.

Upvotes: 5

Naresh
Naresh

Reputation: 374

One more way for WPF users,

 <TextBlock >
    <Run>x</Run>
    <Run FontSize="8" BaselineAlignment="TextTop" >2</Run>
  </TextBlock>

Change BaselineAlignment to TextBottom if you want to use as subscript.

Upvotes: 3

Related Questions