我想将书签编号更改为缅甸数字(例如将 (1) 更改为 (၁)、将 (2.1) 更改为 (၂.၁) 等)。我使用 fontspec,并且可以将所有阿拉伯数字映射到相应的缅甸数字,这样我就有了缅甸语的章节、部分和页码。我使用
\addfontfeatures{Mapping=digit_mapping}
进行映射。(详细信息请参见:如何使用缅甸语的区域设置编号/自定义编号?)
在生成书签之前是否可以进行类似的映射?请参阅下面的 MWE 了解我一直在尝试的内容。
%!TeX program = XeLaTex
%!TEX encoding = UTF-8 Unicode
\documentclass[10pt]{book}
\XeTeXlinebreaklocale "my_MM" %Myanmar line and character breaks
\XeTeXinterwordspaceshaping=2 %%% PLEASE EXPERIMENT BY SETTING WITH DIFFERENT VALUES
\usepackage{fontspec}
\setmainfont{Padauk Book}
\usepackage{titletoc}
\usepackage{titlesec}
\usepackage[hyperfootnotes=false,bookmarksnumbered]{hyperref}
\usepackage{bookmark}
% I may be able to transform the numbers to Burmese here
\makeatletter
\renewcommand\Hy@numberline[1]{(#1)}
\makeatother
% I'd like to do some font mapping so that (1) to (၁), (2.1) to (၂.၁), etc.
\begin{document}
\chapter{Hello 1}
Helo
\section{world }
\chapter{Hello 2}
Helo
\section{world }
\end{document}
答案1
假设缅甸数字和阿拉伯数字一样是十进制系统,那么这里可以起作用(使用 xelatex 和 lualatex):
\documentclass[10pt]{book}
\usepackage{fontspec}
\setmainfont{Padauk Book}
\usepackage{titletoc}
\usepackage{titlesec}
\usepackage[hyperfootnotes=false,bookmarksnumbered]{hyperref}
\usepackage{bookmark}
% I may be able to transform the numbers to Burmese here
\makeatletter
\renewcommand\Hy@numberline[1]{(#1)}
\ExplSyntaxOn
\renewcommand\thechapter{\codepoint_generate:nn {\the\value{chapter}+4160}{12}}
\renewcommand\thesection{\thechapter.\codepoint_generate:nn {\the\value{section}+4160}{12}}
\ExplSyntaxOff
\makeatother
% I'd like to do some font mapping so that (1) to (၁), (2.1) to (၂.၁), etc.
\begin{document}
\chapter{Hello 1}
Helo
\section{world }
\section{two}
\chapter{Hello 2}
Helo
\section{world }