使用 babel 的亚美尼亚字符

使用 babel 的亚美尼亚字符

问题:

如何在混合语言文档中打印出亚美尼亚语?

最小工作示例(MWE):

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,french,armenian]{babel}

\begin{document}

Plus ça change, plus c'est la même chose!

\selectlanguage{english}

And an English paragraph, with a short text in

% Does not work (selectlanguage does not help either)
\foreignlanguage{armenian}{զրո}.

\end{document}

期望输出:

打印出亚美尼亚语字符。法语和英语似乎可以,但亚美尼亚语不行。

答案1

babel支持亚美尼亚语。

但是,TeX Live 和 MiKTeX 提供字体支持。

\documentclass{article}

\usepackage[OT6,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,french]{babel}

\newcommand{\armenian}{\fontencoding{OT6}\fontfamily{cmr}\selectfont}
\DeclareTextFontCommand{\textarmenian}{\armenian}

\begin{document}

Plus ça change, plus c'est la même chose!

\selectlanguage{english}

And an English paragraph, with a short text in
\textarmenian{զրո}.

\end{document}

enter image description here

另外,这里有一组用于打印亚美尼亚传统数字(最高 99999999)的宏。输入\armeniannumeral可以是明确的数字,也可以是计数器,见示例。

\documentclass{article}
\usepackage[OT6,T1]{fontenc}
\usepackage{xparse,etoolbox}

\NewDocumentCommand{\armenian}{}{\fontencoding{OT6}\fontfamily{cmr}\selectfont}
\DeclareTextFontCommand{\textarmenian}{\armenian}
\robustify\textarmenian

\ExplSyntaxOn
\NewDocumentCommand{\armeniannumeral}{m}
 {% #1 = an integer denotation (less than 10^8)
  \textarmenian
   {
    \kexx_armenian_numeral:n { #1 }
   }
 }

\cs_new_protected:Nn \kexx_armenian_numeral:n
 {
  \int_compare:nTF { #1 > 9999 }
   {
    $\overline{\kexx_armenian_numeral_print:f { \int_div_truncate:nn { #1 } { 10000 } } }$
    \kexx_armenian_numeral_print:f { \int_mod:nn { #1 } { 10000 } }
   }
   {
    \kexx_armenian_numeral_print:f { \int_eval:n { #1 } }
   }
 }

\cs_new_protected:Nn \kexx_armenian_numeral_print:n
 {
  \kexx_armenian_numeral_print_aux:f { \prg_replicate:nn { 4 - \tl_count:n { #1 } } { 0 } #1 }
 }
\cs_generate_variant:Nn \kexx_armenian_numeral_print:n { f }

\cs_new_protected:Nn \kexx_armenian_numeral_print_aux:n
 {
  \mbox { \kexx_armenian_numeral_print_final:nnnn #1 }
 }
\cs_generate_variant:Nn \kexx_armenian_numeral_print_aux:n { f }

\cs_new_protected:Nn \kexx_armenian_numeral_print_final:nnnn
 {
  \int_case:nn { #1 } % thousands
   {
    {1}{Ռ}
    {2}{Ս}
    {3}{Վ}
    {4}{Տ}
    {5}{Ր}
    {6}{Ց}
    {7}{Ւ}
    {8}{Փ}
    {9}{Ք}
   }
  \int_case:nn { #2 } % hundreds
   {
    {1}{Ճ}
    {2}{Մ}
    {3}{Յ}
    {4}{Ն}
    {5}{Շ}
    {6}{Ո}
    {7}{Չ}
    {8}{Պ}
    {9}{Ջ}
   }
  \int_case:nn { #3 } % tens
   {
    {1}{Ժ}
    {2}{Ի}
    {3}{Լ}
    {4}{Խ}
    {5}{Ծ}
    {6}{Կ}
    {7}{Հ}
    {8}{Ձ}
    {9}{Ղ}
   }
  \int_case:nn { #4 } % units
   {
    {1}{Ա}
    {2}{Բ}
    {3}{Գ}
    {4}{Դ}
    {5}{Ե}
    {6}{Զ}
    {7}{Է}
    {8}{Ը}
    {9}{Թ}
   }
 }
\ExplSyntaxOff

\begin{document}

\armeniannumeral{1}
\armeniannumeral{2}
\armeniannumeral{3}
\armeniannumeral{4}
\armeniannumeral{5}
\armeniannumeral{6}
\armeniannumeral{7}
\armeniannumeral{8}
\armeniannumeral{9}
\armeniannumeral{10}
\armeniannumeral{11}
\armeniannumeral{23}
\armeniannumeral{55}
\armeniannumeral{1034}
\armeniannumeral{8212}
\armeniannumeral{10000}
\armeniannumeral{99999999}

\setcounter{section}{123}

\armeniannumeral{\value{section}}

\end{document}

enter image description here

相关内容