Difference between revisions of "XeTeX"

From SMC Wiki
Line 1: Line 1:
 
=== XeTeX ===
 
=== XeTeX ===
 
XeTeX is an extension of TeX with built-in support for Unicode and OpenType. For more details see http://scripts.sil.org/xetex
 
XeTeX is an extension of TeX with built-in support for Unicode and OpenType. For more details see http://scripts.sil.org/xetex
 +
 +
== Installing XeTeX ==
 +
 +
XeTeX is packaged for all famous GNU/Linux distros. The installation method depends your distro. For ease of installation and configuration, we suggest to use a TeXLive version 2012 or above - either standalone TeXLive distribution or install from your distribution's package manager. Windows and OSX versions are also available.
 +
 +
Following packages are required to install to get a working xetex environment in your computer. Note that these packages are relatively large in size and will take time and bandwidth.
 +
# texlive-xetex
 +
# texlive-latex-extra
 +
 +
You also need reasonably good unicode compatible Malayalam fonts. These fonts also comes with GNU/Linux distros. Search for malayalam fonts in your package manager and install if not already installed. Eg fonts: Meera, Rachana etc.
  
 
=== Creating documents using XeTeX ===
 
=== Creating documents using XeTeX ===
 +
A simple document to learn usage of xetex is given below.
  
# Install TeX Live. <br/>Install latex and xetex. For ease of installation and configuration, we suggest to use a TeXLive version 2012 or above - either standalone TeXLive distribution or install from your distribution's package manager. Windows and OSX versions are also available. <br/>In Fedora, you can install the packages texlive-latex and texlive-xetex.
+
Using a text editor like gedit or kate, create a new file with .tex as file extension. Eg: example.tex. Copy the following content as the content for that file and save
# Install Fontspec and Hyphenation packages. <br/>Install polyglossia and Indic hyphenation rules. <br/>In Fedora, the packages are texlive-fontspec, texlive-polyglossia and texlive-hyphen-indic
+
<pre>
# Install the fonts. <br/> For Malayalam, let us try to use Rachana. <br/> In Fedora, the package is smc-rachana-fonts.
+
\documentclass{article}
# Create your tex document. <br/> An example document is: <br/>
+
\usepackage{fontspec}
#:<code>
+
\usepackage{polyglossia}
#: \documentclass{article}
+
\setdefaultlanguage{malayalam}
#: \usepackage{fontspec}
+
\setmainfont[Script=Malayalam]{Rachana}
#: \usepackage{polyglossia}
+
\begin{document}
#: \setdefaultlanguage{malayalam}
+
സീടെക്കിൽ മലയാളം ടൈപ്പ്സെറ്റ് ചെയ്തത്.
#: \setmainfont[Script=Malayalam]{Rachana}
+
\end{document}
#: \begin{document}
+
</pre>
#: സീടെക്കിൽ മലയാളം ടൈപ്പ്സെറ്റ് ചെയ്തത്.
 
#: \end{document}
 
#:</code>
 
# Compile the document using XeTeX
 
#:<code>
 
#: xelatex yourdocument.tex
 
#:</code>
 
  
In Debian/Ubuntu install following
+
Now you need to compile this document to generate PDF.
:<code>
+
<code>
: sudo apt-get install texlive texlive-latex3 texlivexetex texlive-latex-extra
+
xelatex example.tex
:</code>
+
</code>

Revision as of 14:01, 8 December 2013

XeTeX

XeTeX is an extension of TeX with built-in support for Unicode and OpenType. For more details see http://scripts.sil.org/xetex

Installing XeTeX

XeTeX is packaged for all famous GNU/Linux distros. The installation method depends your distro. For ease of installation and configuration, we suggest to use a TeXLive version 2012 or above - either standalone TeXLive distribution or install from your distribution's package manager. Windows and OSX versions are also available.

Following packages are required to install to get a working xetex environment in your computer. Note that these packages are relatively large in size and will take time and bandwidth.

  1. texlive-xetex
  2. texlive-latex-extra

You also need reasonably good unicode compatible Malayalam fonts. These fonts also comes with GNU/Linux distros. Search for malayalam fonts in your package manager and install if not already installed. Eg fonts: Meera, Rachana etc.

Creating documents using XeTeX

A simple document to learn usage of xetex is given below.

Using a text editor like gedit or kate, create a new file with .tex as file extension. Eg: example.tex. Copy the following content as the content for that file and save

\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{malayalam}
\setmainfont[Script=Malayalam]{Rachana}
\begin{document}
സീടെക്കിൽ മലയാളം ടൈപ്പ്സെറ്റ് ചെയ്തത്.
\end{document}

Now you need to compile this document to generate PDF. xelatex example.tex