Shortcuts for Unicode Greek symbols

With IP7 and Unicode my old graph annotation habits have had to change. In particular, the old way of getting Greek characters by setting the Symbol font and typing in Latin characters no longer works. I find the new method of using the mouse to select from the Special/Character window a little cumbersome. If you also prefer to rely on the keyboard, here are some easily remembered globals for entering LC Greek symbols into string annotations (graph labels, text boxes, etc):
function UGreek() // LOWER CASE

    String/G kAlpha         =   "\u03B1"
    String/G kBeta          =   "\u03B2"
    String/G kGamma         =   "\u03B3"
    String/G kDelta         =   "\u03B4"
    String/G kEpsilon   =   "\u03B5"
    String/G kZeta      =   "\u03B6"
    String/G kEta       =   "\u03B7"
    String/G kTheta         =   "\u03B8"
    String/G kIota      =   "\u03B9"
    String/G kKappa         =   "\u03BA"
    String/G kLambda    =   "\u03BB"
    String/G kMu        =   "\u03BC"
    String/G kNu        =   "\u03BD"
    String/G kXi        =   "\u03BE"
    String/G kOmicron   =   "\u03BF"
    String/G kPi        =   "\u03C0"
    String/G kRho       =   "\u03C1"
    String/G kSigma         =   "\u03C3"
    String/G kTau       =   "\u03C4"
    String/G kUpsilon   =   "\u03C5"
    String/G kPhi       =   "\u03C6"
    String/G kChi       =   "\u03C7"
    String/G kPsi       =   "\u03C8"
    String/G kOmega         =   "\u03C9"
end

When typing in an annotation entry, use the escape sequence \{global_symbol_name} . I anticipate some objections to using so many
global strings. Please suggest a better approach if you know of one.
The extension to other symbols is obvious. I found a useful UTF table at http://www.fileformat.info/info/charset/UTF-8/list.htm
Something like the following should also work:

Function/S greek(latinChar)
string latinChar

strswitch(tolower(latinChar))
case "a":
return "\u03B1"
// ...
endswitch
End


and then use \{greek("a")}. But it is not exactly short on the calling site.
Based on Thomas Braun's suggestion, here is a more-concise hybrid solution with no global variables, but a single look-up wave. The look-up wave entries are arranged in the old IP6 Latin order of Latin-to-Symbol font conversion (e.g. \F'Symbol'abc --> Greek alpha, beta, chi).
function makeGK()  // make lookup wave of Unicode Greek LC symbols sorted by IP6 mnemonic Latin sequence from "a" to "z"
    make/O/N=26/T wGK ={"\u03B1","\u03B2","\u03C7","\u03B4","\u03B5","\u03C6","\u03B3","\u03B7","\u03B9",\
      "\u03D5","\u03BA","\u03BB","\u03BC","\u03BD","\u03BF","\u03C0","\u03B8","\u03C1","\u03C3","\u03C4",\
      "\u03C5","\u03D6","\u03C9","\u03BE","\u03C8","\u03B6"}
end
//----------------------------------------------------------
function/T GK(char) // retrieve Unicode Greek LC symbol, with Latin character input, e.g. "a"
    string char
   
    WAVE/T wGK
    variable CharNum = char2num(char)- 97 // subtract starting "a" value
    return wGK[CharNum]
end

As before enter annotations as \{GK("LatinCharacter")} .
Added: I should have used function/S GK(char), but interestingly the /T flag compiled and worked, even if not documented.
Here is the History output for a simple test function (it is better aligned in monospaced font)
  α β χ δ ε φ γ η ι ϕ κ λ μ ν ο π θ ρ σ τ υ ϖ ω ξ ψ ζ
  a b c d e f g h i j k l m n o p q r s t u v w x y z

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More