使用 Texlive 的巴比伦数字

使用 Texlive 的巴比伦数字

我成功地使用巴比伦数字和 xelatex带有 Miktex 的 Windows,但现在我想在 Linux 中使用 Texlive 来做到这一点。我安装了texlive2018 便携版完整版(但没有文档和一些语言)。当我运行 xelatex 时,出现了以下错误:

! LaTeX Error: File `babyloniannum.sty' not found.

然后,我将babylonian-master包含该babyloniannum.sty文件的文件夹放入.../texlive/texmf-local/tex/latex/local/(这是正确的位置吗?)并运行后texhash,出现下一个错误:

! Package fontspec Error: The font "Santakku" cannot be found.

我的文件夹santakku仅包含以下文件:

Paleo-Babylonien.pdf
Santakku.ttf
SantakkuM.ttf

那么,我应该把它放在哪里?以及如何告诉 xelatex 使用它?

笔记:我需要不使用 sudo 密码。

答案1

babyloniannum.sty其放在 TeX 可以找到的地方,例如

/usr/local/texlive/texmf-local/tex/latex/babyloniannum

(在这种情况下,请记住以超级用户身份运行mktexlsr)。否则,请将其保存在工作目录中。获取 Santakku 字体,然后再次将其放在 下的合适目录中texmf-local,或工作目录中。在下面的示例中,我使用了后一种方法。

然后修复包中最明显的问题,即\fontspec每次调用时都使用\babyloniannum。最好定义一个特定的字体。

\documentclass{article}
\usepackage{fontspec}
\usepackage{babyloniannum}
\usepackage{etoolbox}

\let\babylonianfont\relax
\newfontface{\babylonianfont}{Santakku}[
  Extension=.ttf,
  Path=./,
]

\patchcmd{\babyloniannum}
 {\fontspec{\babylonianfont}}
 {\babylonianfont}
 {}{}

\begin{document}

\babyloniannum{424000}
\babyloniannum{42}

\end{document}

在此处输入图片描述

还有几个多余的空格需要删除。在编辑之前,从

X\babyloniannum{424000}X\babyloniannum{42}X

我明白了

虚假的

进行以下编辑(这也使得建议变得多余\patchcmd

\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{babyloniannum}%%%% EDITED
    [2011/08/19 0.5 Typeset Babylonian numerals with XeTeX and LuaTeX]
\ProvidesPackage{babyloniannum}
\RequirePackage{fontspec}
%\RequirePackage{xunicode}
\RequirePackage{numname}
\newcommand{\babylonianfont}{Santakku}
\newcommand{\unicodedisp}[1]{\char"#1}
\newcommand{\babylonian}[1]{%
  \protect\babyloniannum{\arabic{#1}}}
\newcommand{\babylonianglyph}[1]{%
\ifnum #1 > \z@ % glyph is not zero
  \chardef\m@mten=10 % cuts by units of 10
  \numdigits{#1}% parse number
  \ifcase\c@xsm@mctr %
    \relax %
    \or
    \unicodedisp{1230B} %10
    \or
    \unicodedisp{1230B}\kern-0.15em{}\unicodedisp{1230B} %20 -- unknown?
    \or
    \unicodedisp{1230D} %30
    \or
    \unicodedisp{1240F} %40
    \or
    \unicodedisp{12410} %50
  \fi
  \ifnum \c@ism@mctr > \z@ %
    \ifnum \c@xsm@mctr > \z@ %
  \kern-0.5em{} % make glyphs closer
    \fi %
  \fi %
  \ifcase\c@ism@mctr %
    \or
    \unicodedisp{12079} %1
    \or
    \unicodedisp{1222B} %2
    \or
    \unicodedisp{12408} %3
    \or
    \unicodedisp{120FB} %4
    \or
    \unicodedisp{1240A} %5
    \or
    \unicodedisp{1240B} %6
    \or
    \unicodedisp{1240C} %7
    \or
    \unicodedisp{1240D} %8
    \or
    \unicodedisp{1240E} %9
  \fi
  \addtocounter{baby@glyphs}{1}%
\else
  \ifnum\c@baby@glyphs > \z@ %
\kern0.5em{}% empty space for zero
  \fi
\fi
}
\newcounter{baby@ism@mctr}  % "units"
\newcounter{baby@xsm@mctr}  % "tens"
\newcounter{baby@csm@mctr}  % "hundreds"
\newcounter{baby@ksm@mctr}  % "thousands"
\newcounter{baby@xksm@mctr} % "ten thousands"
\newcounter{baby@cksm@mctr} % "hundred thousands"
\newcounter{baby@msm@mctr}  % "millions"
\newcounter{baby@xmsm@mctr} % "ten millions"
\newcounter{baby@cmsm@mctr} % "hundred millions"
\newcounter{baby@bsm@mctr}  % "billions"
\newcommand{\babylonian@setcounters}{%
  \setcounter{baby@ism@mctr}{\c@ism@mctr}%
  \setcounter{baby@xsm@mctr}{\c@xsm@mctr}%
  \setcounter{baby@csm@mctr}{\c@csm@mctr}%
  \setcounter{baby@ksm@mctr}{\c@ksm@mctr}%
  \setcounter{baby@xksm@mctr}{\c@xksm@mctr}%
  \setcounter{baby@cksm@mctr}{\c@cksm@mctr}%
  \setcounter{baby@msm@mctr}{\c@msm@mctr}%
  \setcounter{baby@xmsm@mctr}{\c@xmsm@mctr}%
  \setcounter{baby@cmsm@mctr}{\c@cmsm@mctr}%
  \setcounter{baby@bsm@mctr}{\c@bsm@mctr}%
}
\newcounter{baby@glyphs}%
\newcommand{\babyloniannum}[1]{%
  \chardef\m@mten=60 % Cut by units of 60
  \numdigits{#1}% Parse number
  \babylonian@setcounters%
  \mbox{%
  \babylonianfont
  \setcounter{baby@glyphs}{0}%
  \babylonianglyph{\c@baby@bsm@mctr}%
  \babylonianglyph{\c@baby@cmsm@mctr}%
  \babylonianglyph{\c@baby@xmsm@mctr}%
  \babylonianglyph{\c@baby@msm@mctr}%
  \babylonianglyph{\c@baby@cksm@mctr}%
  \babylonianglyph{\c@baby@xksm@mctr}%
  \babylonianglyph{\c@baby@ksm@mctr}%
  \babylonianglyph{\c@baby@csm@mctr}%
  \babylonianglyph{\c@baby@xsm@mctr}%
  \babylonianglyph{\c@baby@ism@mctr}%
  }%
}
\endinput
%%
%% End of file `babyloniannum.sty'.

输出是

在此处输入图片描述

相关内容