使用 xepersian 套件時如何用波斯語編寫英文表格的標題?

使用 xepersian 套件時如何用波斯語編寫英文表格的標題?

documentclass{report}我正在使用and包編寫報告xepersian。我有一些英文表格,但我希望標題是波斯語。由於我使用該xepersian包,我必須將表格放在一個latin環境中,因此我認為我無法用波斯語編寫標題。

我使用以下程式碼:

\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}

答案1

你有兩個選擇。

  1. 您希望您的標題標籤採用 LTR(英文)格式。

    在這種情況下只需使用

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

    微量元素:

    \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} 
    

    輸出:

    在此輸入影像描述

  2. 您希望您的標題標籤採用 RTL(波斯語)格式。

    在這種情況下,僅將tabular環境放入環境中latin,而不是整個table.

    微量元素:

    \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} 
    

    輸出:

    在此輸入影像描述

相關內容