修复具有多语言特性的 RTL 语言中嵌套的章节编号。

修复具有多语言特性的 RTL 语言中嵌套的章节编号。

第一节第二小节的第三小节应该编号为 1.2.3。这也适用于 RTL 语言,因为数字(包括杜威编号)即使在 RTL 语言中仍然是 LTR。Babel 似乎有这个权利,但 polyglossia 会让人感到困惑。你如何解决这个问题?

以下是一个例子:

\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{hebrew}
\setotherlanguage{english}
\newfontfamily\hebrewfont[Script=Hebrew]{Ezra SIL}% or{SBL Hebrew}

\begin{document}
\section{1st Sect. Should be \#1}
\subsection{1st Subsect. Should be \#1.1}
\subsubsection{1st Subsubsect. Should be \#1.1.1}
\subsubsection{2nd Subsubsect. Should be \#1.1.2}
\subsection{2nd Subsect. Should be Numbered 1.2}
\section{2nd Sect. Should be \#2}
\subsection{1st Subsect. Should be \#2.1}
\subsubsection{1st Subsubsect. Should be \#2.1.1}
\subsubsection{2nd Subsubsect. Should be \#2.1.2}
\subsubsection{3rd Subsubsect. Should be \#2.1.3}
\subsection{2nd Subsect. Should be \#2.2}
\subsubsection{1st Subsubsect. Should be \#2.2.1}
\subsubsection{2nd Subsubsect. Should be \#2.2.2}
\end{document}

答案1

将其放在文档的序言中,它将产生您想要的结果,但我不认为这是正确的做法:

\makeatletter
\renewcommand{\SepMark}[1]{\def\@SepMark{#1}}
\makeatother
\SepMark{.}

答案2

我不知道所有 RTL 语言是否都遵守这一惯例。但你可以轻松地更改序言中的数字:

\makeatletter
\renewcommand{\thesection}{\LR{\thechapter\@SepMark\arabic{section}}} % if using book class
\renewcommand{\thesubsection}{\LR{\thesection\@SepMark\arabic{subsection}}}
\renewcommand{\thesubsubsection}{\LR{\thesubsection\@SepMark\arabic{subsubsection}}}
\makeatother

相关内容