犹太枣的 cjhebrew 包

犹太枣的 cjhebrew 包

我正在使用该cjhebrew包来编写犹太日期。例如,如果我想写出 Iyyar 月的第 17 天,那么应该这样写:j"g Iyyar,在数字的两个部分之间使用双引号,或者在数字的一个部分后面使用单引号,例如 f',或者 `f。(引号将以开引号方向倾斜。)

关于 j"g 和 f',犹太日期用希伯来字母而不是数字书写。

除了按顺序排版月份、引文和日期(或者像第二个示例一样,排版日期的一部分、月份、引文和日期的其余部分)外,有没有更简单的方法可以将其作为单个命令执行?或者有没有办法将反引号作为希伯来语字符?

以下 MWE 在一行上显示 Iyyar 月的第一天,然后是 Iyyar 月的第 16 天。在我看来,这似乎非常迂回。

\documentclass{standalone}
\usepackage{cjhebrew}
\begin{document}
\cjRL{'yyr} `\cjRL{'}\\
\cjRL{z 'yyr}``\cjRL{.t}
\end{document}

答案1

您可以编写一个带有三个参数的简单宏,即刻度前的部分、刻度和刻度后的部分。这比输入单独的命令稍微容易一些\cjRL,而且不需要额外的软件包。

或者,您可以使用字符串操作包,例如 xstring提供一个参数并将其拆分在宏内。

两种选择的 MWE:

\documentclass{article}
\usepackage{cjhebrew}
\usepackage{xstring}

% simple macro
\newcommand{\hebrewdate}[3]{%
\cjRL{#1}#2\cjRL{#3}%
}    

% xstring macro
\newcommand{\hbdate}[1]{%
\StrCount{#1}{`}[\nrticks]%
\StrPosition[1]{#1}{`}[\firsttick]%
\StrPosition[\nrticks]{#1}{`}[\lasttick]%
\StrBefore[1]{#1}{`}[\firstpart]%
\StrMid{#1}{\firsttick}{\lasttick}[\ticks]%
\StrBehind[\nrticks]{#1}{`}[\secondpart]%
\cjRL{\firstpart}\ticks\cjRL{\secondpart}%
}

\begin{document}
\noindent1st of Iyyar: \cjRL{'yyr} `\cjRL{'}\\
16th of Iyyar: \cjRL{z 'yyr}``\cjRL{.t}\\
simple macro 1st: \hebrewdate{'yyr}{ `}{'}\\
simple macro 16th: \hebrewdate{z 'yyr}{``}{.t}\\
xstring macro 1st: \hbdate{ 'yyr`'}\\
xstring macro 16th: \hbdate{z 'yyr``.t}
\end{document}

结果:

在此处输入图片描述

问题:当您想在引文旁边留一个空格时,您必须将其写在前面(参见第 5 个示例)。


编辑正如@SSL 所评论的,引号字符可以改进。

以下是对 MWE 的两项调整,一项pdflatex是优先使用位置改变的微小数学引号,另一项是使用 unicode 字符以便与xelatexLinux Libertine O 字体一起使用。

该版本的一个缺点pdflatex是它看起来仍然有点奇怪,并且可能无法在普通文本之外很好地工作。

该版本的一个缺点xelatex是字体可能不可用(并且切换引擎通常很棘手)。另外:您必须输入 geresh 和 gershayim,尽管您可以更改宏以采用 ascii 等效项作为输入并将其替换为适当的希伯来语重音。

新 MWE:

\documentclass{article}
\usepackage{fontspec}                           % xelatex only
\setmainfont[Ligatures=TeX]{Linux Libertine O}  % xelatex only
\usepackage{cjhebrew}
\usepackage{xstring}

% pdflatex xstring macro
\newcommand{\hbdate}[1]{%
\StrCount{#1}{`}[\nrticks]%
\StrPosition[1]{#1}{`}[\firsttick]%
\StrPosition[\nrticks]{#1}{`}[\lasttick]%
\StrBefore[1]{#1}{`}[\firstpart]%
\StrMid{#1}{\firsttick}{\lasttick}[\ticks]%
\StrSubstitute{\ticks}{`}{'}[\quotes]
\StrBehind[\nrticks]{#1}{`}[\secondpart]%
\cjRL{\firstpart}\raisebox{1pt}{\tiny$\quotes$}\cjRL{\secondpart}%
}

% xelatex xstring macro
\newcommand{\uhbdate}[1]{%
\IfSubStr{#1}{״}{\def\quotes{״}}{\def\quotes{׳}}
\StrBefore{#1}{\quotes}[\firstpart]%
\StrBehind{#1}{\quotes}[\secondpart]%
\cjRL{\firstpart}\quotes\cjRL{\secondpart}%
}

% pdflatex simple macro
\newcommand{\hebrewdate}[3]{%
\cjRL{#1}\raisebox{1pt}{\tiny$#2$}\cjRL{#3}%
}

% xelatex simple macro
\newcommand{\uhebrewdate}[3]{%
\cjRL{#1}#2\cjRL{#3}%
}

\begin{document}
\noindent\textbf{math quotes with pdflatex}\\
1st of Iyyar: \cjRL{'yyr}\raisebox{1pt}{ \tiny$'$}\cjRL{'}\\
16th of Iyyar: \cjRL{z 'yyr}\raisebox{1pt}{\tiny$''$}\cjRL{.t}\\
simple macro 1st: \hebrewdate{ 'yyr}{'}{'}\\
simple macro 16th: \hebrewdate{z 'yyr}{''}{.t}\\
xstring macro 1st: \hbdate{ 'yyr`'}\\
xstring macro 16th: \hbdate{z 'yyr``.t}\\

\noindent\textbf{unicode characters with xelatex}\\
\noindent1st of Iyyar: \cjRL{'yyr} ׳\cjRL{'}\\
16th of Iyyar: \cjRL{z 'yyr}״\cjRL{.t}\\
simple macro 1st: \uhebrewdate{ 'yyr}{׳}{'}\\
simple macro 16th: \uhebrewdate{z 'yyr}{״}{.t}\\
xstring macro 1st: \uhbdate{ 'yyr׳'}\\
xstring macro 16th: \uhbdate{z 'yyr״.t}\\
\end{document}

新结果:

在此处输入图片描述

相关内容