我想將書籤號碼更改為緬甸語號碼(即(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 }