[XeTeX] TikZ and Polyglossia

Hadi SAOUD hadidev at gmail.com
Thu May 6 22:54:18 CEST 2010


Hello,

I'm trying to draw  flowcharts with XeLaTex and TikZ, but I have errors 
at compilation when I also use Polyglossia with some parameters.
When I try to use turkish, arabic or hebrew as main language, compile 
process  fails (I've the error "missing } inserted"),
but when I use english or greek as main language, I've no problem.

these are 2 samples:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% first sample with arabic as default language; doesn't compile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[12pt, a4paper]{article}

\usepackage{tikz}

\usetikzlibrary{shapes,arrows}

\usepackage[no-math]{fontspec}

\usepackage[quiet]{polyglossia}

\setdefaultlanguage{arabic}

\setotherlanguage{english}

\setromanfont[Scale=1.1]{Times New Roman}

\defaultfontfeatures{Scale=MatchLowercase}

\setmonofont{Arial}

\setsansfont{Courier New}

\newfontfamily\arabicfont[Script=Arabic]{Times New Roman}


\begin{document}


a first TikZ image that always compiles

\begin{tikzpicture}

     \draw (0,0) -- (1,1) -- (2,-2) -- (0,0);

\end{tikzpicture}

another TikZ image that always compiles sometimes

\tikzstyle{block} = [rectangle, draw, fill=blue!20, text width=5em, text 
centered, rounded corners, minimum height=4em]

\tikzstyle{line} = [draw, -latex']

\begin{tikzpicture}[node distance = 2cm, auto]

     % Place nodes

     \node [block] (init) {initialize model};

     \node [block, below of=init] (identify) {identify candidate models};

     % Draw edges

     \path [line] (init) -- (identify);

\end{tikzpicture}


\end{document}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% another sample with english as default language; it can be compiled
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[12pt, a4paper]{article}

\usepackage{tikz}

\usetikzlibrary{shapes,arrows}

\usepackage[no-math]{fontspec}

\usepackage[quiet]{polyglossia}

\setdefaultlanguage{english}

\setromanfont[Scale=1.1]{Times New Roman}

\defaultfontfeatures{Scale=MatchLowercase}

\setmonofont{Arial}

\setsansfont{Courier New}


\begin{document}


a first TikZ image that always compiles

\begin{tikzpicture}

     \draw (0,0) -- (1,1) -- (2,-2) -- (0,0);

\end{tikzpicture}

another TikZ image that always compiles sometimes

\tikzstyle{block} = [rectangle, draw, fill=blue!20, text width=5em, text 
centered, rounded corners, minimum height=4em]

\tikzstyle{line} = [draw, -latex']

\begin{tikzpicture}[node distance = 2cm, auto]

     % Place nodes

     \node [block] (init) {initialize model};

     \node [block, below of=init] (identify) {identify candidate models};

     % Draw edges

     \path [line] (init) -- (identify);

\end{tikzpicture}


\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


Do you know what's wrong with my code?


Thanks


Hadi




More information about the XeTeX mailing list