1

According to This question the word "Table of content"(in persian"فهرست"), has been removed. I want it back. What can I do?

CODE

\documentclass[twoside]{book} \usepackage{tikz} \usetikzlibrary{shadows.blur} \usepackage{titletoc} \usepackage{lipsum} \usepackage{calc} \usepackage[]{titlesec} \definecolor{yourcolor}{HTML}{008bb2} \usepackage{xepersian} \settextfont{Yas} \colorlet{chpnumbercolor}{black} \makeatletter \let\oldl@chapter\l@chapter \def\l@chapter#1#2{\oldl@chapter{#1}{\textcolor{chpnumbercolor}{ #2}}} \let\old@dottedcontentsline\@dottedtocline \def\@dottedtocline#1#2#3#4#5{% \old@dottedcontentsline{#1}{#2}{#3}{#4}{{\textcolor{chpnumbercolor}{#5}}}} \makeatother \titleformat{\chapter}[display] {\normalfont\color{yourcolor}} {\filleft\Huge\sffamily\bfseries\chaptertitlename\hspace*{2mm}% \begin{tikzpicture}[baseline={([yshift=-.6ex]current bounding box.center)}] \node[fill=yourcolor,circle,text=white] {\rl{\thechapter}}; \end{tikzpicture}} {1ex} {\titlerule[1.5pt]\vspace*{5ex}\huge\sffamily\itshape} [] \titleformat{name=\chapter,numberless}[display] {\normalfont\color{yourcolor}} {} {1ex} {\vspace*{5ex}\huge\sffamily\itshape} [] %command to print the acutal minitoc \newcommand{\printmyminitoc}{% \noindent\hspace{-2cm}% \colorlet{chpnumbercolor}{white}% \begin{tikzpicture} \node[rounded corners,align=left,fill=yourcolor, blur shadow={shadow blur steps=5}, inner sep=5mm]{% \color{white}% \begin{minipage}{8cm}%minipage trick \begin{RTL} \printcontents[chapters]{}{1}{} \end{RTL} \end{minipage}}; \end{tikzpicture}} \begin{document} \tableofcontents \chapter{\rl{فصل اول}} \startcontents[chapters] %print minitoc \printmyminitoc \section{سکشن اول} \lipsum[1] \section{سکشن دوم} \section{تست} \section{الف ب پ} \lipsum \chapter{\rl{فصل دوم}} \end{document} 

it should be like below: enter image description here

2 Answers 2

1

I think titlesec overwrite the contentsname you can restore it with

\renewcommand{\contentsname}{\rl{فهرست}} 

Code

\documentclass[twoside]{book} \usepackage{tikz} \usetikzlibrary{shadows.blur} \usepackage{titletoc} \usepackage{lipsum} \usepackage{calc} \usepackage[]{titlesec} \definecolor{yourcolor}{HTML}{008bb2} \usepackage{xepersian} \settextfont{Yas} \colorlet{chpnumbercolor}{black} \makeatletter \let\oldl@chapter\l@chapter \def\l@chapter#1#2{\oldl@chapter{#1}{\textcolor{chpnumbercolor}{ #2}}} \let\old@dottedcontentsline\@dottedtocline \def\@dottedtocline#1#2#3#4#5{% \old@dottedcontentsline{#1}{#2}{#3}{#4}{{\textcolor{chpnumbercolor}{#5}}}} \makeatother \renewcommand{\contentsname}{\rl{فهرست}} \titleformat{\chapter}[display] {\normalfont\color{yourcolor}} {\filleft\Huge\sffamily\bfseries\chaptertitlename\hspace*{2mm}% \begin{tikzpicture}[baseline={([yshift=-.6ex]current bounding box.center)}] \node[fill=yourcolor,circle,text=white] {\rl{\thechapter}}; \end{tikzpicture}} {1ex} {\titlerule[1.5pt]\vspace*{5ex}\huge\sffamily\itshape} [] \titleformat{name=\chapter,numberless}[display] {\normalfont\color{yourcolor}} {} {1ex} {\vspace*{5ex}\huge\sffamily\itshape} [] %command to print the acutal minitoc \newcommand{\printmyminitoc}{% \noindent\hspace{-2cm}% \colorlet{chpnumbercolor}{white}% \begin{tikzpicture} \node[rounded corners,align=left,fill=yourcolor, blur shadow={shadow blur steps=5}, inner sep=5mm]{% \color{white}% \begin{minipage}{8cm}%minipage trick \begin{RTL} \printcontents[chapters]{}{1}{} \end{RTL} \end{minipage}}; \end{tikzpicture}} \begin{document} \tableofcontents \chapter{\rl{فصل اول}} \startcontents[chapters] %print minitoc \printmyminitoc \section{سکشن اول} \lipsum[1] \section{سکشن دوم} \section{تست} \section{الف ب پ} \lipsum \chapter{\rl{فصل دوم}} \end{document} 
0
0

As mentioned in this site, /sffamily is problem.

By removing it we can restore the word.

Tanks to Vahid Damanafshan

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.