나는 다음과 같은 MWE를 얻었습니다.
\documentclass[twoside]{book}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,headheight=28pt,bindingoffset=6mm]{geometry}
\usepackage[pagestyles]{titlesec}
\usepackage{lipsum}
\usepackage{fancyhdr}
\titleformat{\chapter}[display]
{\normalfont\bfseries}{}{10pt}{\Huge\thechapter.\quad}
\newpagestyle{mystyle}{
\sethead[][][\thechapter.\quad\chaptertitle]{\sectiontitle}{}{\thepage}
\setfoot[][\thepage][]{\thesection~\sectiontitle}{}{\thepage}}
\begin{document}
\pagestyle{mystyle}
\chapter{Introduction}
\lipsum[1-40]
\end{document}
짝수 페이지에만 사용자 정의 헤더를 생성합니다. 홀수 페이지에는 페이지 번호가 표시됩니다. 홀수 페이지와 짝수 페이지의 중앙 위치에 사용자 정의 헤더(1. 소개)를 표시하려면 어떻게 해야 합니까?
답변1
헤더 를 가져오려면 \sectiontitle
다음을 제공해야 합니다.\section
아래를 확인하세요:
\documentclass[twoside]{book}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,headheight=28pt,bindingoffset=6mm]{geometry}
\usepackage[pagestyles]{titlesec}
\usepackage{lipsum}
\usepackage{fancyhdr}
\titleformat{\chapter}[display]
{\normalfont\bfseries}{}{10pt}{\Huge\thechapter.\quad}
\newpagestyle{mystyle}{
\sethead[][][\thechapter.\quad\chaptertitle]{}{}{\thesection~\sectiontitle}
\setfoot[][\thepage][]{}{\thepage}{}}
\begin{document}
\pagestyle{mystyle}
\chapter{Introduction}
\lipsum[1-5]
\section{H1 for test}
\lipsum[1-15]
\end{document}
도움이 되길 바랍니다!