答案1
根据您的需要定制此代码:
\documentclass{book}
\usepackage[paperwidth=17cm,paperheight=24cm, inner=2cm,outer=1.5cm,top=2cm,bottom=1.5cm,headsep=3pt]{geometry}
\usepackage{lipsum}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[italian]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{emptypage}
\usepackage{lmodern,microtype}
\usepackage{fancyhdr}
\pagestyle{fancy}
%
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\nouppercase{\rightmark}}
\fancyhead[RE]{\bfseries\nouppercase{\leftmark}}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
%\addtolength{\headheight}{0.5pt}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{Preface}
\lipsum
\chapter{Si comincia}
\lipsum
\section{Sezione 1}
\lipsum[1-10]
\section{Sezione 2}
\lipsum[5-10]
\chapter{Si continua...}
\section{Sezione 3}
\lipsum[1-10]
\section{Sezione 4}
\lipsum[1-10]
\section{Sezione 5}
\lipsum[5-10]
\lipsum[1-25]
\backmatter
\chapter{Appendix Something}
\pagestyle{plain}
Testo
\lipsum[1-10]
\chapter{Appendix di controllo}
\pagestyle{plain}
\lipsum[10-15]
Testo
\lipsum[5-10]
\end{document}
输出: