# Unicode, right to left characters in command names

What is the status, in terms of category codes, of all the Unicode letters above ASCII in XeTeX (using XeLaTex+fontspec) and LuaTeX (using ConTeXt)? Can I define a macro using Unicode characters (ex. \μακρο)?

I am asking that because I went mad when trying to type in a right to left language using ConTeXt, since the combination of the TeX commands (LTR) and the text itself (RTL) made the editor unusable, and I found out that something like

\def\شق{\something}


worked, but the subsequent \شق was not synthax-highlighted properly. So I want to know if that is a problem of the editor (TeXShop), or the engine was just being lax when allowing that.

• You can do this, however ConTeXt has a more sophisticated support for localized interface (and there already exists a partial Persian localization) that you may want to check. – Khaled Hosny Feb 12 '14 at 16:19
• @KhaledHosny : Thanks for that! I wonder what people do when developing extensively in Arabic/Hebrew and using HTML-XML or other latin markup languages... – Ralph Feb 12 '14 at 16:30
• I'll tell you what I do (others may use other solutions): I use Vim. It has wonderful support for both bi-directionality and LaTeX (and HTML, XML, etc.). Vim's approach to bi-directionality is quite unique; it is actually ignorant of bi-directionality and simply shows what's in the file in order. This might be a little bit awkward for people who are used to the more common approach, but it solves this problem you described perfectly (for me…). I find mapping ⇧+␣ to switching between directions very convenient: use map <S-SPACE> :set invrl<CR> and imap <S-SPACE> <Esc>:set invrl<CR>a. – Júda Ronén Feb 12 '14 at 16:49
• This is an editor issue, not a TeX issue. Syntax highlighting is never perfect, especially in a language like TeX. I don't know any editor that will correctly highlight xii.tex – Aditya Feb 12 '14 at 16:57
• Here are two screenshots of Vim with Hebrew text: 1 and 2. For documentation use help hebrew in Vim or read this online version. – Júda Ronén Feb 12 '14 at 17:06

You can do this perfectly in xepersian. check the documentation. xepersian has a very sophisticated mechanism for localisation. It almost has the localised version of every command, primitive, an environments. In addition, it allows you to localise any other command, environment quite easily. For instance if localised version of \Foo command is \فو, you can do this by
\eqcommand{فو}{Foo}