我遇到了一些问题,希望你能帮助我。
当我放置tikzpicture
并使用该arabi
包时,图片没有显示在dvi
或pdf
文件中,并且没有任何错误。
我有一个解决方案(我不喜欢),我必须将 TikZ 图片放在英语语言环境中,如下所示:
\begine{otherlanguage}{english}
\begin{tikzpicture}
...
...
\end{tikzpicture}
\end{otherlanguage}
如果我想创建像盒装定理等环境的话,这是一个无聊的解决方案并且并不合适。
以下是一个示例:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
你可以尝试用 pdflatex 编译此代码,无需
\begin{其他语言}{英语}
\结束{其他语言}
在最后一张图片中。这张图片未显示在输出的 pdf 文件中。
答案1
这似乎是由于 TikZ 和 babel 选项不兼容造成的arabic
。不过,这个问题可以相当容易地纠正。
要使 TikZ 在使用 babel 选项的文档中工作arabic
,tikzpicture
环境需要在english
环境中。要自动切换到english
,你可以输入
\usepackage{etoolbox}
\AtBeginEnvironment{tikzpicture}{\selectlanguage{english}}
在你的序言中。
要切换到arabic
tikzpicture 中的文本,你可以输入
\tikzset{font=\selectlanguage{arabic}}
放入你的序言中。 的内容font
在每个节点开始时执行。
\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}