xepersian & polyglossia:尽管德语是主要语言,但章节编号是 rtl

xepersian & polyglossia:尽管德语是主要语言,但章节编号是 rtl

我有一份包含波斯语元素的文档。为了正确排版,我使用了xepersian。不幸的是,这导致所有小节的编号都是 RTL 而不是 LTR,因此是 1.2.3 而不是 3.2.1。

我得到了什么

我该如何改变这种情况?

最小工作示例:

\documentclass[11pt,a4paper]{article}

% Font and Language Packages
\usepackage{fontspec}          % For font customization
\usepackage{xunicode}          % Extra Unicode support
\usepackage{polyglossia}       % Multilingual support
\usepackage{xepersian}         % Persian (Farsi) support

% Define the Persian (Farsi) font
\newfontfamily\persianfont[Script=Arabic]{Amiri}

% Set Document Languages
\setmainlanguage{german}        % Main document language
\setotherlanguages{persian, english} % Other languages used in the document

\begin{document}

% Table of Contents
\tableofcontents

% Sections and Subsections
\section{Einleitung} % German section
This is the introduction section.

\section{Pahlavi-Zukunftsvisionen} % German section
This is the Pahlavi-Zukunftsvisionen section.

\section{Exil-Zukunfts-Vergangenheits-Träumereien} % German section
A section containing subsections.

\subsection{QQ Bang Bang} % German subsection
This is the QQ Bang Bang subsection.

\subsubsection{Erinnerungen und Nostalgie} % German sub-subsection
This is the Erinnerungen und Nostalgie sub-subsection.

\subsection{Another Subsection} % German subsection
This is another subsection.

% Persian Text
\begin{persian}
این یک پاراگراف متن نمونه به زبان فارسی است. % A paragraph of Persian (Farsi) text.

این یک مثال از یک شعر به زبان فارسی است: % An example of a Persian (Farsi) poem.
\end{persian}

% English Text
\begin{english}
This is a paragraph of dummy text in English. % A paragraph of English text.
\end{english}

\end{document}

答案1

xepersian当您的主要文本是波斯语时,此包非常有用,否则您必须配置很多东西才能有效使用它。相反,我建议使用该bidi包,假设您只有少量波斯语句子。

这里我定义了一个新命令\persiantext,将文本方向设置为从右到左,并使用正确的字体。当您有一些波斯语文本时,您只需使用它。

\documentclass[11pt,a4paper]{article}

% Font and Language Packages
\usepackage{fontspec}          % For font customization
\usepackage{xunicode}          % Extra Unicode support
\usepackage{polyglossia}       % Multilingual support
\usepackage{bidi}              % For RTL support

% Define the Persian (Farsi) font
\newfontfamily{\persianfont}[Script=Arabic]{Vazirmatn}

% Set Document Languages
\setmainlanguage{german}        % Main document language
\setotherlanguages{persian,english} % Other languages used in the document

% Command to set the text direction and font for Persian text
\newcommand{\persiantext}[1]{\begin{RTL} {\persianfont #1} \end{RTL}}

\begin{document}

% Table of Contents
\tableofcontents

% Sections and Subsections
\section{Einleitung} % German section
This is the introduction section.

\section{Pahlavi-Zukunftsvisionen} % German section
This is the Pahlavi-Zukunftsvisionen section.

\section{Exil-Zukunfts-Vergangenheits-Träumereien} % German section
A section containing subsections.

\subsection{QQ Bang Bang} % German subsection
This is the QQ Bang Bang subsection.

\subsubsection{Erinnerungen und Nostalgie} % German sub-subsection
This is the Erinnerungen und Nostalgie sub-subsection.

\subsection{Another Subsection} % German subsection
This is another subsection.

% Persian Text
\persiantext{
این یک پاراگراف متن نمونه به زبان فارسی است. % A paragraph of Persian (Farsi) text.

این یک مثال از یک شعر به زبان فارسی است: % An example of a Persian (Farsi) poem.
}

% English Text
\begin{english}
This is a paragraph of dummy text in English. % A paragraph of English text.
\end{english}

\end{document}

在此处输入图片描述

相关内容