当我添加polyglossia
包以使用我的希伯来语文本时,它会破坏将坐标写入文件的过程。如果我删除包,polyglossia
它就可以正常工作。不确定它是否与有关zref
。如果你\newline
在每行之间添加一个,它就可以正常工作,但我需要文本以段落的形式流动。
梅威瑟:
\documentclass{article}%
\usepackage{zref-savepos}%
\usepackage{polyglossia}%
\setmainlanguage{hebrew}%
\setotherlanguage{english}%
\defaultfontfeatures{Mapping=tex-text}
\setmainfont{Times New Roman}
\newfontfamily\hebrewfont[Script=Hebrew]{Times New Roman}
\newfontfamily\hebrewfontsf[Script=Hebrew]{Times New Roman}
\AtBeginDocument{%
\newwrite\myoutputfile%
\openout\myoutputfile=\jobname.yposout.txt%
}
\AtEndDocument{%
\closeout\myoutputfile%
}
\def\mywriting#1{%
\zsaveposy{#1}%
\typeout{#1:\zposy{#1}}% Write to log file to double check.
\write\myoutputfile{#1:\zposy{#1}}%
}%
\newcommand\writingpos[2][]{%
\mywriting{#2}%
}%
\begin{document}%
\begin{hebrew}
\writingpos{40001001} This is my very long sentence which spans a line or so and it's Y-position at the beginning will certainly have to be different from it's Y-position at the end of this line and I'll use it to test the output of the ZREF package.\writingpos{40001001L}
\writingpos{40001002} This is my SECOND very long sentence which spans a line or so and it's Y-position at the beginning will certainly have to be different from it's Y-position at the end of this line and I'll use it to test the output of the ZREF package.\writingpos{40001002L}
\writingpos{40001003} This is my THIRD very long sentence which spans a line or so and it's Y-position at the beginning will certainly have to be different from it's Y-position at the end of this line and I'll use it to test the output of the ZREF package.\writingpos{40001003L}
\end{hebrew}
\end{document}%
日志文件显示以下内容(正确):
40001001:42747166
40001001L:40518942
40001002:40518942
40001002L:38159646
40001003:38159646
40001003L:36586782
但输出文件给出了这样的信息(这是不正确的):
40001001:42747166
40001002:40518942
40001001L:40518942
40001003:38159646
40001002L:38159646
40001003L:36586782
注意第一个数字(ID)顺序的不同。它应该遵循诸如 ...001、...001L、...002、...002L、...003、...003L 等顺序。
答案1
luatex 和 xetex 处理 RTL 上下文中写入的方式有所不同。
使用 luatex 您可以获得
40001001:43889459
40001001L:41661235
40001002:41661235
40001002L:39301939
40001003:39301939
40001003L:37729075
使用 xetex 您可以获得
40001001:42747166
40001002:40518942
40001001L:40518942
40001003:38159646
40001002L:38159646
40001003L:36586782
注意顺序不同(由于来源略有不同,数字也不同)