%%
%% This is file `latex-localize-misc-xetex-xepersian.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xepersian.dtx  (with options: `table,latex-localize-misc-xetex-xepersian.def')
%% 
%%   __________________________________________________
%%   Vafa Khalighi
%% 
%%   Copyright (c) 2008--2025  Vafa Khalighi
%%   Copyright (c) 2018--2020 bidi-tex GitHub Organization
%% 
%%   It may be distributed and/or modified under the LaTeX Project Public License,
%%   version 1.3c or higher (your choice). The latest version of
%%   this license is at: http://www.latex-project.org/lppl.txt
%% 
%%   This work is “author-maintained” (as per LPPL maintenance status)
%%   by Vafa Khalighi.
%% 
%% 
%% \CheckSum{10823}
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\ProvidesFile{latex-localize-misc-xetex-xepersian.def}[2025/01/03 v0.3 miscellaneous Persian localization of LaTeX2e for XeTeX engine]
\تر\گرجدید#1{%
\شمار@\نویسه‌ویژه     \نویسه‌ویژه\من@ا
 \بگذار#1\گرنادرست
\@گر#1\گردرست
\@گر#1\گرنادرست
\نویسه‌ویژه\شمار@}
\تر\@گر#1#2{%
\بگسترپس‌از\تر\نام‌فرمان\بگسترپس‌از\@خورحریصانه‌دو\رشته#1%
\بگسترپس‌از\@خورحریصانه‌دو\رشته#2\پایان‌نام‌فرمان
{\بگذار#1#2}}
\بگذار\تعریف‌نشده\undefined

\تر\حلقه#1\ازنو{\تر\تکرارکن{#1\راحت\بگسترپس‌از\تکرارکن\رگ}%
  \تکرارکن \بگذار\تکرارکن\راحت}
\بگذار\ازنو\رگ

\بلند\تر \حلقه #1\ازنو{%
  \تر\تکرارکن{#1\راحت  % \راحت اضافی
               \بگسترپس‌از\تکرارکن\رگ
               }%
  \تکرارکن
  \بگذار\تکرارکن\راحت
}
\بگذار\ازنو=\رگ

\ApplyPatchCodeToFile{latex-xetex-bidi}{%
\def\@xfloat #1[#2]{%
  \@nodocument
  \def \@captype {#1}%
   \def \@fps {#2}%
   \@onelevel@sanitize \@fps
   \def \reserved@b {!}%
   \ifx \reserved@b \@fps
     \@fpsadddefault
   \else
     \ifx \@fps \@empty
       \@fpsadddefault
     \fi
   \fi
   \ifhmode
     \@bsphack
     \@floatpenalty -\@Mii
   \else
     \@floatpenalty-\@Miii
   \fi
  \ifinner
     \@parmoderr\@floatpenalty\z@
  \else
    \@next\@currbox\@freelist
      {%
       \@tempcnta \sixt@@n
       \expandafter \@tfor \expandafter \reserved@a
         \expandafter :\expandafter =\@fps
         \do
          {%
           \if \reserved@a h%
             \ifodd \@tempcnta
             \else
               \advance \@tempcnta \@ne
             \fi
           \fi
           \if \reserved@a ا%
             \ifodd \@tempcnta
             \else
               \advance \@tempcnta \@ne
             \fi
           \fi
           \if \reserved@a t%
             \@setfpsbit \tw@
           \fi
           \if \reserved@a ب%
             \@setfpsbit \tw@
           \fi
           \if \reserved@a b%
             \@setfpsbit 4%
           \fi
           \if \reserved@a ز%
             \@setfpsbit 4%
           \fi
           \if \reserved@a p%
             \@setfpsbit 8%
           \fi
           \if \reserved@a ص%
             \@setfpsbit 8%
           \fi
           \if \reserved@a !%
             \ifnum \@tempcnta>15
               \advance\@tempcnta -\sixt@@n\relax
             \fi
           \fi
           }%
       \@tempcntb \csname ftype@\@captype \endcsname
       \multiply \@tempcntb \@xxxii
       \advance \@tempcnta \@tempcntb
       \global \count\@currbox \@tempcnta
       }%
    \@fltovf
  \fi
  \global \setbox\@currbox
    \color@vbox
      \normalcolor
      \vbox \bgroup
        \hsize\columnwidth
        \@parboxrestore
        \@floatboxreset
}
\let\bm@و\bm@c
\let\bm@چ\bm@l
\let\bm@ر\bm@r
\let\bm@ز\bm@b
\let\bm@ب\bm@t
\let\bm@ک\bm@s
\long\def\@iiiparbox#1#2[#3]#4#5{%
  \leavevmode
  \@pboxswfalse
  \if@hboxRconstruct\@bidi@list@minipage@parbox@not@nobtrue\fi
  \if@RTL\if#1t\@bidi@list@minipage@parboxtrue\else\if#1b\@bidi@list@minipage@parboxtrue\else\if#1ز\@bidi@list@minipage@parboxtrue\else\if#1ب\@bidi@list@minipage@parboxtrue\fi\fi\fi\fi\fi
  \setlength\@tempdima{#4}%
  \@begin@tempboxa\vbox{\hsize\@tempdima\@parboxrestore#5\@@par}%
    \ifx\relax#2\else
      \setlength\@tempdimb{#2}%
      \edef\@parboxto{to\the\@tempdimb}%
    \fi
    \if#1b\vbox
    \else\if#1ز\vbox
    \else\if #1t\vtop
    \else\if #1ب\vtop
    \else\ifmmode\vcenter
    \else\@pboxswtrue $\vcenter
    \fi\fi\fi\fi\fi
    \@parboxto{\let\hss\vss\let\unhbox\unvbox
       \csname bm@#3\endcsname}%
    \if@pboxsw \m@th$\fi
  \@end@tempboxa}
\def\@iiiminipage#1#2[#3]#4{%
  \leavevmode
  \@pboxswfalse
    \if@hboxRconstruct\@bidi@list@minipage@parbox@not@nobtrue\fi
    \if@RTL\if#1t\@bidi@list@minipage@parboxtrue\else\if#1b\@bidi@list@minipage@parboxtrue\else\if#1ز\@bidi@list@minipage@parboxtrue\else\if#1ب\@bidi@list@minipage@parboxtrue\fi\fi\fi\fi\fi
  \setlength\@tempdima{#4}%
  \def\@mpargs{{#1}{#2}[#3]{#4}}%
  \setbox\@tempboxa\vbox\bgroup
    \color@begingroup
      \hsize\@tempdima
      \textwidth\hsize \columnwidth\hsize
      \@parboxrestore
      \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@
      \let\@footnotetext\@mpfootnotetext
      \let\@LTRfootnotetext\@mpLTRfootnotetext
      \let\@RTLfootnotetext\@mpRTLfootnotetext
      \let\@listdepth\@mplistdepth \@mplistdepth\z@
      \@minipagerestore
      \@setminipage}
\def\@testpach#1{\@chclass \ifnum \@lastchclass=\tw@ 4 \else
    \ifnum \@lastchclass=3 5 \else
     \z@ \if #1c\@chnum \z@ \else
               \if #1و\@chnum \z@ \else
                              \if \if@RTLtab#1r\else#1l\fi\@chnum \@ne \else
                              \if \if@RTLtab#1ر\else#1چ\fi\@chnum \@ne \else
                              \if \if@RTLtab#1l\else#1r\fi\@chnum \tw@ \else
                              \if \if@RTLtab#1چ\else#1ر\fi\@chnum \tw@ \else
          \@chclass \if #1|\@ne \else
                    \if #1@\tw@ \else
                    \if #1p3    \else
                    \if #1پ3    \else          \z@ \@preamerr 0\fi
  \fi  \fi  \fi  \fi  \fi  \fi \fi \fi \fi \fi
\fi}%
}
\ApplyPatchCodeToFile{array-xetex-bidi}{%
\def\@testpach{\@chclass
 \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
  \ifnum \@lastchclass=7 5 \else
   \ifnum \@lastchclass=8 \tw@ \else
    \ifnum \@lastchclass=9 \thr@@
   \else \z@
   \ifnum \@lastchclass = 10 \else
   \edef\@nextchar{\expandafter\string\@nextchar}%
   \@chnum
   \if \@nextchar c\z@ \else
   \if \@nextchar و\z@ \else
    \if \@nextchar \if@RTLtab r\else l\fi\@ne \else
    \if \@nextchar \if@RTLtab ر\else چ\fi\@ne \else
     \if \@nextchar \if@RTLtab l\else r\fi\tw@ \else
     \if \@nextchar \if@RTLtab چ\else ر\fi\tw@ \else
   \z@ \@chclass
   \if\@nextchar |\@ne \else
    \if \@nextchar !6 \else
     \if \@nextchar @7 \else
      \if \@nextchar <8 \else
       \if \@nextchar >9 \else
  10
  \@chnum
  \if \@nextchar m\thr@@\else
  \if \@nextchar م\thr@@\else
   \if \@nextchar p4 \else
  \if \@nextchar پ4 \else
    \if \@nextchar b5 \else
    \if \@nextchar ز5 \else
   \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi \fi \fi \fi
   \fi \fi  \fi  \fi  \fi  \fi  \fi \fi \fi \fi \fi \fi \fi \fi \fi}%
}
\ApplyPatchCodeToFile{arydshln-xetex-bidi}{
\ifadl@usingarypkg
\def\@testpach{\@chclass
 \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
  \ifnum \@lastchclass=7 5 \else
   \ifnum \@lastchclass=8 \tw@ \else
    \ifnum \@lastchclass=9 \thr@@
   \else \z@
   \ifnum \@lastchclass = 10 \else
   \edef\@nextchar{\expandafter\string\@nextchar}%
   \@chnum
   \if \@nextchar c\z@ \else
    \if \@nextchar و\z@ \else
    \if \@nextchar \if@RTLtab r\else l\fi\@ne \else
    \if \@nextchar \if@RTLtab ر\else چ\fi\@ne \else
     \if \@nextchar \if@RTLtab l\else r\fi\tw@ \else
    \if \@nextchar \if@RTLtab چ\else ر\fi\tw@ \else
   \z@ \@chclass
   \if\@nextchar |\@ne \let\@arrayrule\adl@arrayrule \else
   \if\@nextchar :\@ne \let\@arrayrule\adl@arraydashrule \else
   \if\@nextchar ;\@ne \let\@arrayrule\adl@argarraydashrule \else
    \if \@nextchar !6 \else
     \if \@nextchar @7 \else
      \if \@nextchar <8 \else
       \if \@nextchar >9 \else
  10
  \@chnum
  \if \@nextchar m\thr@@\else
   \if \@nextchar م\thr@@\else
   \if \@nextchar p4 \else
    \if \@nextchar پ4 \else
    \if \@nextchar b5 \else
   \if \@nextchar ز5 \else
   \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi \fi \fi \fi \fi \fi
   \fi \fi  \fi  \fi  \fi  \fi  \fi \fi \fi \fi \fi \fi \fi \fi \fi}

\def\@classz{\@classx
   \@tempcnta \count@
   \prepnext@tok
   \@addtopreamble{\ifcase \@chnum
      \hfil
      \adl@putlrc{\d@llarbegin \insert@column \d@llarend}\hfil \or
      \hskip1sp\adl@putlrc{\d@llarbegin \insert@column \d@llarend}\hfil \or
      \hfil\hskip1sp\adl@putlrc{\d@llarbegin \insert@column \d@llarend}\or
   \setbox\adl@box\hbox \adl@startmbox{\@nextchar}\insert@column
        \adl@endmbox\or
   \setbox\adl@box\vtop \@startpbox{\@nextchar}\insert@column \@endpbox \or
   \setbox\adl@box\vbox \@startpbox{\@nextchar}\insert@column \@endpbox
  \fi}\prepnext@tok}
\def\adl@class@start{4}
\def\adl@class@iiiorvii{7}

\else
\def\@testpach#1{\@chclass \ifnum \@lastchclass=\tw@ 4\relax \else
        \ifnum \@lastchclass=\thr@@ 5\relax \else
                \z@ \if #1c\@chnum \z@ \else
                    \if #1و\@chnum\z@ \else
                    \if \if@RTLtab#1r\else#1l\fi\@chnum \@ne \else
                   \if \if@RTLtab#1ر\else#1چ\fi\@chnum \@ne \else
                    \if \if@RTLtab#1l\else#1r\fi\@chnum \tw@ \else
                     \if \if@RTLtab#1چ\else#1ر\fi\@chnum \tw@ \else
                \@chclass
                    \if #1|\@ne \let\@arrayrule\adl@arrayrule \else
                    \if #1:\@ne \let\@arrayrule\adl@arraydashrule \else
                    \if #1;\@ne \let\@arrayrule\adl@argarraydashrule \else
                    \if #1@\tw@ \else
                    \if #1p\thr@@ \else
                   \if #1پ\thr@@ \else\z@ \@preamerr 0\fi
        \fi  \fi  \fi  \fi  \fi  \fi  \fi  \fi  \fi \fi \fi \fi \fi}

\def\@arrayclassz{\ifcase \@lastchclass \@acolampacol \or \@ampacol \or
                \or \or \@addamp \or
                \@acolampacol \or \@firstampfalse \@acol \fi
        \edef\@preamble{\@preamble
                \ifcase \@chnum
                    \hfil\adl@putlrc{$\relax\@sharp$}\hfil
                \or \adl@putlrc{$\relax\@sharp$}\hfil
                \or \hfil\adl@putlrc{$\relax\@sharp$}\fi}}
\def\@tabclassz{\ifcase \@lastchclass \@acolampacol \or \@ampacol \or
                \or \or \@addamp \or
                \@acolampacol \or \@firstampfalse \@acol \fi
        \edef\@preamble{\@preamble
        \ifcase \@chnum
                    \hfil\adl@putlrc{\@sharp\unskip}\hfil
                \or \adl@putlrc{\@sharp\unskip}\hfil
                \or \hfil\hskip\z@ \adl@putlrc{\@sharp\unskip}\fi}}
\def\adl@class@start{6}
\def\adl@class@iiiorvii{3}
\fi
}
\ApplyPatchCodeToFile{tabulary-xetex-bidi}{%
\def\@testpach{\@chclass
 \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
  \ifnum \@lastchclass=7 5 \else
   \ifnum \@lastchclass=8 \tw@ \else
    \ifnum \@lastchclass=9 \thr@@
   \else \z@
   \ifnum \@lastchclass = 10 \else
   \edef\@nextchar{\expandafter\string\@nextchar}%
   \@chnum
   \if \@nextchar c\z@ \else
    \if \@nextchar و\z@ \else
    \if \@nextchar \if@RTLtab r\else l\fi\@ne \else
     \if \@nextchar \if@RTLtab ر\else چ\fi\@ne \else
     \if \@nextchar \if@RTLtab l\else r\fi\tw@ \else
     \if \@nextchar \if@RTLtab چ\else ر\fi\tw@ \else
   \if \@nextchar C7 \else
   \if \@nextchar س7 \else
    \if \@nextchar L8 \else
    \if \@nextchar ف8 \else
     \if \@nextchar R9 \else
     \if \@nextchar ا9 \else
     \if \@nextchar J10 \else
     \if \@nextchar ت10 \else
   \z@ \@chclass
   \if\@nextchar |\@ne \else
    \if \@nextchar !6 \else
     \if \@nextchar @7 \else
      \if \@nextchar <8 \else
       \if \@nextchar >9 \else
  10
  \@chnum
  \if \@nextchar m\thr@@\else
  \if \@nextchar م\thr@@\else
   \if \@nextchar p4 \else
  \if \@nextcharپ4 \else
    \if \@nextchar b5 \else
  \if \@nextchar ز5 \else
   \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi\fi \fi \fi\fi \fi \fi \fi \fi \fi \fi \fi \fi
     \fi  \fi  \fi  \fi  \fi  \fi \fi \fi \fi \fi \fi \fi \fi \fi}%
}
\ApplyPatchCodeToFile{float-xetex-bidi}{%
\let\@float@Hx\@xfloat
\def\@xfloat#1[{\@ifnextchar{H}{\@float@HH{#1}[}{\@ifnextchar{آ}{\@float@آآ{#1}[}{\@float@Hx{#1}[}}}
\def\@float@HH#1[H]{%
  \expandafter\let\csname end#1\endcsname\float@endH
  \let\@currbox\float@box
  \def\@captype{#1}\setbox\@floatcapt=\vbox{}%
  \expandafter\ifx\csname fst@#1\endcsname\relax
    \@flstylefalse\else\@flstyletrue\fi
  \setbox\@currbox\color@vbox\normalcolor
    \vbox\bgroup \hsize\columnwidth \@parboxrestore
      \@floatboxreset \@setnobreak
  \ignorespaces}
\def\@float@آآ#1[آ]{%
  \expandafter\let\csname end#1\endcsname\float@endH
  \let\@currbox\float@box
  \def\@captype{#1}\setbox\@floatcapt=\vbox{}%
  \expandafter\ifx\csname fst@#1\endcsname\relax
    \@flstylefalse\else\@flstyletrue\fi
  \setbox\@currbox\color@vbox\normalcolor
    \vbox\bgroup \hsize\columnwidth \@parboxrestore
      \@floatboxreset \@setnobreak
  \ignorespaces}
}
\begingroup \catcode `|=0 \catcode `[= 1
\catcode`]=2 \catcode `\{=12 \catcode `\}=12
\catcode`\\=12 |gdef|@x@xepersian@localize@verbatim#1\پایان{همانطورکه‌هست}[#1|پایان[همانطورکه‌هست]]
|gdef|@sx@xepersian@localize@verbatim#1\پایان{همانطورکه‌هست*}[#1|پایان[همانطورکه‌هست*]]
|endgroup
\def\همانطورکه‌هست{\@verbatim \frenchspacing\@vobeyspaces \@x@xepersian@localize@verbatim}
\def\endهمانطورکه‌هست{\if@newlist \leavevmode\fi\endtrivlist}
\ExplSyntaxOn
\AtBeginDocument{\@namedef{همانطورکه‌هست*}{\@verbatim \fontspec_print_visible_spaces: \@sx@xepersian@localize@verbatim}}
\ExplSyntaxOff
\expandafter\let\csname endهمانطورکه‌هست*\endcsname =\endهمانطورکه‌هست
\endinput
%%
%% End of file `latex-localize-misc-xetex-xepersian.def'.
