我想在页眉中在奇数页插入书名,在偶数页插入章节标题。我该怎么做?
这是我的 MWE:
\documentclass[a4paper,12pt]{book}
\usepackage{lipsum}
\usepackage{libertine}
\usepackage[frenchb]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\headrulewidth}{0pt}
\fancyhf{}
\fancyhead[LE,RO]{\footnotesize\scshape\thepage}
\fancyhead[CE]{\scshape\MakeTextLowercase{\leftmark}}
\fancyhead[CO]{\scshape\MakeTextLowercase{\chaptername~\thechapter}}
\begin{document}
\title{A book title}
\maketitle
\tableofcontents
\chapter{A chapter name}
\lipsum
\lipsum
\end{document}
答案1
给了twoside
选择权documentclass
\documentclass[a4paper,12pt,twoside]{book}
\usepackage{lipsum}
\usepackage{libertine}
\usepackage[frenchb]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcase}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\headrulewidth}{0pt}
\fancyhf{}
\fancyhead[LE,RO]{\footnotesize\scshape\thepage}
\fancyhead[CE]{\scshape\MakeTextLowercase{\leftmark }}
\fancyhead[CO]{\scshape\MakeTextLowercase{A book title}}
\begin{document}
\title{A book title}
\maketitle
\tableofcontents
\chapter{A chapter name}
\lipsum
\lipsum
\end{document}