screprt 与 twoside 和 scrlayer-scrpage:删除默认页码

screprt 与 twoside 和 scrlayer-scrpage:删除默认页码

当我使用 scrlayer-scrpage 手动设置出现在 中的页码时\cfoot,我得到了两个页码:一个在 中\cfoot,一个在 中\ofoot。 中的页码仅由documentclass 选项\ofoot触发。在加载 scrlayer-scrpage 后直接添加 会使页眉也消失,我觉得这很奇怪 - 我以为这个选项是为了清除样式twoside\clearpairofpagestyles定义新的样式。为什么它会让加载的 header它消失了吗?如何去掉 中的默认页码\ofoot

梅威瑟:

\documentclass[twoside, chapterprefix=true]{scrreprt}

\usepackage[manualmark]{scrlayer-scrpage}
%\clearpairofpagestyles

%%--"Chapter #" in lehead (only for numbered chapters), chapter name in rohead
\renewcommand*\chaptermark[1]{%
    \markboth{\ifnumbered{chapter}{\chaptermarkformat}{}}{#1}%
}

\AfterTOCHead[toc]{\markboth{}{\contentsname}}

\cfoot[\pagemark]{\pagemark}


\usepackage{lipsum}

\begin{document}

\chapter{First}

\lipsum[1-18]

\end{document}

答案1

包自动scrlayer-scrpage设置页面样式。此外,它重新定义为(或活动层页面样式对的主样式)的别名和(或活动层页面样式对的普通样式)的别名。在章节页面上使用(= 活动层页面样式对的普通样式)。scrheadingsheadingsscrheadingsplainplain.scrheadingsplain

您可以使用

\documentclass[twoside, chapterprefix=true]{scrreprt}
%\providecommand*\Ifstr{\ifstr}% needed up to and including KOMA-Script version 3.27, see https://komascript.de/faq_deprecatedif

\usepackage[manualmark]{scrlayer-scrpage}
\renewcommand*\chaptermark[1]{%
    \markboth{\Ifnumbered{chapter}{\chaptermarkformat}{}}{#1}% <- outdated macro replaced
}
\AfterTOCHead[toc]{\markboth{}{\contentsname}}

\clearpairofpagestyles
\ohead{\headmark}
\cfoot*{\pagemark}% short version of \cfoot[\pagemark]{\pagemark}


\usepackage{blindtext}

\begin{document}
\tableofcontents
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\end{document}

或者

\documentclass[twoside, chapterprefix=true]{scrreprt}
%\providecommand*\Ifstr{\ifstr}% needed up to and including KOMA-Script version 3.27, see https://komascript.de/faq_deprecatedif

\usepackage[manualmark]{scrlayer-scrpage}
\renewcommand*\chaptermark[1]{%
    \markboth{\Ifnumbered{chapter}{\chaptermarkformat}{}}{#1}% <- outdated macro replaced
}
\AfterTOCHead[toc]{\markboth{}{\contentsname}}

\ofoot*{}% short version of \ofoot[\pagemark]{\pagemark}
\cfoot*{\pagemark}% short version of \cfoot[\pagemark]{\pagemark}


\usepackage{blindtext}

\begin{document}
\tableofcontents
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\end{document}

相关内容