I'm currently working on a book, and I want to create a list of examples. I tried lots of solutions available online, but none suited me well - see for example: https://texblog.org/2008/07/13/define-your-own-list-of/#comments My book is written in Arabic. Here is my MWE.
\documentclass[12pt,a4paper,openany]{book} \usepackage{polyglossia} \usepackage[top=2cm,bottom=2cm, left=3cm,right=2cm,headheight=17pt,includehead, includefoot,heightrounded]{geometry} \usepackage{fancyhdr} \pagestyle{fancy} \fancyhf{} \fancyhead[RE,LO]{\thepage} \fancyhead[LE]{\small\leftmark} \fancyhead[RO]{\small\rightmark} \usepackage{natbib} \RequirePackage[linkcolor=black,bookmarksnumbered,pagebackref=true]{hyperref} \hypersetup{colorlinks,citecolor=purple,linkcolor=blue} \usepackage[titles]{tocloft} \usepackage{amsthm} \usepackage{dingbat}% for typing pencil with: \smallpencil \theoremstyle{definition} \newtheorem{definition}{تعریف}[chapter] \newtheorem{example}[definition]{\smallpencil مثال} \setmainlanguage{arabic} \setotherlanguage{english} \setmainfont[Scale=1.2]{Arial}%{Amiri}%{Traditional Arabic} \begin{document} جميع حقوق النشر والنسخ، التصوير الليزري، الترجمة، الاقتباس و ... من هذا الكتاب محفوظة. إن نقل واقتباس الموضوعات مع الإرجاع لهذا الكتاب مسموح وبلا مانع. \tableofcontents\addtocontents{toc}{\linespread{1.25}\selectfont}%to change line spacing in table of contents \chapter{الفصل الأول} \section{الاختبار الأول} نص ما أول \section{الاختبار الثاني} نص ما ثاني \chapter{الفصل الثاني} \section{الاختبار الأول} نص ما أول \section{الاختبار الثاني} ما ثاني نص \begin{example} ن إنجاز الاختبار $H_0:\beta_1=0$ مقابل $H_1:\beta_1\neq0$ عند المستوى $\alpha=0.05$ باعتماد الإحصاء يتم كما يلي \end{example} \end{document} As I was advised by @mbert comments I edited the question a little bit. The final code I tried is this:
\documentclass[12pt,a4paper,openany]{book} \usepackage{polyglossia} \usepackage[top=2cm,bottom=2cm, left=3cm,right=2cm,headheight=17pt,includehead, includefoot,heightrounded]{geometry} \usepackage{fancyhdr} \pagestyle{fancy} \fancyhf{} \fancyhead[RE,LO]{\thepage} \fancyhead[LE]{\small\leftmark} \fancyhead[RO]{\small\rightmark} \usepackage{natbib} \RequirePackage[linkcolor=black,bookmarksnumbered,pagebackref=true]{hyperref} \hypersetup{colorlinks,citecolor=purple,linkcolor=blue} \usepackage[titles]{tocloft} \usepackage{amsthm} \usepackage{dingbat}% for typing pencil with: \smallpencil \theoremstyle{definition} \newtheorem{definition}{تعریف}[chapter] \newtheorem{example}[definition]{\smallpencil مثال} \usepackage{thmtools} \declaretheorem[name=مثال]{example} \renewcommand{\listoftheoremname}{قائمة الأمثلة}%the Arabic of List of examples \setmainlanguage{arabic} \setotherlanguage{english} \setmainfont[Scale=1.2]{Arial}%{Amiri}%{Traditional Arabic} \begin{document} جميع حقوق النشر والنسخ، التصوير الليزري، الترجمة، الاقتباس و ... من هذا الكتاب محفوظة. إن نقل واقتباس الموضوعات مع الإرجاع لهذا الكتاب مسموح وبلا مانع. \tableofcontents\addtocontents{toc}{\linespread{1.25}\selectfont}%to change line spacing in table of contents \begingroup \let\footnotemark\relax \listoftheorems[ignoreall,show={example}] \endgroup \chapter{الفصل الأول} \section{الاختبار الأول} نص ما أول \section{الاختبار الثاني} نص ما ثاني \chapter{الفصل الثاني} \section{الاختبار الأول} نص ما أول \section{الاختبار الثاني} ما ثاني نص \begin{example} ن إنجاز الاختبار $H_0:\beta_1=0$ مقابل $H_1:\beta_1\neq0$ عند المستوى $\alpha=0.05$ باعتماد الإحصاء يتم كما يلي \end{example} \end{document} I got two errors and one problem. The first error says "LaTeX Error: Command \example already defined", but I need this " \newtheorem{example}[definition]{\smallpencil مثال} " to get section and chapter with small pencil shape. The second error says " LaTeX Error: \listoftheoremname undefined." Now, concerning the resulted problem, the result is good as it prints chapter and section of examples, but the title is in English "List of theorems", instead of Arabic.
So, I re-frame my question. I need three things: 1- using \begin{example} ... \end{example}, which is also in the referenced link given by by @mbert. 2- I need to print the small pencil shape, and to print the Arabic title instead of "List of Theorems" .


hyperreftoo late. Can you use a font everyone has? Arial is proprietary. A font from TeX Live is generally ideal.\listoftheoremscommand. You can give it the optionsignoreall,show=exampleto list only examples