我正在使用 XeLaTeX 和ucharclasses
包在 unicode 类上自动切换字体系列。
问题是转换命令也会切换标题中的文本。
第一页,还可以:
下一页,即 KO:
我怎样才能隔离章节内容的变化?
\documentclass[10pt,a5paper,twoside,openright]{book}
\usepackage[french]{babel}
\usepackage{relsize}
\usepackage{titling}
\usepackage{emptypage}
\usepackage[center]{titlesec}
\usepackage[]{lipsum}
\usepackage[]{fontspec}
% Fallback management.
\usepackage[]{ucharclasses}
\usepackage[
papersize={152mm,214mm}, % A5 papersize + 2mm bleed.
layout=a5paper,
layouthoffset=2mm, % Bleed offset.
layoutvoffset=2mm, % Bleed offset.
bindingoffset=6mm,
left=16.5mm,
right=16.5mm,
top=22mm,
bottom=20mm,
headsep=12mm,
]{geometry}
\author{NemuLumeN}
\title{Book title \\ 1 : first book}
\date{2022}
% Helps build better header and footer; places the page number in the footer.
\usepackage[]{fancyhdr}
% Redefine fancy style.
\fancypagestyle{fancy}{
\fancyhf{}
\fancyhead[EL]{\smaller{\smaller{\texttechnic{\MakeUppercase{\vspace{\baselineskip} \\ \thetitle}}}}}
\fancyhead[OR]{\smaller{\smaller{\texttechnic\MakeUppercase{\chaptername\ \thechapter\ \\ \leftmark}}}}
\renewcommand{\headrulewidth}{1pt}
\fancyfoot[LE,RO]{\smaller{\thepage}}}
\newfontfamily\aserif{Times New Roman}
\newfontfamily\textfallbackserif[]{Times New Roman}
\newfontfamily\texttechnic{Arial}
\newenvironment{realbody}{%
\setDefaultTransitions{\aserif}{\aserif}%
\setTransitionsFor{Latin}{\aserif}{\aserif}%
\setTransitionsFor{BlockElements}{\textfallbackserif}{\aserif}%
}{}
\pagestyle{fancy}
\begin{document}
\lipsum[1-5]
\begin{realbody}
\frontmatter
\maketitle
\tableofcontents
\mainmatter
\chapter{Chapter 1}
\lipsum[1-5]
\end{realbody}
\end{document}
我使用 Times New Roman 和 Arial 字体,但您可以切换到系统上已有的字体。
答案1
您可以在标题中关闭字符类别
\fancypagestyle{fancy}{
\fancyhf{}
\fancyhead[EL]{%
\XeTeXinterchartokenstate=0 %<<<<<<<<<<<<<<<<<<<<<<<<
\smaller{\smaller{\texttechnic{\MakeUppercase{\vspace{\baselineskip} \\ \texttechnic\thetitle}}}}}
\fancyhead[OR]{\smaller{\smaller{\texttechnic\MakeUppercase{\chaptername\ \thechapter\ \\ \leftmark}}}}
\renewcommand{\headrulewidth}{1pt}
\fancyfoot[LE,RO]{\normalfont\smaller{\thepage}}}