بسته bidi باید فراخوانی کلاس book و report رو با بسته flowfram چک کنه. توی سیستم قدیمی فراخوانی بستهها چون بسته bidi آخرین بستهای بود که فراخوانی میشد انجام این کار ساده بود اما توی سیستم جدید فراخوانی بستهها معلوم نیست کاربر کجا بسته flowfram رو فراخوانی میکنه و در نتیجه بسته bidi باید تغییرات مربوط به کلاس book رو خیلی دیر انجام بده در نتیجه تغییرات کدهای پرسش در ماکروی \@makechapterhead و \l@chapter بازنویسی میشه و ماکروی موجود در کدهای بالا تاثیری ندارد. برای داشتن خروجی مناسب باید بازتعریف این دستور رو پس از تغییرات بسته bidi قرار بدهید تا توسط بسته bidi بازنویسی نشه.
همچنین به دلیل تغییر در بسته hyperref، هنگام فراخوانی بسته hyperref باید ماکروی \NR@chapter را تغییر دهیم نه ماکروی \Hy@org@chapter.
ترتیبی کردن شماره فصل در متن
\documentclass{book}
\usepackage{xepersian}
\settextfont{IRXLotus}
\makeatletter
\ApplyPatchCodeToFile{book-xetex-bidi}{%
\bidi@patchcmd{\@makechapterhead}{\thechapter}{\tartibi{chapter}}
{\typeout{Suceeded}}{\typeout{Failed}}%
}
\makeatother
\begin{document}
\chapter{فصلی آزمایشی}
\end{document}
ترتیبی کردن شماره فصل در فهرست مطالب
بدون فراخوانی بسته hyperref
\documentclass{book}
\usepackage{xepersian}
\settextfont{IRXLotus}
\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}}
\ApplyPatchCodeToFile{book-xetex-bidi}{%
\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{IRXLotus}
\makeatletter
\bidi@patchcmd{\NR@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}}
\ApplyPatchCodeToFile{book-xetex-bidi}{%
\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}