I am a complete newbie, to coding in general.
I want to set up just a few hotkeys for chemical formula I use regularly, that include superscript or subscript and special characters. Since notepad and notepad++ don't have an obvious way to write it.
For example, I want to set Alt+C to insert d13C where d is actually a small case greek delta and the 13 is in superscript. I know how to get to charmap to specify the delta, but I can't for the life of me figure out how to get the 13 in superscript. I am sure there must be a way to tell autohotkey using the unicodes for each character including superscript and subscript numbers, I just don't know enough to do it.
Thanks
Hotkey for formulae with superscript
Re: Hotkey for formulae with superscript
I only know of Superscript 1, 2, and 3 -- ¹, ², and ³. I don't know of them for 4-9; and technically not 0, although ° as 0 kind of works. I don't know that Notepad++ supports a superscript like Microsoft Word as a text editor does, or the superscript HTML tags for websites, but you would want to be able to use the native hotkeys in the application or clicking on a button in the toolbar to toggle in and out of super script.
This is the code I use for ¹, ², and ³.
In case it matters, I run the unicode version of AHK.
Also, for creating the δ character, I use this:
This is the code I use for ¹, ², and ³.
Code: Select all
3::Send {U+00B3} ; ASC 254 I think is alternative
2::Send {U+00B2} ; ASC 253 I think is alternative
1::Send {U+00B9}
Also, for creating the δ character, I use this:
Code: Select all
d::Send {U+03B4} ; delta
Re: Hotkey for formulae with superscript
- There are two classic ways of doing superscript/subscript: text formatting (that you lose when you paste into Notepad), and hardcoded Unicode characters. I'm not sure how you would do this in Notepad++.
- Btw sometimes I've wanted to do superscript and subscript numbers one on top of the other, but I haven't found a good way to do this, other than formula boxes in MS Word, or using LaTeX, but not in ordinary plaintext in Notepad, or formatted text in WordPad.
- Btw sometimes I've wanted to do superscript and subscript numbers one on top of the other, but I haven't found a good way to do this, other than formula boxes in MS Word, or using LaTeX, but not in ordinary plaintext in Notepad, or formatted text in WordPad.
Code: Select all
q:: ;ms word - 1, subscript 2, 3
;subscript via text formatting
Send, 1^=2^=3
return
w:: ;ms word - 1, superscript 2, 3
;subscript via text formatting
Send, 1^+=2^+=3
return
e:: ;anywhere - 1, subscript 2, 3
;subscript via hardcoded Unicode characters
;⁰¹²³⁴⁵⁶⁷⁸⁹ ₀₁₂₃₄₅₆₇₈₉
Send, 1₂3
return
r:: ;anywhere - 1, superscript 2, 3
;subscript via hardcoded Unicode characters
;⁰¹²³⁴⁵⁶⁷⁸⁹ ₀₁₂₃₄₅₆₇₈₉
Send, 1²3
return
t:: ;character to number
vChar := "²"
;vChar := Chr(178)
;vChar := Chr(0xB2)
MsgBox, % vChar "`r`n" Ord(vChar) "`r`n" Format("0x{:X}", Ord(vChar))
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Who is online
Users browsing this forum: Holarctic, jameswrightesq and 446 guests