5

I am using the class memoir and I am writing a text in both French and Greek (only some words in Greek). I found some snippets online and managed to have something working with the command \textgreek{...}. The problem is that now I don't have Roman numbers in the table of contents for the different parts that compose my book. Here is a MWE that demonstrates the problem.

\documentclass[10pt]{memoir}

\usepackage{lipsum}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{polyglossia}
\usepackage{hyperref}

\setstocksize{190mm}{130mm}
\settrimmedsize{190mm}{130mm}{*}
\setlrmarginsandblock{20mm}{15mm}{*}
\setulmarginsandblock{20mm}{20mm}{*}
\checkandfixthelayout

\pretitle{\begin{center}\Huge\bfseries}
\title{Title}
\posttitle{\par\vskip1em{\normalfont\LARGE\scshape L'évolution\par\vfill}\end{center}}
\author{Name FamilyName}
\predate{\vfill\begin{center}\large}
\date{22 juin 2017}

% simple headers: only page number
\pagestyle{simple}

\setmainlanguage{french}
\setotherlanguage{greek}

\newfontfamily{\greekfont}{GFSDidot}[
  Extension=.otf,
  UprightFont=*,
  ItalicFont=*Italic,
  BoldFont=*Bold,
  BoldItalicFont=*BoldItalic,
  Scale=MatchLowercase,
]

\linespread{1.2}

\makeatletter
\@addtoreset{chapter}{part}
\makeatother



\begin{document}

\frontmatter
\begin{titlingpage}
\maketitle
\end{titlingpage}

\tableofcontents

\cleardoublepage
\chapter{Introduction}
\lipsum[1-3]

\mainmatter
\part{blah}
\chapter{blah blah}
Something in Greek: \textgreek{αττικόν}

\lipsum[1-3]

\chapter{blah}
\lipsum[1-3]



\part{blah}
\chapter{qwerty}
\lipsum[1-3]

\chapter{azerty}
\lipsum[1-3]

\end{document}

How can I solve this problem?

  • \thepart is empty for your style, try \AtBeginDocument{\renewcommand{\thepart}{\Roman{part}}} – user31729 Jun 12 '17 at 8:30
5

The culprit is \setmainlanguage{french} or better, the french language definition file of polyglossia, i.e. gloss-french.ldf, which has the macro

\def\captionsfrench{%
   \def\refname{Références}%
   \def\abstractname{Résumé}%
   \def\bibname{Bibliographie}%
   \def\prefacename{Préface}%
   \def\chaptername{Chapitre}%
   \def\appendixname{Annexe}%
   \def\contentsname{Table des matières}%
   \def\listfigurename{Table des figures}%
   \def\listtablename{Liste des tableaux}%
   \def\indexname{Index}%
   \def\figurename{\textsc{Fig.}}%
   \def\tablename{\textsc{Tab.}}%
   \def\@Fpt{\ifcase\value{part}\or Première\or Deuxième\or
   Troisième\or Quatrième\or Cinquième\or Sixième\or
   Septième\or Huitième\or Neuvième\or Dixième\or Onzième\or
   Douzième\or Treizième\or Quatorzième\or Quinzième\or
   Seizième\or Dix-septième\or Dix-huitième\or Dix-neuvième\or
   Vingtième\fi\space}%
   \def\thepart{}%%%%%%%%%%%%%%%%%
   \def\partname{\protect\@Fpt partie}%
   \def\pagename{page}%
   \def\seename{\emph{voir}}%
   \def\alsoname{\emph{voir aussi}}%
   \def\enclname{P.~J. }%
   \def\ccname{Copie à }%
   \def\headtoname{}%
   \def\proofname{Démonstration}%
   }

in which \thepart is defined to be empty, i.e. the usual definition of \Roman{part} or \@Roman \c@part is not used any longer.

This can be by-passed by saying

 \AtBeginDocument{%
  \renewcommand{\thepart}{\Roman{part}}
 }

or

\makeatletter
\AtBeginDocument{%
  \renewcommand{\thepart}{\@Roman\c@part}
}
\makeatother

after \setmainlanguage{french}

in order to allow the redefinition to take place after polyglossia settings.

\documentclass[10pt]{memoir}

\usepackage{lipsum}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{polyglossia}

\setstocksize{190mm}{130mm}
\settrimmedsize{190mm}{130mm}{*}
\setlrmarginsandblock{20mm}{15mm}{*}
\setulmarginsandblock{20mm}{20mm}{*}
\checkandfixthelayout

\pretitle{\begin{center}\Huge\bfseries}
\title{Title}
\posttitle{\par\vskip1em{\normalfont\LARGE\scshape L'évolution\par\vfill}\end{center}}
\author{Name FamilyName}
\predate{\vfill\begin{center}\large}
\date{22 juin 2017}

% simple headers: only page number
\pagestyle{simple}

\setmainlanguage{french}
\setotherlanguage{greek}

\newfontfamily{\greekfont}{GFSDidot}[
  Extension=.otf,
  UprightFont=*,
  ItalicFont=*Italic,
  BoldFont=*Bold,
  BoldItalicFont=*BoldItalic,
  Scale=MatchLowercase,
]

\linespread{1.2}

\makeatletter
\@addtoreset{chapter}{part}
\AtBeginDocument{%
 \renewcommand{\thepart}{\@Roman\c@part}
}

\makeatother


\begin{document}
\frontmatter
\begin{titlingpage}
\maketitle
\end{titlingpage}

\tableofcontents

\cleardoublepage
\chapter{Introduction}
\lipsum[1-3]

\mainmatter
\part{blah}
\chapter{blah blah}
Something in Greek: \textgreek{αττικόν}

\lipsum[1-3]

\chapter{blah}
\lipsum[1-3]



\part{blah}
\chapter{qwerty}
\lipsum[1-3]

\chapter{azerty}
\lipsum[1-3]

\end{document}
| improve this answer | |
  • @minomic: You're welcome. Happy TeXing. – user31729 Jun 12 '17 at 8:47
  • Just one more thing: right now, the first page of the part says "Première partie I" and then the title of the part... Is there a way to remove either of the two and leave either "Première partie" or "Partie I"? – minomic Jun 12 '17 at 8:56
  • 1
    try to add a \renewcommand{\partname}{} to the ...AtBeginDocument... thing (no time to check) – Rmano Jun 12 '17 at 9:00
  • I don't know how you manage to remember all these things but it works perfectly :) – minomic Jun 12 '17 at 9:09
  • 1
    Any \selectlanguage{french} command will restore the empty definition for \thepart. – egreg Jun 12 '17 at 9:23
2

You should remove \def\thepart{} from \captionsfrench and redefine \printpartnum in order to print nothing and removing the space before the (no longer printed) number.

\documentclass[10pt]{memoir}

\usepackage{lipsum}

\usepackage{polyglossia}
\usepackage{hyperref}

\setstocksize{190mm}{130mm}
\settrimmedsize{190mm}{130mm}{*}
\setlrmarginsandblock{20mm}{15mm}{*}
\setulmarginsandblock{20mm}{20mm}{*}
\checkandfixthelayout

\pretitle{\begin{center}\Huge\bfseries}
\title{Title}
\posttitle{\par\vskip1em{\normalfont\LARGE\scshape L'évolution\par\vfill}\end{center}}
\author{Name FamilyName}
\predate{\vfill\begin{center}\large}
\date{22 juin 2017}

% simple headers: only page number
\pagestyle{simple}

\setmainlanguage{french}
\setotherlanguage{greek}

\newfontfamily{\greekfont}{GFSDidot}[
  Extension=.otf,
  UprightFont=*,
  ItalicFont=*Italic,
  BoldFont=*Bold,
  BoldItalicFont=*BoldItalic,
  Scale=MatchLowercase,
]

\setSpacing{1.2}

\counterwithin{chapter}{part}

% fix the French setup of \def\thepart{}
\patchcmd{\captionsfrench}{\def\thepart{}}{}{}{}
\renewcommand{\printpartnum}{\unskip}

\begin{document}


\frontmatter
\begin{titlingpage}
\maketitle
\end{titlingpage}

\tableofcontents

\cleardoublepage
\chapter{Introduction}
\lipsum[1-3]

\mainmatter

\part{blah}
\chapter{blah blah}
Something in Greek: \textgreek{αττικόν}

\lipsum[1-3]

\chapter{blah}
\lipsum[1-3]



\part{blah}
\chapter{qwerty}
\lipsum[1-3]

\chapter{azerty}
\lipsum[1-3]

\end{document}

I fixed \linespread into the proper memoir command \setSpacing and also \@addtoreset into \counterwithin. If you don't want the Roman number before the chapter number, use

\counterwithin*{chapter}{part}

If you want “Partie I”, instead of \renewcommand{\printpartnum}{\unskip} do

\makeatletter
\patchcmd{\captionsfrench}
  {\def\partname{\protect\@Fpt partie}}
  {\def\partname{Partie}}
  {}{}
\makeatother
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.