Actually, I've got two questions (for now ) regarding fonts in XeTeX:
1. How to use TeX fonts together with otf and ttf in XeTeX? I want to use mathpazo font with oldstyle figures and small caps for the main text and only on couple of places in my document I will be using some otf and ttf fonts?
2. How to make a command that do this, so I don't have to type all of this when inputing Arabic text:
gvanas wrote:[...] Actually, I am interested to know how you solved it. [...]
In case this discussion comes to nothing, the TeX Users Group (TUG) has some useful resources about XeTeX [1]. Among others there's also an entry for ArabXeTeX.
Now simply use \artxt when you need to input arabic text. One way for changing arabic font is simply defining more commands like the one above for every font and name them e.g.: \arashzd for Scheherazade, \araltf for Lateef etc.
The other way is to set the font name as a variable, e.g.
If you omit to enter any name and type only \artxt{<some_arabic_text>}, then Scheherazade will be used (or any other font you define in the second square brackets in the code, instead of "Scheherazade").
I prefer the first approach since the second one requires more typing
I provide a complete example for you with some other tips. Hope this will help:-)
EDIT: I must mention a great help from this community regarding this matter, especially juanjo who practically solved most of the issues I had with arabic in the past. Thanks again
Thanks a lot for your answer! This is indeed very helpful.
I was wondering if we could go a step further: have XeLaTeX detect automatically the Arabic text without having to type specific commands (and it would select the right font accordingly). Maybe this is asking for too much, but in HTML or in a word processor, one can type a mix of English and Arabic text and the font and directionality are correctly selected.
gvanas wrote:Thanks a lot for your answer! This is indeed very helpful.
I was wondering if we could go a step further: have XeLaTeX detect automatically the Arabic text without having to type specific commands (and it would select the right font accordingly). Maybe this is asking for too much, but in HTML or in a word processor, one can type a mix of English and Arabic text and the font and directionality are correctly selected.
What do you think?
I don't think it's possible ATM. On the other side, I don't think this is an issue at all (remember, even for italic or bold text you have to type specific commands). XeLaTeX will pick up default font (which is Scheherazade) for arabic in case you haven't define any, but you still must tell it that it should write from right to left. For more details you may want to study ArabXeTeX Manual.
I just wish to explain a little bit why I think it can be useful. Let us take for instance the HTML language or wiki text (when editing a page on Wikipedia). In these two examples, one can input an English text with Arabic words interleaved (or vice-versa) without further markup. The browser will use a bidi algorithm to determine what must be written left-to-right or right-to-left. I think that the preferred directionality of a Unicode character can be found in a table. Likewise, the browser can select a font based on the characters that it encounters.
Supposedly, if I write some kind of converter from HTML or wiki text or whatever to XeLaTeX, I must then require the source text to have proper markup to determine what is in Arabic and what is in English. But HTML or wiki text doesn't need that extra markup.
Much information can be found just by looking at the Unicode characters encountered and selecting whether it is an Arabic or English word can be done automatically. Extra markup means redundancy, which one usually wishes to avoid.
Now I understand that looking at the Unicode characters won't tell you if it is e.g., Arabic, Farsi or Urdu. But maybe this can be set at a higher level, e.g., with a command such as \UseLanguages{English,Farsi}.
Well, these are just some thoughts. ArabXeTeX and XeLaTeX give great results already!