May 22, 2012

XeLaTex unicode blank

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




\textbf{\uppercase{I'm header. Я заголовок}\\
I'm subheader. Я подзаголовок
The quick brown fox jumps over the lazy dog.\\
Съешь ещё этих мягких французских булок, да выпей же чаю.
   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).

No comments:

Post a Comment