scrlayer-scrpage - 章节在偶数页,部分在奇数页

scrlayer-scrpage - 章节在偶数页,部分在奇数页

我知道存在相关问题,但我仍然无法让它发挥作用。

我有一份很长的文档,其中包含 3 章,每章都有第 1 章的“1.2.3”节、第 2.3 节的章节。

我需要章节出现在偶数页上,在右侧。部分(仅第一级,即 1.2)需要出现在奇数页上,在左侧。

我使用了以下代码:

\documentclass[DIV12, a4paper, 12pt, listof=totocnumbered, bibliography=totoc]{book}
\title{Dissertation}
\author{xx}
\usepackage{a4wide}
\usepackage{datetime}
\usepackage{lscape}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[onehalfspacing]{setspace}
\usepackage{float, afterpage, rotating, graphicx}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz, epstopdf,pgfplots}
\usepackage{longtable, booktabs, tabularx}
\usepackage{fancyvrb, moreverb, relsize}
\usepackage{eurosym, calc, chngcntr}
\usepackage{amsmath, amssymb, amsfonts, amsthm, bm}
\usepackage{mathtools}
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator*{\argmax}{arg\,max}
\usepackage[skip=5pt]{caption} %add labelfont={bf} as option to make 'Table 1.x' or 'Figure 3.x' bold (but not rest of caption)
\usepackage{mdwlist}
\usepackage{xfrac}
\DeclareUnicodeCharacter{FB01}{fi}
\DeclareUnicodeCharacter{FB02}{fl}
\usepackage{setspace,geometry}
\usepackage{xcolor}
\usepackage{lmodern}
\usepackage{upgreek}
\usepackage{afterpage}
\usepackage{wrapfig}
\usepackage{multirow, makecell}
%\usepackage{fancyhdr}
\usepackage[toc]{glossaries}
\usepackage{subcaption}
%\usepackage{lipsum}  
\usepackage{eurosym}
\usepackage{amsfonts}
\usepackage{booktabs}
\usepackage{tabularx}
%\usepackage{abstract}
\usepackage{graphicx}
\usepackage[hyphens]{url}
\usepackage{acronym}
\usepackage[english]{babel}
\usepackage[round]{natbib}
\usepackage[nottoc]{tocbibind}
\usepackage{pdfpages}

\newdateformat{monthyeardate}{%
  \monthname[\THEMONTH], \THEYEAR}


\geometry{a4paper, headsep=0.6cm, left=33mm, right=33mm, top=25mm, bottom=20mm} %headsep verschiebt die Kopfzeile (Standard ist etwa bei 1cm)



% Kopfzeile anpassen
\usepackage[autooneside=false,headsepline]{scrlayer-scrpage}% Default headsepline width = 0.4pt
\automark[subsection]{section}
\clearscrheadfoot
\cfoot[\pagemark]{\pagemark}
\ohead{\ifstr{\rightbotmark}{\leftmark}{}{\rightbotmark}}
\ihead{\MakeTextUppercase{\leftmark}}



\begin{document}

\chapter{Test Chapter}

\section{Test Section}

\subsection{Test Subsection}

xxxxxxxx

\clearpage

xxxxxxxxx

\clearpage

xxxxxxxxx

\clearpage

xxxxxxxxx

\end{document}

答案1

您可以使用

\usepackage[automark,headsepline]{scrlayer-scrpage}
\clearpairofpagestyles
\cfoot*{\pagemark}
\ihead{\headmark}

\clearpairofpagestyles取代过时的\clearscrheadfoot\cfoot*{\pagemark}是的简短版本\cfoot[\pagemark]{\pagemark}。如果标题中没有章节前缀,请添加

\renewcommand\chaptermarkformat{\thechapter.\enskip}

不含无关内容的示例:

\documentclass[a4paper,12pt]{book}
\usepackage[english]{babel}
\usepackage{geometry}
\geometry{headsep=0.6cm, left=33mm, right=33mm, top=25mm, bottom=20mm,
  headheight=14.5pt% <- added
}

\usepackage[automark,headsepline]{scrlayer-scrpage}
\clearpairofpagestyles
\cfoot*{\pagemark}
\ihead{\headmark}
\renewcommand\chaptermarkformat{\thechapter.\enskip}

\usepackage{blindtext}% only for dummy text

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

在此处输入图片描述


补充说明:您必须清理您的前言。您加载标准类book- 因此您必须删除 KOMA-Script 选项DIV=12listof=totocnumberedbibliography=totoc。包a4wide在示例中已过时且无用,因为您使用的是geometry。不要加载包两次(graphicxamsfontseurosymtabularxbooktabs)。包会自动pgfplots加载包tikzxcolorgraphicxrotating。使用最新的 TeX 分发包chngcntrinputenc带有选项的包utf8是不需要的。

相关内容