我正在使用该polyglossia
包编写希伯来语文本,并将希伯来语设置为第二语言(\setotherlanguage{hebrew}
)。但是,我遇到一个问题,希伯来语单词最后一个字母上的变音符号没有出现在正确的位置(参见附图)。我正在使用 XeLaTeX 编译文档。有人能为这个问题提供解决方案吗?原始代码:
\documentclass[12pt,twoside]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\graphicspath{{images/}}
\usepackage{caption}
\usepackage{subcaption}
\counterwithout{footnote}{chapter}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}
\usepackage{textgreek}
\usepackage{wrapfig}
\usepackage{hyperref}
\usepackage{xcolor}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\usepackage{ebgaramond}
\hypersetup{
colorlinks=true,
linkcolor=black,
filecolor=black,
urlcolor=blue,
citecolor=black,
% pdftitle={Overleaf Example},
% pdfpagemode=FullScreen,
}
\usepackage{arydshln}
\usepackage{soul}
\usepackage{multirow}
\usepackage{tipa}
\usepackage{cjhebrew}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{adjustbox}
\usepackage{booktabs,caption}
\usepackage[autostyle, english=british]{csquotes}
\usepackage[flushleft]{threeparttable}
\usepackage{fancyhdr}
%\usepackage{tocloft, etoolbox}
\usepackage{mfirstuc}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{SBL_Hbrw.ttf}
\usepackage{titlesec}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE]{\thepage\quad\scshape\leftmark}
\fancyhead[RO]{\rightmark\quad\scshape\thepage}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\capitalisewords{#1}}} % Modified
\renewcommand{\thechapter}{\arabic{chapter}}
\titleformat{\chapter}[display]
{\scshape\Large}
{\filleft\textcolor{gray}{\fontsize{60}{70}\selectfont{\thechapter}}}
{4ex}
{\titlerule
\vspace{2ex}%
\filright}
[\vspace{2ex}%
\titlerule]
\titleformat{\section}
{\normalfont\large\scshape}
{\thesection}
{1em}
{}
\titleformat{\subsection}
{\normalfont\normalsize\scshape}
{\thesubsection}
{1em}
{}
\titleformat{\subsubsection}
{\normalfont\normalsize\scshape}
{\thesubsubsection}
{1em}
{}
\usepackage[style=authoryear,sorting=nyt]{biblatex}
\addbibresource{references.bib}
\setlength{\parskip}{1em}
\title{Hebrew}
\author{Name}
\date{}
\begin{document}
\makeatletter
\def\hlinewd#1{%
\noalign{\ifnum0=`}\fi\hrule \@height #1 %
\futurelet\reserved@a\@xhline}
\makeatother
\newcommand\blank[1]{\rule[-.2ex]{#1}{.4pt}}
\renewcommand{\contentsname}{contents}
\renewcommand{\listfigurename}{list of figures}
\renewcommand{\listtablename}{list of tables}
\section{Some section}
Since in Biblical Hebrew geminated consonants are not allowed word-finally, we see alternations such as \texthebrew{ֹעַמּו} [ʕammo], `his people' vs. \texthebrew{עַם} [ʕam], `people'.
\end{document}
答案1
使用更短的代码即可获得错误:
\documentclass{article}
\font\hebrew"David CLM Medium:script=hebr;" at 12.0pt % I don't have SBL_Hbrw.ttf on my system...
\TeXXeTstate1
\begin{document}
\hebrew\beginR ֹעַמּו
\end{document}
仅供参考,TeXstudio 呈现此文本的方式如下:
fontspec
正如您所见,问题可能与nor无关polyglossia
,实际上这只是一个“功能”。Unicode 双向算法TeX
,您的文本编辑器正在使用它,并且与之完全不相关。
我猜测 Unicode 字形 U+05B9
(或“Holam”)被视为中性字符(就方向性而言),并且由于该单词עמו
是在以基本方向为基准的块内书写的LTR
,并且 Holam 不在两个强RTL
字符之间,它继承了LTR
段落的方向性,因此被放置在单词的左边,尽管它出现在单词的开头而不是结尾。
您可以通过将希伯来语单词放在单独的文本块中来简单地进行测试,这不会影响 TeX 处理代码的方式:
% !TeX TS-program = xelatex
\documentclass{article}
\font\hebrew"David CLM Medium:script=hebr;" at 12.0pt
\TeXXeTstate1
\begin{document}
\hebrew\beginR
ֹעַמּו
\end{document}
嗯,这个网站不能很好地呈现希伯来语文本,但在 TeXstudio 中它显示为
如您所见,holam 位于单词的开头……因此解决方法很简单,将其移动到正确的位置。
与问题无关,但是您不应该将inputenc
norfontenc
与 XeTeX 一起使用,并且由于使用希伯来语时polyglossia
会加载bidi
,您可能应该在序言末尾附近加载它,polyglossia 已经加载fontspec
,因此您不需要也加载它:
\documentclass[12pt,twoside]{scrbook}
%\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\graphicspath{{images/}}
\usepackage{caption}
\usepackage{subcaption}
\counterwithout{footnote}{chapter}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}
\usepackage{textgreek}
\usepackage{wrapfig}
\usepackage{xcolor}
%\usepackage[T1]{fontenc}
\usepackage{ebgaramond}
\usepackage{arydshln}
\usepackage{soul}
\usepackage{multirow}
\usepackage{tipa}
\usepackage{cjhebrew}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{adjustbox}
\usepackage{booktabs,caption}
\usepackage[autostyle, english=british]{csquotes}
\usepackage[flushleft]{threeparttable}
\usepackage{fancyhdr}
%\usepackage{tocloft, etoolbox}
\usepackage{mfirstuc}
\usepackage{titlesec}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=black,
filecolor=black,
urlcolor=blue,
citecolor=black,
% pdftitle={Overleaf Example},
% pdfpagemode=FullScreen,
}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{SBL_Hbrw.ttf}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE]{\thepage\quad\scshape\leftmark}
\fancyhead[RO]{\rightmark\quad\scshape\thepage}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\capitalisewords{#1}}} % Modified
\renewcommand{\thechapter}{\arabic{chapter}}
\titleformat{\chapter}[display]
{\scshape\Large}
{\filleft\textcolor{gray}{\fontsize{60}{70}\selectfont{\thechapter}}}
{4ex}
{\titlerule
\vspace{2ex}%
\filright}
[\vspace{2ex}%
\titlerule]
\titleformat{\section}
{\normalfont\large\scshape}
{\thesection}
{1em}
{}
\titleformat{\subsection}
{\normalfont\normalsize\scshape}
{\thesubsection}
{1em}
{}
\titleformat{\subsubsection}
{\normalfont\normalsize\scshape}
{\thesubsubsection}
{1em}
{}
\usepackage[style=authoryear,sorting=nyt]{biblatex}
\addbibresource{references.bib}
\setlength{\parskip}{1em}
\title{Hebrew}
\author{Name}
\date{}
\begin{document}
\makeatletter
\def\hlinewd#1{%
\noalign{\ifnum0=`}\fi\hrule \@height #1 %
\futurelet\reserved@a\@xhline}
\makeatother
\newcommand\blank[1]{\rule[-.2ex]{#1}{.4pt}}
\renewcommand{\contentsname}{contents}
\renewcommand{\listfigurename}{list of figures}
\renewcommand{\listtablename}{list of tables}
\section{Some section}
Since in Biblical Hebrew geminated consonants are not allowed word-finally, we see alternations such as \texthebrew{עַמּוֹ} [ʕammo], `his people' vs. \texthebrew{עַם} [ʕam], `people'.
\end{document}
答案2
提供一个比 Udi Fogiel 给出的稍微简单一点的例子:
问题在于您在编辑器中输入了(或复制了)错误的单词。
你已经输入了\texthebrew{ֹעַמּו}
,但你应该\texthebrew{עַמּוֹ}
我怀疑这是 Unicode 双向算法的问题(我在其他编辑器中输入这个字没有任何问题)。如果你直接输入这个字,那么很可能是编辑器中的一个错误。
尝试这个例子来比较一下你拥有的和你应该拥有的:
% TeX Program = xelatex
\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew,Contextuals=Alternate]{SBL BibLit}
\begin{document}
Your code: \texthebrew{ֹעַמּו}
Correct code: \texthebrew{עַמּוֹ}
\end{document}