I am producing a small document, oneside. I'd like to have the following structure of headings/footers:
- Document title in the left side header
- Chapter name in the right side header
- Page number in the center footer
I tried using the fancyhdr
package, but the right header isn't printed (everything else works fine).
Here is a MWE, can you please help?
% !TEX encoding = UTF-8 Unicode
% !TEX TS-program = lualatex
% !TEX spellcheck = it-IT
\documentclass[11pt,a5paper,oneside]{book}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{italian}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage[a5paper]{geometry}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{lipsum}
\usepackage{microtype}
\PolyglossiaSetup{italian}{indentfirst=false}
\setmainfont{Bauer Bodoni Std 1}[
Ligatures={TeX},
Numbers=OldStyle,
SmallCapsFeatures={%
LetterSpace=4,
Letters=SmallCaps
}]
\renewcommand\thesection{\arabic{section}}
\titleformat{\section}{\normalfont\large\rm\filcenter}{\thesection}{0em}{}
\titlecontents{chapter}[1.5em]{}{\scshape\contentslabel{2.3em}}{}{\titlerule*[1pc]{}\contentspage}
\titleformat{\chapter}{\normalfont\Large\scshape\filcenter}{}{0em}{}
\setlength{\headheight}{15.2pt}
\lhead{\scshape Title}\rhead{\chaptermark}\lfoot{}\rfoot{}
\chead{}
\cfoot{\thepage}
\begin{document}
\pagestyle{fancy}
\chapter{Test}
\lipsum{10}
\end{document}
Can someone show me what I've done wrong? Thanks!
Best Answer
As you use
titlesec
andtitletoc
, I wanted to point it is much simpler to use thepagestyles
option oftitlesec
to customise headers and footers. It works with\chaptertitle
,\sectiontitle
and the like, instead of playing withmarks
— although you still can use them.