3

I have some problems and I hope you can help me.

When I put a tikzpicture and use the arabi package, the picture is not displayed in the dvi or pdf file, and this without a single error.

I have a solution for that (which I don't like), I have to put the TikZ picture inside an english language environment, like this :

\begine{otherlanguage}{english}
\begin{tikzpicture}
...
...
\end{tikzpicture}
\end{otherlanguage}

it is a boring solution and not suitable if I want to create environments like boxed theorems, etc.

Here is a sample :

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass{report}


\usepackage[Latin1, utf8, cp1256]{inputenc}
%\usepackage[T1, OT1, LAE]{fontenc}
\usepackage[english, arabic]{babel}
\usepackage{amsmath, amsfonts, amssymb, amsthm}
\usepackage{tikz}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% Indian to Arabic Numerotations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\theenumi}{\textLR{\arabic{enumi}}-}
\renewcommand{\labelenumi}{\theenumi}
\renewcommand{\theenumii}{\alph{enumii})}
\renewcommand{\labelenumii}{\theenumii}

\renewcommand{\theequation}{\textLR{\arabic{equation}}}

\renewcommand{\thesection}{\textLR{\arabic{section}} -}
\renewcommand{\thepage}{\textLR{\arabic{page}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{document}

\section{المتتاليات العددية}

\tikzstyle{mybox} = [draw=red, fill=blue!20, very thick,
    rectangle, rounded corners, inner sep=10pt, inner ysep=20pt]
\tikzstyle{fancytitle} =[draw=red, fill=blue!20, text=black, rectangle, rounded corners]
\begin{otherlanguage}{english}
\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{.89\textwidth}
\begin{otherlanguage}{arabic}     

لتكن $f$ دالة مستمرة على المجال $[a,b]$ و قابلة للإشتقاق على $]a,b[$, 
حيث $f(a)=f(b)$.
إذن, يوجد عدد حقيقي $c \in ]a,b[$ حيث 
$$
f(c)=0
$$.
\end{enumerate}
\end{otherlanguage}
\end{minipage}
};
\node[fancytitle, left=10pt] at (box.north east) {\AR{نظـريـة}};
\node[fancytitle, rounded corners] at (box.east) {$\clubsuit$};
\end{tikzpicture}%
\end{otherlanguage}

\begin{center}
\begin{otherlanguage}{english}
\begin{tikzpicture}
\draw[thick,rounded corners=8pt]
(0,0) -- (0,2) -- (1,3.25) -- (2,2) -- (2,0) -- (0,2) -- (2,2) -- (0,0) -- (2,0);
\end{tikzpicture}
\end{otherlanguage}
\end{center}


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

you can try to compile this code with pdflatex without

\begin{otherlanguage}{english}

\end{otherlanguage}

in the last picture. this picture isn't displayed in the output pdf file.

  • ps: there is no enumerate environnement. – singular Jul 16 '13 at 22:24
  • yes, it work well for this example. But each time i must use \begin{otherlanguage}{english} tikz picture ... \end{otherlanguage} and inside the tikz picture there is another \begin{otherlanguage}{arabic} Arabic text .... \end{otherlanguage} – singular Jul 16 '13 at 22:50
  • Like i said, this is not suitable if i want to creat a good looking boxed environnements like theorems, lemmas... etc – singular Jul 16 '13 at 23:11
  • yes, (\end{enumerate}) is removed now. – singular Jul 16 '13 at 23:32
5

This seems to be due to an incompatibility between TikZ and babel with the arabic option. It can be rectified reasonably easily, though.

To make TikZ work in a document that's using babel with the arabic option, the tikzpicture environment needs to be in an english environment. To automatically switch to english, you can put

\usepackage{etoolbox}
\AtBeginEnvironment{tikzpicture}{\selectlanguage{english}}

in your preamble.

To switch to arabic for the text within the tikzpicture, you can put

\tikzset{font=\selectlanguage{arabic}}

into your preamble. The contents of font are executed at the start of each node.

\documentclass{report}


\usepackage[utf8]{inputenc}
\usepackage[english, arabic]{babel}
\usepackage{amsmath, amsfonts, amssymb, amsthm}
\usepackage{tikz}

\usepackage{etoolbox}
\AtBeginEnvironment{tikzpicture}{\selectlanguage{english}}
\tikzset{font=\selectlanguage{arabic}}


\begin{document}

\section{المتتاليات العددية}

\tikzset{
    mybox/.style={
        draw=red, fill=blue!20, very thick,
        rectangle, rounded corners, inner sep=10pt, inner ysep=20pt
    },
    fancytitle/.style={
            draw=red, fill=blue!20, text=black, rectangle, rounded corners
    }
}
\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{.89\textwidth}

لتكن $f$ دالة مستمرة على المجال $[a,b]$ و قابلة للإشتقاق على $]a,b[$, 
حيث $f(a)=f(b)$.
إذن, يوجد عدد حقيقي $c \in ]a,b[$ حيث 
$$
f^\prime(c)=0.
$$
\end{minipage}
};
\node[fancytitle, left=10pt] at (box.north east) {\AR{نظـريـة}};
\node[fancytitle, rounded corners] at (box.east) {$\clubsuit$};
\end{tikzpicture}%

 للإشتقاق

\end{document}
  • thank you very much Jake. I will see what i can do with it and come with a new qustions :) – singular Jul 17 '13 at 0:06
  • @singular: Pleasure! If the answer helps, you can upvote it by clicking the triangle next to the answer, and if it solves your problem, you can also mark the question as answered by clicking the tick mark. – Jake Jul 17 '13 at 0:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.