当我编译 MWE #1 时,我得到了章节标题格式 #1,这正是我想要的样子。
MWE #1 (XeLaTeX):
\documentclass{book}
\usepackage{lipsum}
\usepackage[
paperwidth=7.5in,
paperheight=9.25in,
inner=0.5in,
outer=0.5in,
bindingoffset=0.25in,
top=0.75in,
bottom=1.25in,
twoside,
%showframe
]
{geometry}
%%%%%%%%%%
\usepackage[compact,pagestyles]{titlesec}
%changes page numbering to bottom outer
\newpagestyle{mystyle}{\setfoot[\thepage][][]{}{} {\thepage}}
\pagestyle{mystyle}
%
%creates the chapter heading style
\titleformat{\chapter}[display]
{\normalfont\huge\filcenter\bfseries\rmfamily}
{\titlerule[1pt]%
\vspace{1pt}%
\titlerule
\vspace{1pc}%
\LARGE\MakeUppercase{\chaptertitlename} \thechapter}
{1pc}
{\titlerule
\vspace{0pc}%
\footnotesize}
%
%changes chapter heading distance from top
\makeatletter
\beforetitleunit=1ex\@plus.ex\@minus.2ex
\makeatother
\titlespacing*{\chapter}{0pt}{*-2.25}{*2}
%
%changes "Chapter" to "Story"
\makeatletter
\renewcommand\@chapapp{Story}
\makeatother
%
%%%%%%%%%%
\begin{document}
\chapter{}
\lipsum[1-24]
\end{document}
但是当我编译 MWE #2(它在序言中添加expex
和命令)时,我得到了章节标题格式 #2。polyglossia
MWE #2 (XeLaTeX):
\documentclass{book}
\usepackage{lipsum}
\usepackage[
paperwidth=7.5in,
paperheight=9.25in,
inner=0.5in,
outer=0.5in,
bindingoffset=0.25in,
top=0.75in,
bottom=1.25in,
twoside,
%showframe
]
{geometry}
%%%%%%%%%%
\usepackage[compact,pagestyles]{titlesec}
%changes page numbering to bottom outer
\newpagestyle{mystyle}{\setfoot[\thepage][][]{}{} {\thepage}}
\pagestyle{mystyle}
%
%creates the chapter heading style
\titleformat{\chapter}[display]
{\normalfont\huge\filcenter\bfseries\rmfamily}
{\titlerule[1pt]%
\vspace{1pt}%
\titlerule
\vspace{1pc}%
\LARGE\MakeUppercase{\chaptertitlename} \thechapter}
{1pc}
{\titlerule
\vspace{0pc}%
\footnotesize}
%
%changes chapter heading distance from top
\makeatletter
\beforetitleunit=1ex\@plus.ex\@minus.2ex
\makeatother
\titlespacing*{\chapter}{0pt}{*-2.25}{*2}
%
%changes "Chapter" to "Story"
\makeatletter
\renewcommand\@chapapp{Story}
\makeatother
%
%%%%%%%%%%
\usepackage{expex}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Arial}
\newfontfamily\englishfont{Linux Libertine O}
\begin{document}
\chapter{}
\lipsum[1-24]
\end{document}
两个 MWE 之间的唯一区别是 之前的六行\begin{document}
。
\usepackage{expex}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Arial}
\newfontfamily\englishfont{Linux Libertine O}
据我所知,该\setotherlanguage{hebrew}
命令导致了问题。发生了什么;为什么polyglossia
或会\setotherlanguage
影响章节标题格式?我该如何修复它,以便在仍然使用expex
和polyglossia
包的同时获得章节标题格式 #1?
答案1
希伯来语加载 bidi,并且 bidi 修补了大量包和命令 - 除了其他titlesec
和标题之外。
加载希伯来语后titlesec 但是前定义章节格式:
\documentclass{book}
\usepackage{lipsum}
\usepackage[
paperwidth=7.5in,
paperheight=9.25in,
inner=0.5in,
outer=0.5in,
bindingoffset=0.25in,
top=0.75in,
bottom=1.25in,
twoside,
%showframe
]
{geometry}
%%%%%%%%%%
\usepackage[compact,pagestyles]{titlesec}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Arial}
\newfontfamily\englishfont{Linux Libertine O}
%changes page numbering to bottom outer
\newpagestyle{mystyle}{\setfoot[\thepage][][]{}{} {\thepage}}
\pagestyle{mystyle}
%
%creates the chapter heading style
\titleformat{\chapter}[display]
{\normalfont\huge\filcenter\bfseries\rmfamily}
{\titlerule[1pt]%
\vspace{1pt}%
\titlerule
\vspace{1pc}%
\LARGE\MakeUppercase{\chaptertitlename} \thechapter}
{1pc}
{\titlerule
\vspace{0pc}%
\footnotesize}
%
%changes chapter heading distance from top
\makeatletter
\beforetitleunit=1ex\@plus.ex\@minus.2ex
\makeatother
\titlespacing*{\chapter}{0pt}{*-2.25}{*2}
%
%changes "Chapter" to "Story"
\makeatletter
\renewcommand\@chapapp{Story}
\makeatother
%
%%%%%%%%%%
\usepackage{expex}
\begin{document}
\chapter{}
\lipsum[1-24]
\end{document}