Como escrever a legenda de uma tabela em inglês em persa ao usar o pacote xepersian?

Como escrever a legenda de uma tabela em inglês em persa ao usar o pacote xepersian?

Estou escrevendo um relatório usando o pacote documentclass{report}and xepersian. Tenho algumas tabelas em inglês, mas quero que a legenda seja em persa. Como utilizo o xepersianpacote, tenho que colocar a mesa em um latinambiente e acho que por isso não consigo escrever a legenda em persa.

Eu uso o seguinte código:

\documentclass[a4paper,12pt]{report}‎
‎\usepackage{xepersian}‎
‎\settextfont[Scale=1.3]{B Nazanin}‎
\begin{document}
‎\begin{latin}‎
‎\begin{table}[h!]‎‎
\large
‎\centering‎
‎\begin{tabular}{|l|}‎ 
 ‎\hline‎ 
 ‎\textbf{Proximal Forward-Backward Splitting}\\ [0.5ex]‎ 
 ‎\hline‎
 ‎set $x_0 = A^Tb$‎ , ‎n=0 \\‎ 
 ‎choose the number of iteration‎, ‎$N_{it}$‎, ‎and the step-size‎, ‎$\gamma_{n}$\\‎
 ‎\textbf{for} $n=1$ to $N_{it}$ \textbf{do} \\‎
‎\qquad $ x_{n+\frac{1}{2}} = x_n‎ + ‎\gamma_n A^T(b-Ax_n)$\\‎
‎\qquad$x_{n+1} = prox_{\tau \varphi \gamma_n}(x_{n+\frac{1}{2}})$\\‎
 ‎\textbf{end}\\‎
 ‎\hline‎
‎\end{tabular}‎
‎\caption{الگوریتم شماره دو}‎
‎\label{table:2}‎
‎\end{table}‎
‎\end{latin}‎ 

\end{document}

Responder1

Você tem duas opções.

  1. Você deseja seu rótulo de legenda em LTR (inglês).

    Neste caso basta usar

    \caption{\rl{الگوریتم شماره دو}}
    

    MWE:

    \documentclass[a4paper,12pt]{report}
    \usepackage{xepersian}
    \settextfont[Scale=1.3]{B Nazanin}
    \begin{document}
    \begin{latin}
    \begin{table}[h!]
    \large
    \centering
    \begin{tabular}{|l|}
     \hline
     \textbf{Proximal Forward-Backward Splitting}\\ [0.5ex]
     \hline
     set $x_0 = A^Tb$ , n=0 \\
     choose the number of iteration, $N_{it}$, and the step-size, $\gamma_{n}$\\
     \textbf{for} $n=1$ to $N_{it}$ \textbf{do} \\
    \qquad $ x_{n+\frac{1}{2}} = x_n + \gamma_n A^T(b-Ax_n)$\\
    \qquad$x_{n+1} = prox_{\tau \varphi \gamma_n}(x_{n+\frac{1}{2}})$\\
     \textbf{end}\\
     \hline
    \end{tabular}
    \caption{\rl{الگوریتم شماره دو}}
    \label{table:2}
    \end{table}
    \end{latin}
    
    \end{document} 
    

    Saída:

    insira a descrição da imagem aqui

  2. Você deseja seu rótulo de legenda em RTL (persa).

    Nesse caso, coloque apenas o tabularambiente em um latinambiente, em vez do todo table.

    MWE:

    \documentclass[a4paper,12pt]{report}
    \usepackage{xepersian}
    \settextfont[Scale=1.3]{B Nazanin}
    \begin{document}
    \begin{table}[h!]
    \large
    \centering
    \begin{latin}
    \begin{tabular}{|l|}
     \hline
     \textbf{Proximal Forward-Backward Splitting}\\ [0.5ex]
     \hline
     set $x_0 = A^Tb$ , n=0 \\
     choose the number of iteration, $N_{it}$, and the step-size, $\gamma_{n}$\\
     \textbf{for} $n=1$ to $N_{it}$ \textbf{do} \\
    \qquad $ x_{n+\frac{1}{2}} = x_n + \gamma_n A^T(b-Ax_n)$\\
    \qquad$x_{n+1} = prox_{\tau \varphi \gamma_n}(x_{n+\frac{1}{2}})$\\
     \textbf{end}\\
     \hline
    \end{tabular}
    \end{latin}
    \caption{الگوریتم شماره دو}
    \label{table:2}
    \end{table}
    
    \end{document} 
    

    Saída:

    insira a descrição da imagem aqui

informação relacionada