3

I'm trying to make a template for an Arabic book. I wish to use the babel package with pdflatex as I'm not familiar with xelatex. I was hoping to arabianize the legend orange template (http://www.latextemplates.com/template/the-legrand-orange-book). Now, my problem is that the mdframed always produces solid black boxes for theorems with arabic babel. I mean the whole theorem is replace by a solid black box and you don't see the text. I don't observe this problem for english. The latex code below summarizes

\documentclass[12pt,a4paper]{book}

\usepackage{tikz}
\usepackage{fancyhdr}
\definecolor{ocre}{RGB}{243,102,25}
\graphicspath{{Pictures/}}
\usepackage{amsmath}

\usepackage[LFE,LAE]{fontenc}
\usepackage[utf8]{inputenc} % Required for including letters with accents
\usepackage[english,arabic]{babel} % Arabic language/hyphenation

\newcounter{dummy} 
\numberwithin{dummy}{section}
\newtheorem{theoremeT}[dummy]{نظرية}

\RequirePackage[framemethod=default]{mdframed} % Required for creating the theorem, definition, exercise and corollary boxes

% Theorem box
\newmdenv[skipabove=7pt,
skipbelow=7pt,
backgroundcolor=black!1,
linecolor=blue,
innerleftmargin=5pt,
innerrightmargin=5pt,
innertopmargin=5pt,
leftmargin=0cm,
rightmargin=0cm,
innerbottommargin=5pt]{tBox}

%\newenvironment{theorem}{\begin{tBox}\begin{theoremeT}}{\end{theoremeT}\end{tBox}}
\newmdtheoremenv{theorem}{نظرية}

\begin{document}


\newpage
~\vfill
\thispagestyle{empty}

\noindent حقوق الطبع محفوظة \\ % Copyright notice

\noindent \textsc{نشر بواسطة دار المعارف}\\ % Publisher

\noindent يحظر نسخ أي جزء من هذا الكتاب دون علم المؤلفين ودار النشر وفقا لأحكام قانون النشر المصري\\ % License information

\noindent \textit{الطبعة الأولى يناير $2016$} % Printing/edition date

\pagestyle{empty} % No headers

\tableofcontents % Print the table of contents itself

\cleardoublepage % Forces the first chapter to start on an odd page so it's on the right

\pagestyle{fancy} % Print headers again

\chapter{علوم الحاسوب}
يعود تاريخ علوم الحاسوب إلى اختراع أول حاسوب رقمي حديث. فقبل العشرينات من القرن العشرين.

\section{تاريخ}
كان مصطلح حاسوب \textLR{Computer} يشير إلى أي أداة بشرية تقوم بعملية الحسابات. ما هي القضايا أو الأشياء التي يمكن لآلة أن تحسبها باتباع قائمة من التعليمات مع ورقة وقلم، دون تحديد للزمن اللازم ودون أي مهارات أو بصيرة (ذكاء)؟ وكان أحد دوافع هذه الدراسات هو تطوير آلات حاسبة \textLR{computing machines} يمكنها إتمام الأعمال الروتينية والعرضة للخطأ البشري عند إجراء حسابات بشرية.
خلال الأربعينات، مع تطوير آلات حاسبة أكثر قوة وقدرة حسابية، تتطور مصطلح حاسوب ليشير إلى الآلات بدلا من الأشخاص الذين يقومون بالحسابات. وأصبح من الواضح أن الحواسيب يمكنها أن تقوم بأكثر من مجرد عمليات حسابية وبالتالي انتقلوا لدراسة تحسيب أو التحسيب بشكل عام. بدأت المعلوماتية وعلوم الحاسب تأخذ استقلالها كفرع أكاديمي مستقل في الستينات، مع إيجاد أوائل أقسام علوم الحاسب في الجامعات وبدأت الجامعات تعطي إجازات في هذه العلوم [1]. 
\begin{theorem}
القوة هي حاصل ضرب العجلة في الكتلة 
\end{theorem}

\begin{thebibliography}{99}
   [1]
       من ويكيبيديا، الموسوعة الحرة
       \end{thebibliography}
       \end{document}

Here's a snpshot of page 5, enter image description here

1 Answer 1

2

To resolve the problematic you can just put the theorem environment inside english context with the usage of otherlanguage environment , and your code becomes:

\documentclass[12pt,a4paper]{book}

\usepackage{tikz}
\usepackage{fancyhdr}
\definecolor{ocre}{RGB}{243,102,25}
\graphicspath{{Pictures/}}
\usepackage{amsmath}

\usepackage[LFE,LAE]{fontenc}
\usepackage[utf8]{inputenc} % Required for including letters with accents
\usepackage[english,arabic]{babel} % Arabic language/hyphenation

\usePackage[framemethod=default]{mdframed} % Required for creating the theorem, definition, exercise and corollary boxes

% Theorem box
\newmdtheoremenv[skipabove=7pt,
skipbelow=7pt,
backgroundcolor=black!1,
linecolor=ocre,
innerleftmargin=5pt,
innerrightmargin=5pt,
innertopmargin=5pt,
leftmargin=0cm,
rightmargin=0cm,
innerbottommargin=5pt]{theorem}{\textAR{نظرية}}

\newenvironment{mytheorem}{\begin{otherlanguage}{english}
\begin{theorem}
\otherlanguage{arabic}
}{\end{theorem}
\end{otherlanguage}}

\begin{document}


\newpage
~\vfill
\thispagestyle{empty}

\noindent حقوق الطبع محفوظة \\ % Copyright notice

\noindent \textsc{نشر بواسطة دار المعارف}\\ % Publisher

\noindent يحظر نسخ أي جزء من هذا الكتاب دون علم المؤلفين ودار النشر وفقا لأحكام قانون النشر المصري\\ % License information

\noindent \textit{الطبعة الأولى يناير $2016$} % Printing/edition date

\pagestyle{empty} % No headers

\tableofcontents % Print the table of contents itself

\cleardoublepage % Forces the first chapter to start on an odd page so it's on the right

\pagestyle{fancy} % Print headers again

\chapter{علوم الحاسوب}
يعود تاريخ علوم الحاسوب إلى اختراع أول حاسوب رقمي حديث. فقبل العشرينات من القرن العشرين.

\section{تاريخ}
كان مصطلح حاسوب \textLR{Computer} يشير إلى أي أداة بشرية تقوم بعملية الحسابات. ما هي القضايا أو الأشياء التي يمكن لآلة أن تحسبها باتباع قائمة من التعليمات مع ورقة وقلم، دون تحديد للزمن اللازم ودون أي مهارات أو بصيرة (ذكاء)؟ وكان أحد دوافع هذه الدراسات هو تطوير آلات حاسبة \textLR{computing machines} يمكنها إتمام الأعمال الروتينية والعرضة للخطأ البشري عند إجراء حسابات بشرية.
خلال الأربعينات، مع تطوير آلات حاسبة أكثر قوة وقدرة حسابية، تتطور مصطلح حاسوب ليشير إلى الآلات بدلا من الأشخاص الذين يقومون بالحسابات. وأصبح من الواضح أن الحواسيب يمكنها أن تقوم بأكثر من مجرد عمليات حسابية وبالتالي انتقلوا لدراسة تحسيب أو التحسيب بشكل عام. بدأت المعلوماتية وعلوم الحاسب تأخذ استقلالها كفرع أكاديمي مستقل في الستينات، مع إيجاد أوائل أقسام علوم الحاسب في الجامعات وبدأت الجامعات تعطي إجازات في هذه العلوم  
\cite{wiki}. 

\begin{mytheorem}
القوة هي حاصل ضرب العجلة في الكتلة 
\end{mytheorem}

\begin{thebibliography}{99}
\bibitem{wiki}
       من ويكيبيديا، الموسوعة الحرة
\end{thebibliography}
\end{document}

We obtain :

enter image description here

You can also use the package tcolorbox instead of mdframed.

1
  • @melayadi please accept the anwer
    – pluton
    Jan 4, 2016 at 2:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .