This site will go down shortly. If you need any help, then please subscribe to The Persian TeX discussion mailing list
ask now - it's free

Most popular questions within the last 3 days

Most active Members
this month:
    0 votes
    34 views

    I used algorithm2e to write some algorithms with Persian commands and it worked fine. But when I compile the same files with the current version of TexLive 2018, some of the lines moves to left. I guess its problem is when the algorithm wants to indent some lines which are within the condition or loop commands. The caption of the algorithm is also in wrong order.

    \documentclass{book}
    
      % Any packages other than the xepersian package must be loaded here
    \usepackage[algochapter,linesnumbered]{algorithm2e}
    
      % The xepersian package must be loaded as the last package
    \usepackage{xepersian}
    \settextfont[Scale=1]{Yas}
    \setlatintextfont[Scale=0.9]{Arial}
    \setdigitfont[Scale=0.9]{Yas}
    
      % Any preamble code goes here
    \SetAlgorithmName{الگوریتم}{الگوریتم}{لیست الگوریتمها}
    \SetKwInput{KwIn}{ورودی}
    \SetKwInput{KwOut}{خروجی}
    \SetKw{KwRet}{برگردان}
    \SetKw{Return}{را~برگردان}
    \SetKw{ReturnZero}{برگرد}
    \SetKw{Start}{شروع}
    \SetKw{End}{پایان}
    \SetKw{Get}{را~بگیر}
    \SetKw{Print}{را~چاپ~کن}
    \SetKwFor{For}{برای}{..}{...}
    \SetKwIF{If}{ElseIf}{Else}{اگر}{آنگاه}{درغیراینصورت اگر}{درغیراینصورت}{پایان~اگر}
    
    \begin{document}
    
      % Demonstration of issue here
      \chapter{}
    \section{}
    
    \begin{algorithm}[H]
    \DontPrintSemicolon
     \Start\;
    $n$   \Get\;
    $i\leftarrow 1$ و $FACT\leftarrow 1$\;
    \If{$i\leq n$}{
            $FACT\leftarrow FACT \times i$\;
            $i\leftarrow i+1$\;
            به خط 4 برو\;
        }
    $FACT$ \Print\;
     \End
     \caption{ الگوریتم  محاسبۀ فاکتوریل  یک عدد }\label{alg:fact}
    \end{algorithm}
    
    \end{document}
    
    Uploaded File:
    asked by (3.1k points)
    ...