From ee2efa8348a6a853c496cead8082fc139448f41f Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Thu, 14 Jun 2018 09:07:28 +0200
Subject: use etoc for the tableofcontents

---
 arabluatex.dtx | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

(limited to 'arabluatex.dtx')

diff --git a/arabluatex.dtx b/arabluatex.dtx
index 128a78f..790b13c 100644
--- a/arabluatex.dtx
+++ b/arabluatex.dtx
@@ -178,7 +178,7 @@
   pdfmetalang={en-US}, pdftype={Text}, pdfkeywords={Arabic language,
     arabtex, luatex}}
 \usepackage[scale=1.5]{ccicons}
-\usepackage[toc,lot]{multitoc}
+\usepackage[lot]{multitoc}
 \usepackage{enumitem}
 \setlist{nosep}
 \setlist[itemize]{label=\textendash}
@@ -220,6 +220,26 @@
 \usepackage[style=authoryear, indexing=cite]{biblatex}
 \DeclareIndexFieldFormat{indextitle}{\index{#1=\emph{#1}}}
 \addbibresource{arabluatex.bib}
+\usepackage{etoc}
+\etocsettocdepth{paragraph}
+\newcommand{\altableofcontents}{%
+  \begingroup
+  \etocsetstyle{section}{}{}
+  {\etocsavedsectiontocline{%
+      \numberline{\etocnumber}\etocname}{\etocpage}}{}
+  \etocsetstyle{subsection}{}{}
+  {\etocsavedsubsectiontocline{%
+      \numberline{\etocnumber}\etocname}{\etocpage}}{}%
+  \etocsetstyle{subsubsection}{}{}
+  {\etocsavedsubsubsectiontocline{%
+      \numberline{\etocnumber}\etocname}{\etocpage}}{}%
+  \etocsetstyle{paragraph}{}{\leftskip2cm\rightskip 2.2em \parfillskip
+    0pt plus 1fil\relax \nobreak}
+  {\noindent\etocname{} \etocpage{} }{\par}%
+  \etocmulticolstyle[2]{\section*{Contents}}
+  \pdfbookmark[1]{Contents}{toc}
+  \tableofcontents
+  \endgroup}
 \EnableCrossrefs
 \RecordChanges
 \CodelineIndex
@@ -305,8 +325,7 @@
 % 
 % \maketitle
 % \footnotesize
-% \tableofcontents
-% \pagebreak
+% \altableofcontents
 % \listoftables
 % \normalsize
 % 
@@ -3497,7 +3516,7 @@ qAla barzawayhi bn-u 'azhar-a, ra's-u 'a.tibbA'-i fAris-a...
 % \fi
 \begin{arabluacode}
 \begin{arab}
-  \arbcolor[red]{\uc{m}uha_d_dabu \uc{'l-d}Ini \uc{`a}bdu
+  \textcolor{red}{\uc{m}uha_d_dabu \uc{'l-d}Ini \uc{`a}bdu
     \uc{'l-r}a.hImi bnu \uc{`a}liyyiN} huwa ^say_hu-nA 'l-'imAmu
   'l-.sadru 'l-kabIru 'l-`Alimu 'l-fA.dilu \uc{m}uha_d_dabu
   \uc{'l-d}Ini \uc{'a}bU \uc{m}u.hammadiN \uc{`a}bdu
@@ -3505,7 +3524,7 @@ qAla barzawayhi bn-u 'azhar-a, ra's-u 'a.tibbA'-i fAris-a...
   bi-\uc{'l-d}a_hwari.
 \end{arab}
 \begin{arab}[trans]
-  \arbcolor[red]{\uc{m}uha_d_dabu \uc{'l-d}Ini \uc{`a}bdu
+  \textcolor{red}{\uc{m}uha_d_dabu \uc{'l-d}Ini \uc{`a}bdu
     \uc{'l-r}a.hImi bnu \uc{`a}liyyiN} huwa ^say_hu-nA 'l-'imAmu
   'l-.sadru 'l-kabIru 'l-`Alimu 'l-fA.dilu \uc{m}uha_d_dabu
   \uc{'l-d}Ini \uc{'a}bU \uc{m}u.hammadiN \uc{`a}bdu
-- 
cgit v1.2.3

