0

I'm trying to tweak the memoir class in order to make a kind of agenda, where \part stands for n-th week and \chapter for weekday. It works quite well in english or with \usepackage[frenchb]{babel}, but not with [french]polyglossia… In this last case, the part number simply disappear. Any help would be appreciated!

Bonus: how to change header to catch the title in case of starred section command?

Here is my (not so) minimal working example

% !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 Answer 1

1

\captionsfrench in gloss-french contains \def\thepart{}. So you should overwrite this after loading the language:

\setmainlanguage{french}
\addto\captionsfrench{\renewcommand*{\thepart}{\arabic{part}}}

I personally wouldn't use polyglossia for french. Imho the babel modul is much better.

2
  • Thanks a lot :) In a next step I'll probably use french with english or german or italian or (ancient) greek or spanish: I've read polyglossia should be preferred since I run lualatex?
    – NBur
    Commented Feb 7, 2018 at 18:15
  • It depends on the languages. You need to check if the ldf-files have been adapted. All languages you mentioned should imho work fine with babel and lualatex. Commented Feb 7, 2018 at 18:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .