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


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.

  • 3
    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. Commented Feb 12, 2014 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
    Commented Feb 12, 2014 at 16:30
  • 2
    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. Commented Feb 12, 2014 at 16:49
  • 3
    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
    Commented Feb 12, 2014 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. Commented Feb 12, 2014 at 17:06

1 Answer 1


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

  • 3
    Welcome to TeX SE! Could you add a bit more explanation to your answer? As it stands, this is not terribly informative or helpful. Is xepersian an editor? If not, are you saying that this is not really an editor issue (as the comments on the question claim)? Or is this intended to supplement that? Perhaps an example of what xepersian can do which ConTeXt cannot would be helpful?
    – cfr
    Commented Apr 20, 2014 at 14:24
  • 2
    While the answer is not very good according to our standards, I don't think it deserves to be at a score -1 and deleted, especially since the user is new here and the answer is very fresh, too. Upvoted to reverse the downvote.
    – yo'
    Commented Apr 20, 2014 at 14:55
  • @tohecz Totally agree. I wasn't sure if that was considered an acceptable use of an upvote so just left a comment instead.
    – cfr
    Commented Apr 20, 2014 at 16:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .