Overriding the LaTeX math bias
January 7, 2008
If you’re using something like arabtex (or it’s Unicode-font-friendly offspring arabxetex), or anything in which special characters are used for some purpose, you may run into this problem. I’m posting it here for my own reference, and for the help of those who may resort to Google in times of frustration.
Arab(xe)tex uses underscores (_) and carats (^) – among other symbols – in the place of diacritics to encode Arabic characters in ASCII text. These are LaTeX control characters. Normally they would need to be escaped. The packages take care of this, so normally one doesn’t need to think about it. If you set up new commands, though, as aliases or to do more than one thing with your text, LaTeX all of a sudden sees them as unescaped control characters. (Even though you would think the text is being passed through the arabtex functions.)
When LaTeX sees control characters, it can think of only one thing – you must be trying to enter mathematical formulas, so it tells you:
! Missing $ inserted.
That is, it thought you just forgot to enter math mode. If you try to escape your special characters, it will compile, but you’ll get ھبر instead of خبر.
The rough and ready fix for this is with statements like this in the header of your file:
It doesn’t seem to matter if it’s before you define your commands or not.