
으로 만든 헤더가 있습니다 fancyhdr
. 목차와 서문 섹션을 포함한 모든 페이지에서 반복됩니다. 사용하려고 했는데 \thispagestyle{empty}
첫 페이지에서만 작동하고 다음 페이지에서는 지워야 합니다.frontmatter
\documentclass[11pt]{book}
\usepackage{lipsum}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE]{\nouppercase{\leftmark}}
\fancyhead[LO]{\nouppercase{\rightmark}}
\renewcommand\headrulewidth{1.5pt}
\makeatletter
\def\headrule{{\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi
\hrule\@height\headrulewidth\@width\headwidth
\vskip 2pt% 2pt between lines
\hrule\@height.5pt\@width\headwidth% lower line with .5pt line width
\vskip-\headrulewidth
\vskip-1.5pt}}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\thispagestyle{empty}
\frontmatter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Table of contents
\tableofcontents
\chapter{Preface}
\lipsum
\lipsum
\mainmatter
\chapter{Ch1}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\lipsum
\section{test}
\chapter{ch2}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\end {document}
답변1
이걸 바꿔라
\thispagestyle{empty}
에게
\pagestyle{empty}
그리고 여기에 \pagestyle{fancy}를 삽입하세요
\mainmatter
\chapter{Ch1}
이제 다음과 같이 보일 것입니다
\mainmatter
\pagestyle{fancy}
\chapter{Ch1}
답변2
이것이 당신이 원하는 것인가요? 머리말에는 장 제목(목차/서문)만 있고 첫 장 페이지와 흰색 페이지에는 빈 스타일(전체 문서)이 있습니다. 옵션 을 추가하고 이를 달성하기 위해 및 패키지를 twoside
사용했습니다 .emptypage
xpatche
\documentclass[11pt, twoside]{book}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{xpatch, emptypage}%
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE]{\nouppercase{\leftmark}}
\fancyhead[LO]{\nouppercase{\rightmark}}
\renewcommand\headrulewidth{1.5pt}
\makeatletter
\def\headrule{{\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi
\hrule\@height\headrulewidth\@width\headwidth
\vskip 2pt% 2pt between lines
\hrule\@height.5pt\@width\headwidth% lower line with .5pt line width
\vskip-\headrulewidth
\vskip-1.5pt}}
\makeatother
%%
\xpatchcmd{\chapter}{%
\thispagestyle{plain}}{%
\thispagestyle{empty}}{}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\frontmatter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Table of contents
\tableofcontents
\chapter*{Preface}
\markboth{Preface}{Preface}
\addcontentsline{toc}{chapter}{Preface}
\lipsum
\lipsum[1-4]
\mainmatter
\pagestyle{fancy}
\chapter{Ch1}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\lipsum
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\chapter{ch2}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\lipsum
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\end {document}