ترتیبی کردن شماره فصل در متن
در این پرسش و پاسخ کد زیر برای ترتیبی کردن شماره فصل در متن پیشنهاد شده است:
\documentclass{book}
\usepackage{xepersian}
\settextfont{Yas}
\makeatletter
\bidi@patchcmd{\@makechapterhead}{\thechapter}{\tartibi{chapter}}
{\typeout{Suceeded}}{\typeout{Failed}}
\makeatother
\begin{document}
\chapter{فصلی آزمایشی}
\end{document}
ترتیبی کردن شماره فصل در فهرست مطالب
در این پرسش و پاسخ کدهای زیر بسته به فراخوانی بسته hyperref برای ترتیبی کردن شماره فصل در فهرست مطالب پیشنهاد شدهاند.
بدون فراخوانی بسته hyperref
\documentclass{book}
\usepackage{xepersian}
\settextfont{Yas}
\makeatletter
\bidi@patchcmd{\@chapter}{%
\addcontentsline{toc}{chapter}%
{\protect\numberline{\thechapter}#1}%
}{%
\addcontentsline{toc}{chapter}%
{\protect\numberline{\chaptername~\tartibi{chapter}}#1}%
}{\typeout{We succeded in redefining \string\@chapter}}
{\typeout{We failed in redefining \string\@chapter}}
\bidi@patchcmd{\l@chapter}{%
\setlength\@tempdima{1.5em}%
}{%
\setlength\@tempdima{4em}%
}{\typeout{We succeded in redefining \string\l@chapter}}
{\typeout{We failed in redefining \string\l@chapter}}
\makeatother
\begin{document}
\tableofcontents
\chapter{همینجوری}
\end{document}
با فراخوانی بسته hyperref
\documentclass{book}
\usepackage{hyperref}
\usepackage{xepersian}
\settextfont{Yas}
\makeatletter
\bidi@patchcmd{\Hy@org@chapter}{%
\addcontentsline{toc}{chapter}%
{\protect\numberline{\thechapter}#1}%
}{%
\addcontentsline{toc}{chapter}%
{\protect\numberline{\chaptername~\tartibi{chapter}}#1}%
}{\typeout{We succeded in redefining \string\@chapter}}
{\typeout{We failed in redefining \string\@chapter}}
\bidi@patchcmd{\l@chapter}{%
\setlength\@tempdima{1.5em}%
}{%
\setlength\@tempdima{4em}%
}{\typeout{We succeded in redefining \string\l@chapter}}
{\typeout{We failed in redefining \string\l@chapter}}
\makeatother
\begin{document}
\tableofcontents
\chapter{همینجوری}
\end{document}
توی سیستم جدید فراخوانی بستههای bidi و xepersian این کدها به درستی کار نمیکنند؟ علت چیست؟ و چگونه باید آن را درست کرد؟