我正在尝试调整回忆录类以制作一种议程,其中 \part 代表第 n 周,\chapter 代表工作日。它在英语或 \usepackage[frenchb]{babel} 中运行良好,但在 [french]polyglossia 中则不行……在最后一种情况下,零件编号会消失。任何帮助都将不胜感激!
奖励:在有星号部分命令的情况下,如何更改标题以捕捉标题?
这是我的(不那么)最小的工作示例
% !TeX TS-encoding = utf8
% !TeX TS-spellcheck = fr_FR
% !BIB TS-program = biber
% !TeX TS-program = lualatex
\documentclass[12pt, a4paper]{memoir}
\usepackage{luatextra}
\setmainfont{Linux Libertine O}
\setsansfont{Linux Biolinum O}
\usepackage{hyperref}
\hypersetup{
pdfencoding=auto,
pdffitwindow = false,
pdfstartview = {FitH},
bookmarksopen = true,
bookmarksnumbered = true,
bookmarksopen = true,
bookmarksopenlevel = 3,
bookmarksdepth = 4,
colorlinks = true, %colorise les liens
breaklinks = true, %permet le retour à la ligne dans les liens trop longs
urlcolor = blue, %couleur des hyperliens
linkcolor = red, %couleur des liens internes
citecolor = green,
backref=page,
pdfpagelabels,
pdfencoding=auto,
}
%\usepackage[frenchb]{babel}
\usepackage{polyglossia}
\setmainlanguage{french}
%\setotherlanguage[variant=british]{english}
%\setmainlanguage[variant=british]{english}
%\setotherlanguage{french}
%\setotherlanguage{german}
\makeatletter
\renewcommand*{\thepart}{\@arabic\c@part}
%\renewcommand*{\thechapter}{\jourSem{\c@chapter}}
\@addtoreset{chapter}{part}
\renewcommand*{\thesection}{\@arabic\c@section}
\renewcommand{\part}{%
% \clearmark{part}
% \clearmark{chapter}
% \clearmark{section}
% \clearmark{subsection}
\@setuppart
\secdef\@part\@spart}
\renewcommand{\beforepartskip}{\null\vskip \onelineskip}
\renewcommand{\midpartskip}{\par\vskip \onelineskip}
\renewcommand{\afterpartskip}{\vskip 3\onelineskip}
\renewcommand*{\partpageend}{\afterpartskip
\if@tempswa
\twocolumn
\fi}
\def\jourSem#1{\ifcase#1 \or Lundi\or Mardi\or Mercredi%
\or Jeudi\or Vendredi\or Samedi\or Dimanche\else #1\fi%
}
\renewcommand*{\clearforchapter}{
% \clearmark{chapter}
\ifnum \c@chapter > 0 \clearpage\else\relax\fi
}
\makechapterstyle{essai}{%
\setlength{\beforechapskip}{\onelineskip}%
\setlength{\midchapskip}{.5\onelineskip}
\setlength{\afterchapskip}{2\onelineskip \@plus .1\onelineskip
\@minus 0.167\onelineskip}%
\renewcommand*{\printchaptername}{}%
\renewcommand*{\chapternamenum}{}%
\renewcommand*{\chapnumfont}{\normalfont\Huge\itshape}%
\renewcommand*{\printchapternum}{\raggedleft\chapnumfont \jourSem{\thechapter}}%
\renewcommand*{\afterchapternum}{\par\nobreak\vskip \midchapskip}%
\renewcommand*{\chaptitlefont}{\chapnumfont}%
\renewcommand*{\printchapternonum}{\raggedleft}}
\makepagestyle{essai}
\makepsmarks{essai}{%
\def\partmark##1{%
\markboth{{%
\ifnum \c@secnumdepth > -2
\if@mainmatter
\partname\space\thepart\ %
\fi
\fi
##1}}{}}%
\def\chaptermark##1{%
\markright{{%
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\jourSem{\thechapter}\ %
\fi
\fi
##1}}}%
\def\tocmark{\markboth{{\contentsname}}{{\contentsname}}}%
\def\lofmark{\markboth{{\listfigurename}}{{\listfigurename}}}%
\def\lotmark{\markboth{{\listtablename}}{{\listtablename}}}%
\def\bibmark{\markboth{{\bibname}}{{\bibname}}}%
\def\indexmark{\markboth{{\indexname}}{{\indexname}}}%
\def\sectionmark##1{}}
%\makepsmarks{essai}{%
% \nouppercaseheads
% \createmark{part}{both}{shownumber}{\partname}{. \ }
% \createmark{chapter}{right}{shownumber}{}{\ }
% \createplainmark{toc}{both}{\contentsname}
% \createplainmark{lof}{both}{\listfigurename}
% \createplainmark{lot}{both}{\listtablename}
% \createplainmark{bib}{both}{\bibname}
% \createplainmark{index}{both}{\indexname}
% \createplainmark{glossary}{both}{\glossaryname}
%}
%\addtopsmarks{essai}{}{\renewcommand\sectionmark[1]{}}
\makeevenhead{essai}{\rightmark}{}{\leftmark}
\makeoddhead{essai}{\leftmark}{}{\rightmark}
\makeevenfoot{essai}{\thepage}{}{Trimestre}
\makeoddfoot{essai}{Trimestre}{}{\thepage}
\makeheadrule{essai}{\textwidth}{\normalrulethickness}
\makefootrule{essai}{\textwidth}{\footruleheight}{\footruleskip}
\makeatother
\usepackage{lipsum}
\setcounter{part}{10}
\begin{document}
\pagestyle{essai}
\chapterstyle{essai}
\renewcommand{\partname}{Semaine}
\renewcommand*{\cftpartname}{Semaine}
\renewcommand*{\cftpartpresnum}{\space}
\renewcommand*{\cftpartaftersnum}{\relax}
\renewcommand*{\cftpartaftersnumb}{\relax\space}
\part{Essai1}
\chapter{title1}
\lipsum
\section{Sec1}
\lipsum
\section{Sec2}
\lipsum[2-8]
\section{Sec3}
\lipsum[9-15]
\chapter{title2}
\lipsum
\section{Sec4}
\lipsum
\section{Sec5}
\lipsum[2-8]
\section{Sec6}
\lipsum[9-15]
\part{Essai2}
\chapter{title3}
\lipsum
\section{Sec7}
\lipsum
\section{Sec8}
\lipsum[2-8]
\section{Sec9}
\lipsum[9-15]
\chapter{title4}
\lipsum
\section{Sec10}
\lipsum
\section{Sec11}
\lipsum[2-8]
\section{Sec12}
\lipsum[9-15]
\part*{Essai3}
\addcontentsline{toc}{part}{Avec un titre}
\lipsum
\section{Sec13}
\lipsum
\section{Sec14}
\lipsum[2-8]
\section{Sec15}
\lipsum[9-15]
\cleardoublepage
\tableofcontents
\end{document}
答案1
\captionsfrench
在 gloss-french 中包含\def\thepart{}
。因此,您应该在加载语言后覆盖此内容:
\setmainlanguage{french}
\addto\captionsfrench{\renewcommand*{\thepart}{\arabic{part}}}
我个人不会使用 polyglossia 来翻译法语。我认为 babel 模块更好。