첫 페이지 목차에 헤더를 어떻게 추가하나요?

첫 페이지 목차에 헤더를 어떻게 추가하나요?

첫 페이지 목차, 그림 목록, 표 목록에 헤더를 어떻게 추가하나요?

\documentclass[10pt,a4paper]{book}
%%%%%%%%%%%%Tikz%%%%
\usepackage[left=2cm,right=2cm,top=3.25cm,bottom=3cm]{geometry}
%%%%%%%%%%%%%%%%%%%%
\usepackage{fancyhdr}

\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{%
\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{%
\markright{\thesection\ #1}}
\fancyhf{} % delete current header and footer
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt} % space for the rule
\fancypagestyle{plain}{%
\fancyhead{} % get rid of headers on plain pages
\renewcommand{\headrulewidth}{0pt} % and the line
}
    \renewcommand{\theequation}{\arabic{equation}}

\begin{document}
\tableofcontents
\listoffigures
\listoftables

\chapter{Cha}

\section{Sec}
\end{document}

답변1

ToC 등. 기본적으로 페이지 스타일을 \chapter사용합니다 . plain원하는 것을 얻으려면 이것을 fancyToC 등의 페이지 스타일로 변경해야 하지만 그런 다음 스타일을 원래 정의로 \chapter되돌려야 합니다 plain(물론 페이지에 헤더를 원하지 않는 한 \chapter, 제가 싫어합니다. 여기에는 여러 페이지의 ToC를 충족하는 MWE의 개정된 버전입니다.

% tocheaderprob.tex  SE 560800

\documentclass[10pt,a4paper]{book}
%%%%%%%%%%%%Tikz%%%%
\usepackage[left=2cm,right=2cm,top=3.25cm,bottom=3cm]{geometry}
%%%%%%%%%%%%%%%%%%%%
\usepackage{fancyhdr}

\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{%
\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{%
\markright{\thesection\ #1}}
\fancyhf{} % delete current header and footer
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt} % space for the rule
\fancypagestyle{plain}{%
\fancyhead{} % get rid of headers on plain pages
\renewcommand{\headrulewidth}{0pt} % and the line
}
    \renewcommand{\theequation}{\arabic{equation}}

\usepackage{comment}

\makeatletter
\let\ps@originplain\ps@plain % save definition of plain pagestyle
\makeatother

\addtolength{\textheight}{-0.6\textheight} % short pages

\begin{document}

\fancypagestyle{plain}{} % change plain pagestyle to fancy

\tableofcontents 

\listoffigures 

\listoftables
\clearpage  % make sure LoT typesetting is finished

\makeatletter
\let\ps@plain\ps@originplain % revert plain style to the original
\makeatother

% lots of chapters for a multi-page ToC 
\chapter{Cha}
Text

\section{Sec}
Text

\subsection{Subsec}
Text

\chapter{Cha}
Text

\section{Sec}
Text

\subsection{Subsec}
Text

\chapter{Cha}
Text

\section{Sec}
Text

\subsection{Subsec}
Text

\chapter{Cha}
Text

\section{Sec}
Text

\subsection{Subsec}
Text

\end{document}

관련 정보