Writing math with XeLaTeX

The following is a short explanation for those who wish to get the basics to write math with XeLaTeX :

  • First, you will notice, if you look at the xelatex directory, that there is a mathspec folder. If you don’t know where is your xelatex folder, then look here if you have installed TeXlive with the installation script :

    /usr/local/texlive/2010/texmf-dist/doc/xelatex/mathespec/

    Or look here if you have installed TeXlive with your package manager :

    /usr/share/doc/texlive-doc/xelatex/mathspec/

  • But a better choice might be to use unicode-math, though it is still in its beta stage. Documentation about this package is located in the following directory in case you have installed TeXlive with the installation script install-tl :

    /usr/local/texlive/2010/texmf-dist/doc/latex/unicode-math

    Or here if you have installed TeXlive with your package manager :

    /usr/share/doc/texlive-doc/latex/unicode-math

  • Let us assume you wish to use the unicode-math package. Then, you will have to load it :

    \usepackage{unicode-math}

    And to define the font for math :

    \setmathfont{Asana Math}

    Consequently, here is an example of minimal preamble to write math and compile with XeLaTeX :

    \documentclass{article}
    \usepackage{unicode-math}
    \usepackage{amsmath}
    \usepackage{xltxtra}
    \setmainfont{TeX Gyre Pagella}
    \setmathfont{Asana Math}

    Where article is a class to make a test, unicode-math the package to input math with XeLaTeX, amsmath the usual package for math and xltxtra the usual package for XeLaTeX which load some useful modules (see the xltxtra for a list of these modules).
    Also, \setmainfont{TeX Gyre Pagella} is the definition of the font for your text, and \setmathfont{Asana Math} the definition of the fonts for math as I said previously.

Here is a screenshot of an example of output (a pdf file) we can get with XeLaTeX :

About these ads
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: