
몇 시간 동안 이 작업을 수행하려고 노력했지만 제대로 작동할 수 없습니다.
내 문서의 왼쪽 헤더를 숫자 없이 장 이름으로 표시하고 싶습니다. 올바른 것(문제를 일으키는 것)은 섹션 번호 + 섹션 이름이 됩니다.
예를 들어:
소개 4. 행성 형성
이것이 내가 지금까지 가지고 있는 것입니다
\renewcommand{\chaptername}{}
\renewcommand{\chaptermark}[1]{\uppercase{\markboth{#1}{}}}
\renewcommand{\sectionmark}[1]{\markright{#1}{}}
그리고 헤더를 인쇄하려면 다음 명령을 사용하고 있습니다.
\lhead[\thepage]{\leftmark}
\rhead[\nouppercase{\rightmark}]{\thepage}
그러나 출력은 INTRODUCTION 1.4입니다. 행성 형성
이것에 대해 좀 도와주실 수 있나요?
답변1
사용
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
왼쪽 표시에 장 제목이 표시되고
\renewcommand{\sectionmark}[1]{\markright{\arabic{section}.\ #1}}
섹션 번호(장 번호 접두어 없음)와 오른쪽 표시 제목이 표시됩니다.
완전한 예:
\documentclass{book}
\usepackage[a6paper]{geometry}
\usepackage{fancyhdr}
\usepackage{lipsum}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\arabic{section}.\ #1}}
\lhead[\thepage]{\leftmark}
\rhead[\nouppercase{\rightmark}]{\thepage}
\begin{document}
\chapter{Test chapter}
\section{Test section}
\lipsum[1-4]
\end{document}
결과:
\lhead, \rhead 명령은 "more modern" 명령으로 대체될 수 있습니다.
\fancyhead[EL,OR]{\thepage}
\fancyhead[ER]{\rightmark}
\fancyhead[OL]{\leftmark}