
문서 클래스 scrreprt에서 scrlayer-scrpage를 사용하여 짝수 페이지의 바깥쪽 머리 부분에 "Chapter 1"(또는 2장 또는 어느 장이든)이라는 단어를 표시하고 "Chapter 1" 앞에 "Chapter 1"을 붙이지 않고 장 제목을 표시하고 싶습니다. 홀수 페이지의 바깥쪽 머리에 있습니다(이미지 참조). 편집: 번호가 없는 장에서는 lehead가 비어 있어야 합니다. 어떻게 이를 달성할 수 있나요?
내 MWE:
\documentclass[twoside, openright, BCOR=1cm, bibliography=totoc,headsepline,chapterprefix=true]{scrreprt}
\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}
\automark[chapter]{chapter}
\usepackage{lipsum}
\setcounter{secnumdepth}{0}
\begin{document}
\chapter{An interesting title}
\thispagestyle{empty}
\newpage
\section{A slightly less interesting title}
\lipsum[1-5]
\end{document}
답변1
질문: 장에 번호가 없는 경우 짝수 페이지의 머리글에는 무엇이 들어가야 합니까?
다음은 번호가 없는 장의 짝수 페이지에 장 제목을 사용하는 제안입니다.
\documentclass[
twoside, open=right, BCOR=1cm,
bibliography=totoc,
headsepline,
chapterprefix=true
]{scrreprt}
\usepackage{blindtext}% only for dummy text
\usepackage{scrlayer-scrpage}% sets pagestyle scrheadings automatically
\automark{chapter}
\renewcommand*\chaptermark[1]{%
\markboth{\ifnumbered{chapter}{\chaptermarkformat}{#1}}{#1}%
}
\begin{document}
\tableofcontents
\chapter{Numbered Chapter}
\blindtext
\section{Numbered Section}
\Blindtext[10]
\addchap{Unnumbered Chapter}
\blindtext
\addsec{Unnumbered Section}
\Blindtext[10]
\end{document}
또는 패키지 없이 scrlayer-scrheadings
:
\documentclass[
twoside, open=right, BCOR=1cm,
bibliography=totoc,
headsepline,
chapterprefix=true
]{scrreprt}
\usepackage{blindtext}% only for dummy text
\pagestyle{headings}
\renewcommand*\chaptermark[1]{%
\markboth{\ifnumbered{chapter}{\chaptermarkformat}{#1}}{#1}%
}
\renewcommand*\sectionmark[1]{}
\begin{document}
\tableofcontents
\chapter{Numbered Chapter}
\blindtext
\section{Numbered Section}
\Blindtext[10]
\addchap{Unnumbered Chapter}
\blindtext
\addsec{Unnumbered Section}
\Blindtext[10]
\end{document}
번호가 없는 장에 대해 짝수 페이지의 헤더가 비어 있어야 하는 경우 다음을 사용할 수 있습니다.
\renewcommand*\chaptermark[1]{%
\markboth{\ifnumbered{chapter}{\chaptermarkformat}{}}{#1}%
}
또한 수동 표시로 전환하고 TOC 등에 대한 표시를 수동으로 설정해야 합니다.
\manualmark% or option manualmark for package `scrlayer-scrpage`
\AfterTOCHead[toc]{\markboth{}{\contentsname}}
%\AfterTOCHead[lof]{\markboth{}{\listfigurename}}
%\AfterTOCHead[lot]{\markboth{}{\listfigurename}}
예:
\documentclass[
twoside, open=right, BCOR=1cm,
bibliography=totoc,
headsepline,
chapterprefix=true
]{scrreprt}
\usepackage{blindtext}% only for dummy text
\usepackage[manualmark]{scrlayer-scrpage}% sets pagestyle scrheadings automatically
\renewcommand*\chaptermark[1]{%
\markboth{\ifnumbered{chapter}{\chaptermarkformat}{}}{#1}%
}
\AfterTOCHead[toc]{\markboth{}{\contentsname}}
%\AfterTOCHead[lof]{\markboth{}{\listfigurename}}
%\AfterTOCHead[lot]{\markboth{}{\listfigurename}}
\begin{document}
\tableofcontents
\chapter{Numbered Chapter}
\blindtext
\section{Numbered Section}
\Blindtext[10]
\addchap{Unnumbered Chapter}
\blindtext
\addsec{Unnumbered Section}
\Blindtext[10]
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument
\end{document}
또는 패키지 없이 scrlayer-scrheadings
:
\documentclass[
twoside, open=right, BCOR=1cm,
bibliography=totoc,
headsepline,
chapterprefix=true
]{scrreprt}
\usepackage{blindtext}% only for dummy text
\pagestyle{myheadings}
\renewcommand*\chaptermark[1]{%
\markboth{\ifnumbered{chapter}{\chaptermarkformat}{}}{#1}%
}
\AfterTOCHead[toc]{\markboth{}{\contentsname}}
%\AfterTOCHead[lof]{\markboth{}{\listfigurename}}
%\AfterTOCHead[lot]{\markboth{}{\listfigurename}}
\begin{document}
\tableofcontents
\chapter{Numbered Chapter}
\blindtext
\section{Numbered Section}
\Blindtext[10]
\addchap{Unnumbered Chapter}
\blindtext
\addsec{Unnumbered Section}
\Blindtext[10]
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument
\end{document}
답변2
이를 달성하기 위해 \chaptermark
및 를 재정의할 수 있습니다 .\sectionmark
\documentclass[twoside]{scrreprt}
\usepackage{lipsum} % just for example text
\pagestyle{headings}
\renewcommand*\chaptermark[1]{%
\markboth{Chapter~\thechapter}{#1}%
}
\renewcommand*\sectionmark[1]{}
\begin{document}
\chapter{Some Title}
\lipsum[1-5]
\section{A Section}
\lipsum[6-12]
\section{Another Section}
\lipsum[13-20]
\end{document}