- Subject: Re: [jed-users] How to insert an asc char into text
- From: jed@xxxxxxxxxxx (John E. Davis)
- Date: Sun, 12 Nov 2017 21:03:55 -0500
Bob Bernstein <bob@xxxxxxxxxxxx> wrote:
> I want to try using the square root character as a "check mark."
>
> How can this be done, and what is the ASC value of that char?
The Unicode character is U+221A, which is decimale 8730. To insert
this character into a buffer, press the following keys:
ESC 8 7 3 0 Ctrl-Q
Here it is assumed that you have the quoted_insert function bound to
the Ctrl-Q key. Alternatively, you can use the menu
System->S-Lang Command
to get a S-Lang> prompt:
S-Lang> vinsert("%c", 8730);
Several years ago, I created a function (latex_to_utf8) that converts
various LaTeX constructs into unicode equivalents. I have the
function bound to the Ctrl-O key, which allows me to enter the five
characters \sqrt followed by Ctrl-O to produce: √
The function is appended below.
Finally, you will need to use a font that has glyphs for such
characters.
I hope this helps.
--John
private variable Latex_To_UTF8_Map = Assoc_Type[String_Type, ""];
private define add_mapping (a, b)
{
Latex_To_UTF8_Map[a] = b;
}
add_mapping ("\\Alpha", "\x{0391}");
add_mapping ("\\Beta", "\x{0392}");
add_mapping ("\\Gamma", "\x{0393}");
add_mapping ("\\Delta", "\x{0394}");
add_mapping ("\\Epsilon", "\x{0395}");
add_mapping ("\\Zeta", "\x{0396}");
add_mapping ("\\Eta", "\x{0397}");
add_mapping ("\\Theta", "\x{0398}");
add_mapping ("\\Iota", "\x{0399}");
add_mapping ("\\Kappa", "\x{039A}");
add_mapping ("\\Lamda", "\x{039B}");
add_mapping ("\\Mu", "\x{039C}");
add_mapping ("\\Nu", "\x{039D}");
add_mapping ("\\Xi", "\x{039E}");
add_mapping ("\\Omicron", "\x{039F}");
add_mapping ("\\Pi", "\x{03A0}");
add_mapping ("\\Rho", "\x{03A1}");
add_mapping ("\\Sigma", "\x{03A3}");
add_mapping ("\\Tau", "\x{03A4}");
add_mapping ("\\Upsilon", "\x{03A5}");
add_mapping ("\\Phi", "\x{03A6}");
add_mapping ("\\Chi", "\x{03A7}");
add_mapping ("\\Psi", "\x{03A8}");
add_mapping ("\\Omega", "\x{03A9}");
add_mapping ("\\alpha", "\x{03B1}");
add_mapping ("\\beta", "\x{03B2}");
add_mapping ("\\gamma", "\x{03B3}");
add_mapping ("\\delta", "\x{03B4}");
add_mapping ("\\epsilon", "\x{03B5}");
add_mapping ("\\zeta", "\x{03B6}");
add_mapping ("\\eta", "\x{03B7}");
add_mapping ("\\theta", "\x{03B8}");
add_mapping ("\\iota", "\x{03B9}");
add_mapping ("\\kappa", "\x{03BA}");
add_mapping ("\\lambda", "\x{03BB}");
add_mapping ("\\mu", "\x{03BC}");
add_mapping ("\\nu", "\x{03BD}");
add_mapping ("\\xi", "\x{03BE}");
add_mapping ("\\omicron", "\x{03BF}");
add_mapping ("\\pi", "\x{03C0}");
add_mapping ("\\rho", "\x{03C1}");
add_mapping ("\\sigma", "\x{03C3}");
add_mapping ("\\tau", "\x{03C4}");
add_mapping ("\\upsilon", "\x{03C5}");
add_mapping ("\\phi", "\x{03C6}");
add_mapping ("\\chi", "\x{03C7}");
add_mapping ("\\psi", "\x{03C8}");
add_mapping ("\\omega", "\x{03C9}");
add_mapping ("\\times", "\x{00D7}");
add_mapping ("\\dot", "\x{22C5}");
add_mapping ("\\otimes", "\x{2297}");
add_mapping ("\\oplus", "\x{2295}");
add_mapping ("\\^0", "\x{2070}");
add_mapping ("\\^1", "\x{00B9}");
add_mapping ("\\^2", "\x{00B2}");
add_mapping ("\\^3", "\x{00B3}");
add_mapping ("\\^4", "\x{2074}");
add_mapping ("\\^5", "\x{2075}");
add_mapping ("\\^6", "\x{2076}");
add_mapping ("\\^7", "\x{2077}");
add_mapping ("\\^8", "\x{2078}");
add_mapping ("\\^9", "\x{2079}");
add_mapping ("\\^+", "\x{207A}");
add_mapping ("\\^-", "\x{207B}");
add_mapping ("\\^=", "\x{207C}");
add_mapping ("\\^(", "\x{207D}");
add_mapping ("\\^)", "\x{207E}");
add_mapping ("\\^n", "\x{207F}");
add_mapping ("\\_0", "\x{2080}");
add_mapping ("\\_1", "\x{2081}");
add_mapping ("\\_2", "\x{2082}");
add_mapping ("\\_3", "\x{2083}");
add_mapping ("\\_4", "\x{2084}");
add_mapping ("\\_5", "\x{2085}");
add_mapping ("\\_6", "\x{2086}");
add_mapping ("\\_7", "\x{2087}");
add_mapping ("\\_8", "\x{2088}");
add_mapping ("\\_9", "\x{2089}");
add_mapping ("\\_+", "\x{208A}");
add_mapping ("\\_-", "\x{208B}");
add_mapping ("\\_=", "\x{208C}");
add_mapping ("\\_(", "\x{208D}");
add_mapping ("\\_)", "\x{208E}");
add_mapping ("\\hbar", "\x{210F}");
add_mapping ("\\<=", "\x{2264}");
add_mapping ("\\>=", "\x{2265}");
add_mapping ("\\<<", "\x{226A}");
add_mapping ("\\>>", "\x{226B}");
add_mapping ("\\approx", "\x{2248}");
add_mapping ("\\sqrt", "\x{221A}");
private variable Abbrev_Chars = "-+=<>()a-zA-Z^_0-9";
define latex_to_utf8 ()
{
insert_char(1);
push_spot ();
EXIT_BLOCK
{
pop_spot ();
push_mark(1);
go_left (1);
del_region();
}
bol ();
while (ffind ("\\"))
{
push_mark ();
go_right(1);
variable p = _get_point ();
skip_chars("a-zA-Z");
if (p == _get_point ())
skip_chars (Abbrev_Chars);
dupmark ();
variable name = bufsubstr ();
variable utf8 = Latex_To_UTF8_Map[name];
if (utf8 == "")
{
pop_mark_0 ();
continue;
}
del_region ();
insert (utf8);
}
}
_______________________________________________
For list information, visit <http://jedsoft.org/jed/mailinglists.html>.
[2017 date index]
[2017 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]