LuaTeX RTL 文本:标题中的水平间距错误

LuaTeX RTL 文本:标题中的水平间距错误

在 LuaTeX 中排版叙利亚语 RTL 文本时,部分和小节标题的右对齐似乎存在错误。数字和标题文本之间的小水平空格似乎仍然排版在数字的右侧,导致整个标题从右侧缩进小段,并且数字和标题之间缺少水平空格。

在此处输入图片描述

梅威瑟:

\documentclass{scrartcl}
\usepackage{fontspec}

\newfontfamily\syriacfont[Script=Syriac, Scale=1.2]{estre.otf}

\newcommand{\textsyriac}[1] % Syriac inside LTR
       {\bgroup\luatextextdir TRT\syriacfont #1\egroup}
\newcommand{\n}         [1] % for digits inside RTL text
       {\bgroup\luatextextdir TLT #1\egroup}
\newenvironment{syriac}     % Syriac paragraph
       {\luatextextdir TRT\luatexpardir TRT\syriacfont}{}

\setlength{\parindent}{0pt}

\begin{document}

\section{English section}

The number of the english section is aligned to the left edge of the column.
There is a horizontal space between number and headline. 

In the RTL (syriac) paragraph below, the section number is not right aligned
to the right edge of the column. It seems the horizontal space which is
supposed to be between number and headline is still on the right side of the
number, though it should switch to the left. 

\subsection{English subsection} 

The same issue holds for subsections. 

\begin{syriac}
    \section{\textsyriac{ܡܿܟܪܟܝ}}
    ܘܟܕ ܡܿܟܪܟܝܢ ܐܪܟܢܐ ܗ̄ ܡܘܪܐ ܗܿܝ ܩ7ܕܡܝܬܐ

    \subsection{\textsyriac{ܡܿܟܪܟܝ}}
    ܘܟܕ ܡܿܟܪܟܝܢ ܐܪܟܢܐ ܗ̄ ܡܘܪܐ ܗܿܝ ܩ7ܕܡܝܬܐ
\end{syriac}

\end{document}

article.cls使用而不是scrartcl.cls以及使用阿拉伯文而不是叙利亚文时也会出现此问题。也许这是\sectionRTL 排版命令的一般问题?还是我在 RTL 环境设置中做错了什么?

笔记:使用 XeLaTeX + polyglossia + bidi 设置时不会出现此问题。它似乎是 LuaTeX 所特有的。

答案1

\bodydir TRT通过添加叙利亚语环境的定义解决了这个问题。因此,正确的定义是

\newenvironment{syriac}
  {\par% Syriac paragraph
   \pardir TRT\textdir TRT\bodydir TRT\syriacfont}
  {\par}

几乎没有任何关于 LuaTeX 文本方向基础设施的文档。

相关内容