Hello Sasi,

Do you have "doubts" or "questions". "Doubts" would indicate that you do not 
trust the software? "Questions" would be just questions. Allow me to help a bit.

Xe(La)TeX is just like "normal", but with one big difference: xe(la)tex can 
read UTF-8 encoded source files. This means that xelatex can use all Unicode 
characters. This is unlike older versions of TeX, which could only use much 
smaller encodings, and you had to use tricks to use more than one encoding in 
one document (for instance, mixing "latin" with "greek" was very difficult, and 
"latin" and "cyrillic" was also difficult - for Japanese, the situation was so 
complex that a special version of TeX, called pTeX, was (and is) the main form 
of TeX for Japanese).

But, with xelatex, you can type all alphabets mixed into one source file, and 
your document will contain all the characters. Note: to "display" the 
character, the "font" needs to have a "glyph" for the character (consider that 
you want to display an "A" but the font only has "a" - then you cannot display 
"A" and you will get an empty position).

> 1. How can I change the font inside a document? For instance, let me say I 
> have a document such as this:


The fontspec package takes care of these things. Read the manual, it is a very 
good introduction.

> 2. I am creating a document in two languages, let us say, English and 
> Malayalam, with both languages appearing intermixed. Now, how do I set the 
> fonts for each language? I have a font for Malayalam, but the English text 
> does not appear very beautiful in that font, so I would like the English text 
> to appear in some other font.

For Japanese and English, I always use the following:

\XeTeXinterchartokenstate = 1

% when going from not CJK to CJK
\XeTeXinterchartoks 0 1   = {\cjkfont}
\XeTeXinterchartoks 0 2   = {\cjkfont}
\XeTeXinterchartoks 0 3   = {\cjkfont}
\XeTeXinterchartoks 255 1 = {\cjkfont}
\XeTeXinterchartoks 255 2 = {\cjkfont}
\XeTeXinterchartoks 255 3 = {\cjkfont}

% when going from CJK to not CJK
\XeTeXinterchartoks 1 0   = {\latinfont}
\XeTeXinterchartoks 2 0   = {\latinfont}
\XeTeXinterchartoks 3 0   = {\latinfont}
\XeTeXinterchartoks 1 255 = {\latinfont}
\XeTeXinterchartoks 2 255 = {\latinfont}
\XeTeXinterchartoks 3 255 = {\latinfont}

\newfontfamily{\cjkfont}  {Kozuka Mincho Pro-VI}
\newfontfamily{\latinfont}{TeX Gyre Pagella} 

But this works because inside xelatex, the Japanese characters have a different 
"nature" than latin characters. I don't know if something similar happens 
between English and Malayalam. 

To switch between font families easily, you could use something like:

\newfontfamily{\latinfont}[Mapping=tex-text]{TeX Gyre Termes} 
\newfontfamily{\greekfont}[Mapping=tex-text]{Old Standard} 

\setmainfont[Mapping=tex-text]{TeX Gyre Termes}

\latinfont This part will be in the latin font and \greekfont this part will be 
in the greek font.

Check the fontspec manual.

Cheers,
Wilfred

--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex

Reply via email to