## May 22, 2012

### XeLaTex unicode blank

Here is a script to create a blank XeLaTex document with cyrillic letters support:
%&program=xelatex
%&encoding=UTF-8 Unicode

\documentclass[a4paper]{article}
\pagestyle{empty}

\usepackage{geometry}
\geometry{top=2cm}
\geometry{left=2cm}
\geometry{bottom=2cm}
\geometry{right=1cm}

\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
\usepackage{cmap}
\usepackage{fontspec}
\setmainfont{FreeSerif}

\begin{document}
\fontsize{14pt}{14pt}
\selectfont
\begin{center}
}
\end{center}
The quick brown fox jumps over the lazy dog.\\
Съешь ещё этих мягких французских булок, да выпей же чаю.
\end{document}

The result is (click to enlarge):

Things to note:

pagestyle is set to 'empty', so no header/footer will be displayed on page. By default footer contains page number.

You can use documentclass to set font size in such way:
\documentclass[12pt, a4paper]{article}
In this case you should keep in mind that class 'article' allows to use
10-12pt sizes only. To use another size you should set it with fontsize just after document's body beginning. Do not forget to apply it with selectfont.

To make it possible to use fontspec package this script must be compiled with XeLaTex instead of LaTex.

If you are using Texmaker, you can add a hotkey to compile with XeLaTex and run preview with Evince. To do this go to
User->User Comands->Edit User Comands
then enter 'XeLaTex' (or whatever you like) as menu's title and enter next command:
xelatex -interaction=nonstopmode -synctex=-1 %.tex | evince %.pdf


This will be looking something like below:

Voila, you can compile and run preview with 'Alt+Shift+F1' hotkey (or another selected one).