当应用注释 \lofoot 和 \lefoot 时,偶数页的页脚不显示。此外,注释 \headmark 还包含章节编号,而我只想要名称。
有人知道吗?
提前致谢!
\documentclass{scrreprt}
\usepackage[
includemp,
showframe,
reversemp,
paperwidth=20.1cm,
paperheight=25.80cm,
top=2.30cm,
bottom=3.4cm,
inner=2.7cm,
outer=2.7cm,
marginparwidth=1.6cm, % Fixed for now
marginparsep=0.4cm
]{geometry}
\usepackage{lipsum}
\makeatletter % to set the marginpar on the left side in showframe
\let\Gm@vrules@mpi\Gm@vrules@mpii
\makeatother
\renewcommand*{\chapterformat}{\makebox[0pt][r]{\chapappifchapterprefix{\
}\thechapter\autodot\hskip\marginparsep}}%
\renewcommand*{\sectionformat}{\makebox[0pt][r]
{\thesection\autodot\hskip\marginparsep}}
\renewcommand*{\subsectionformat}{\makebox[0pt][r]
{\thesubsection\autodot\hskip\marginparsep}}
\renewcommand*{\subsubsectionformat}{\makebox[0pt][r]
{\thesubsubsection\autodot\hskip\marginparsep}}
% remove the vertical skip before the chapter heading
\RedeclareSectionCommand[beforeskip=-1sp plus -1sp minus 1sp]{chapter}
\usepackage[footwidth=textwithmarginpar]{scrlayer-scrpage}
\begin{document}
\clearpairofpagestyles
\automark{chapter}
\lofoot{\makebox[0pt][r]{\pagemark\autodot\hskip\marginparsep}{\headmark}}
\lefoot{\makebox[0pt][r]{\pagemark\autodot\hskip\marginparsep}{test test
test}}
\setkomafont{pageheadfoot}{\normalfont}
\chapter{chapter}
\thispagestyle{scrheadings}
\lipsum[2]
\section{section}
\lipsum[2]
\subsection{subsection}
\lipsum[2]
\lipsum[2]
\section{section}
\lipsum[2]
\subsection{subsection}
\lipsum[2]
\end{document}
答案1
要从页眉或页脚中使用的标记中删除章节号,请重新定义chaptermarkformat
:
\renewcommand*\chaptermarkformat{}
默认情况下scrreprt
,文档为单面。因此只有正面页面,lehead
不使用。如果左页脚中的条目应根据偶数和奇数页码而有所不同,则可以使用类似
\makebox[0pt][r]{\pagemark\autodot\hskip\marginparsep}%
\ifodd \value{page}%
\headmark
\else
test test test%
\fi
}
代码:
\documentclass{scrreprt}
\usepackage[
includemp,
showframe,
reversemp,
paperwidth=20.1cm,
paperheight=25.80cm,
top=2.30cm,
bottom=3.4cm,
inner=2.7cm,
outer=2.7cm,
marginparwidth=1.6cm, % Fixed for now
marginparsep=0.4cm
]{geometry}
\usepackage{lipsum}
\makeatletter % to set the marginpar on the left side in showframe
\let\Gm@vrules@mpi\Gm@vrules@mpii
\makeatother
\renewcommand*{\chapterformat}{\makebox[0pt][r]{\chapappifchapterprefix{\
}\thechapter\autodot\hskip\marginparsep}}%
\renewcommand*{\sectionformat}{\makebox[0pt][r]
{\thesection\autodot\hskip\marginparsep}}
\renewcommand*{\subsectionformat}{\makebox[0pt][r]
{\thesubsection\autodot\hskip\marginparsep}}
\renewcommand*{\subsubsectionformat}{\makebox[0pt][r]
{\thesubsubsection\autodot\hskip\marginparsep}}
% remove the vertical skip before the chapter heading
\RedeclareSectionCommand[beforeskip=-1sp plus -1sp minus 1sp]{chapter}
\usepackage[footwidth=textwithmarginpar]{scrlayer-scrpage}% activates pagestyle scrheadings automatically
\clearpairofpagestyles
\automark{chapter}
\ifoot{%
\makebox[0pt][r]{\pagemark\autodot\hskip\marginparsep}%
\ifodd \value{page}%
\headmark
\else
test test test%
\fi
}
\setkomafont{pageheadfoot}{\normalfont}
\renewcommand\chaptermarkformat{}
\renewcommand*\chapterpagestyle{scrheadings}
\begin{document}
\chapter{chapter}
\lipsum[2]
\section{section}
\lipsum[2]
\subsection{subsection}
\lipsum[2]
\lipsum[2]
\section{section}
\lipsum[2]
\subsection{subsection}
\lipsum[2]
\end{document}
假设您scrheadings
也想将页面样式用于章节页面,我已将其重新定义\chapterpagestyle
为scrheadings
。