![使用书签包时,有没有办法用其他 Unicode 字符替换章节编号?](https://linux22.com/image/476088/%E4%BD%BF%E7%94%A8%E4%B9%A6%E7%AD%BE%E5%8C%85%E6%97%B6%EF%BC%8C%E6%9C%89%E6%B2%A1%E6%9C%89%E5%8A%9E%E6%B3%95%E7%94%A8%E5%85%B6%E4%BB%96%20Unicode%20%E5%AD%97%E7%AC%A6%E6%9B%BF%E6%8D%A2%E7%AB%A0%E8%8A%82%E7%BC%96%E5%8F%B7%EF%BC%9F.png)
我想将书签编号更改为缅甸数字(例如将 (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 }