我正在为一个项目排版一份名称列表。除了一个希伯来语名称外,其他所有名称都是英文的。如何在 XeTeX 中排版此名称的符号?
\documentclass[twoside, openany]{book}
\usepackage[subpreambles=true]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{pdfpages}
\usepackage[paperheight=7.5in,paperwidth=7.5in,left=1in,right=1in,top=1in,bottom=1in]{geometry}
\usepackage[hidelinks]{hyperref}
\usepackage{graphicx, amsmath, xcolor, wrapfig, float, subfiles, enumitem, xcoffins, atbegshi, fontspec, etoolbox, cjhebrew}
\usepackage[outline]{contour}
\usepackage[none]{hyphenat}
\usepackage[font=small,labelfont=bf]{caption}
\setmainfont{Futura}
\usepackage{titlesec}
\usepackage{multicol}
%\usepackage[english, hebrew]{babel}
\usepackage{cjhebrew}
%\usepackage[T1]{fontenc}
%\ProvideTextCommand{\DJ}{OT1}{\raisebox{0.25ex}{-}\kern-0.4em D}
%\usepackage[T1]{tipa}
\begin{document}
\section*{Kickstarter Backers}
These are the names of the people who believed in this project before it was real, and whose support is ultimately responsible for its material existence. To our backers, you have our gratitude, now and forever.
\begin{center}
VIP - GREGORY GREGORY
\end{center}
\begin{multicols}{4}
{\tiny
gregory gregory\\
gregory gregory\\
gregory gregory\\
gregory gregory\\
gregory gregory\\
gregory gregory\\
gregory gregory\\
%\<y/sy-Kb dwd>\\
דוד בן-ישי\\
gregory gregory\\
gregory gregory\\
gregory gregory\\
gregory gregory\\
gregory gregory\\
gregory gregory\\
gregory gregory\\}
\end{multicols}
\end{document}
坚持使用 Futura 字体,但无法编译希伯来语名称。有什么想法吗?序言显示了我尝试过的东西。
答案1
我认为 Futura 不涵盖希伯来语,因此您必须选择其他字体。如果可以选择切换到 LuaLaTeX,以下是如何在没有明确语言标记的情况下进行操作(babel
为您选择字体):
\documentclass[twoside, openany]{book}
\usepackage{multicol}
\usepackage[english, bidi=basic]{babel}
\babelprovide[import, onchar=ids fonts]{hebrew}
\babelfont{rm}{Futura}
\babelfont[hebrew]{rm}{DejaVu Sans}
\begin{document}
\section*{Kickstarter Backers}
These are the names of the people who believed in this project before it
was real.
\begin{multicols}{4}
{\tiny\noindent
gregory gregory\\
gregory gregory\\
דוד בן-ישי\\
gregory gregory\\
gregory gregory\\}
\end{multicols}
\end{document}
IIR,使用 XeTeX 时,字体不能通过 RTL 脚本自动切换(对于单个名称而言,这不是一个真正的问题)。
使用 XeTeX:
\documentclass[twoside, openany]{book}
\usepackage{multicol}
\usepackage[bidi=bidi-l,english]{babel}
\babelprovide[import]{hebrew}
\babelfont{rm}{Futura.ttc}
\babelfont[hebrew]{rm}{DejaVu Sans}
\begin{document}
\section*{Kickstarter Backers}
These are the names of the people who believed in this project before it
was real.
\begin{multicols}{4}
{\tiny\noindent
gregory gregory\\
gregory gregory\\
\foreignlanguage{hebrew}{דוד בן-ישי}\\
gregory gregory\\
gregory gregory\\}
\end{multicols}
\end{document}
答案2
您已经遇到了一些令人讨厌的技术问题,这些技术问题都是 TeX 欠 20 世纪的。其中之一就是许多软件包(例如fontenc
、和)inputenc
仍然使用 8 位字体编码。网络上的许多教程仍然会告诉您使用它们。我已经从这个 MWE 中删除了所有这些,并专门使用了 Unicode。cbhebrew
tipa
另一个原因是,当 TeX 发现字体中没有的字符时,其传统行为是默默忽略它,在 PDF 中留下空白,并在文件中间记录警告。在文档顶部.log
添加命令,至少可以在控制台上打印警告!\tracinglostchars=2
对于这个演示,我使用了未来雷纳作为 Futura 的免费开源版本,简单 CLM(פָּשׁוּט)作为配套的希伯来语字体。您也可以尝试使用 Miriam,这是您可能已经拥有的无衬线希伯来语字体。
\documentclass[twoside, openany]{book}
\tracinglostchars=2
\usepackage[subpreambles=true]{standalone}
\usepackage{pdfpages}
\usepackage[paperheight=7.5in,paperwidth=7.5in,left=1in,right=1in,top=1in,bottom=1in]{geometry}
\usepackage[hidelinks]{hyperref}
\usepackage[outline]{contour}
\usepackage[none]{hyphenat}
\usepackage{titlesec}
\usepackage{multicol}
\usepackage[bidi=default, english]{babel}
\usepackage{unicode-math}
\usepackage{ucharclasses}
\defaultfontfeatures{ Scale=MatchLowercase, Ligatures=TeX }
%% Simple CLM and Miriam CLM are available at http://culmus.sourceforge.net/download.html
\defaultfontfeatures[MiriamCLM]{
UprightFont = {*-Book},
BoldFont = {*-Bold},
Extension = {.ttf} }
\defaultfontfeatures[MiriamMonoCLM]{
UprightFont = {*-Book},
BoldFont = {*-Bold},
ItalicFont = {*-BookOblique},
BoldItalicFont = {*-BoldOblique},
Extension = {.ttf} }
\defaultfontfeatures[SimpleCLM]{
UprightFont = {*-Medium},
BoldFont = {*-Bold},
ItalicFont = {*-MediumOblique},
BoldItalicFont = {*-BoldOblique},
Extension = {.ttf} }
%% Futura Renner is a free and open-source version of Futura, available at
%% https://fontlibrary.org/en/font/futura-renner
\babelfont{rm}
[Scale=1.0]{FuturaRenner}
\babelfont{sf}
{FuturaRenner}
\babelfont{tt}
{Source Sans Pro}
\setmathfont{Fira Math}
\babelprovide[import]{hebrew}
\babelfont[hebrew]{rm}
{SimpleCLM}
\babelfont[hebrew]{sf}
{SimpleCLM}
\babelfont[hebrew]{tt}
{MiriamMonoCLM}
\begin{document}
\section*{Kickstarter Backers}
These are the names of the people who believed in this project before it was real, and whose support is ultimately responsible for its material existence. To our backers, you have our gratitude, now and forever.
\begin{center}
VIP - GREGORY GREGORY
\end{center}
\begin{multicols}{4}
{\tiny\noindent
gregory gregory\\
gregory gregory\\
gregory gregory\\
gregory gregory\\
gregory gregory\\
gregory gregory\\
gregory gregory\\
\foreignlanguage{hebrew}{דוד בן-ישי}\\
gregory gregory\\
gregory gregory\\
gregory gregory\\
gregory gregory\\
gregory gregory\\
gregory gregory\\
gregory gregory\\}
\end{multicols}
\end{document}
由于字体太小,在该分辨率下无法看清,因此这是一个放大的版本:
如果你可以使用 LuaLaTeX 代替 XeLaTeX,你可以将两行更改为
\usepackage[bidi=basic, english]{babel}
和
\babelprovide[import, onchar=ids fonts]{hebrew}
然后,每当您输入希伯来语时,您的文档就会切换到希伯来语,并使用正确的字体。遗憾的是,XeTeX 不支持从右到左的语言(即使是ucharclasses
)。
答案3
我认为 2020 年写希伯来语的最佳方式是使用polyglossia
XeLaTeX
平均能量损失
\documentclass[twoside, openany]{book}
\usepackage{multicol}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Language=Hebrew,Script=Hebrew]{David CLM}
\begin{document}
\section*{Kickstarter Backers}
These are the names of the people who believed in this project before it was real, and whose support is ultimately responsible for its material existence. To our backers, you have our gratitude, now and forever.
\begin{center}
VIP - GREGORY GREGORY
\end{center}
\begin{multicols}{4}
{\tiny
gregory gregory\\
gregory gregory\\
\texthebrew{דוד בן-ישי}\\
gregory gregory\\
gregory gregory\\}
\end{multicols}
\end{document}