헤더에 현재 섹션 제목을 표시하는 방법

헤더에 현재 섹션 제목을 표시하는 방법

장 제목 대신 헤더에 현재 섹션 제목을 표시하는 방법은 무엇입니까?

나는 사용하고 book있다fancychap

MWE

\documentclass [11pt,oneside,final]{book}
\usepackage[nohints]{minitoc}
\usepackage[round]{natbib}
\usepackage{longtable}
\usepackage[font={footnotesize,it}]{caption}
\usepackage{bookman} 
\usepackage[T1]{fontenc} 
\usepackage{setspace}
\doublespacing
%\onehalfspacing
\usepackage{multirow}
\usepackage[left=35mm,top=30mm,right=30mm,bottom=30mm]{geometry}
\pagenumbering{Roman}
\usepackage[small,compact]{titlesec}
\usepackage[Lenny]{fncychap}
\usepackage{arabtex}
\usepackage{cp1256}
\setcode{cp1256}
\usepackage{float}
\usepackage[final]{graphicx}
\usepackage{epstopdf}
\usepackage{array}

\setarab
\raggedbottom
\begin{document}
\chapter{introduction} \thispagestyle{empty}

\section{one}
bla bla bla bla bla

\section{two}
bla bla bla bla 

\end{document}

답변1

당신이 사용할 수있는fancyhdr.

\documentclass{book}

\usepackage{fancyhdr}
\usepackage{lipsum}% just to generate text for the example

\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{\rightmark}
\fancyhead[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}

\begin{document}
\chapter{Chapter title}
\section{section title}

\lipsum[1-20]

\end{document}
  • \pagestyle{fancy}페이지 스타일을 로 전달되고 편집 가능한 스타일로 설정합니다 fancyhdr.
  • \fancyhf{}모든 머리 및 발 요소를 비워 둡니다.
  • \fancyhead[L]{\rightmark}\rightmark현재 섹션( \leftmark현재 장)을 포함하는 왼쪽 헤드 요소를 로 설정합니다 .
  • \fancyhead[R]{\thepage}오른쪽 헤드 요소를 페이지 번호로 설정합니다.
  • \renewcommand{\headrulewidth}{0pt}머리 규칙을 사라지게 놔두세요.

\fancyhead/ 의 선택적 인수에 대해 가능한 선택자는 요소 위치에 대한 (왼쪽), (가운데) 또는 (오른쪽)이고 짝수 페이지와 홀수 페이지를 구별하기 위한 (짝수) 또는 (홀수) \fancyfoot입니다 . /를 생략하면 요소가 모든 페이지에 설정됩니다.LCREOEO

답변2

업데이트된 답변

대신 이용해주세요 scrlayer-scrpage

\documentclass{book}

\usepackage{scrlayer-scrpage}
\usepackage{lipsum}% just to generate text for the example

\pagestyle{scrheadings}
\clearpairofpagestyles
\ohead{\rightmark}
\cfoot[\pagemark]{\pagemark}

\begin{document}
\chapter{Chapter title}
\section{section title}

\lipsum[1-20]

\end{document}

\clearscrheadfoot{}대체되는 것을 제외하고는 \clearpairofpagestyles사용자에게 변경된 사항이 없습니다.

내 독일어 블로그에서 더 자세한 내용을 읽어보실 수도 있습니다.TeX-Beispiel des Monats "레이아웃 II: Kopf- und Fußzeilen".


원래 답변

당신이 사용할 수있는scrpage2KOMA-Script 번들에서.

\documentclass{book}

\usepackage{scrpage2}
\usepackage{lipsum}% just to generate text for the example

\pagestyle{scrheadings}
\clearscrheadfoot{}
\ohead{\rightmark}
\cfoot[\pagemark]{\pagemark}

\begin{document}
\chapter{Chapter title}
\section{section title}

\lipsum[1-20]

\end{document}
  • \pagestyle{scrheadings}페이지 스타일을 로 전달되고 편집 가능한 스타일로 설정합니다 scrpage2.
  • \clearscrheadfoot{}모든 머리 및 발 요소를 비워 둡니다.
  • \ohead{\rightmark}현재 섹션( 현재 장)을 포함하는 외부 헤드 요소( o)를 로 설정합니다.\rightmark\leftmark
  • \cfoot[\pagemark]{\pagemark}페이지 번호를 가운데 바닥 요소( c)로 설정합니다. 최적의 인수는 plain스타일(장 시작 페이지에 사용됨)을 정의합니다.

이 이미지는 가능한 모든 요소를 ​​보여줍니다.

scrpage2 머리/발 요소
출처: scrguien.pdf, p. 198

답변3

섹션에서 라벨을 사용하고 \nameref{}. 새로운 섹션마다 헤더를 새로운 섹션으로 재정의해야 한다고 생각합니다...

관련 정보