![如何在页眉中插入书名?](https://linux22.com/image/479779/%E5%A6%82%E4%BD%95%E5%9C%A8%E9%A1%B5%E7%9C%89%E4%B8%AD%E6%8F%92%E5%85%A5%E4%B9%A6%E5%90%8D%EF%BC%9F.png)
我想在页眉中在奇数页插入书名,在偶数页插入章节标题。我该怎么做?
这是我的 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}