標題 - 頁碼和文字不合適

標題 - 頁碼和文字不合適

我有點困惑如何更改我的標題以使其適合。我想要一個標題,其中奇數頁上的頁碼位於右側,章節(而不是部分)名稱位於左側,偶數頁上則相反。我使用了以下程式碼,但只能透過使用 %KernXXem 來移動頁碼 - 這並不適合每個章節名稱。此外,章節號根本沒有出現。如果有人可以幫助我,我會非常高興,因為我仍在學習如何使用乳膠。先非常感謝! :

在這裡您可以看到到目前為止的結果

\PassOptionsToPackage{headsepline, automark}{scrlayer-scrpage}
\setkomafont{pageheadfoot}{\normalfont}     % Kapielname u.ä. nicht kursiv in Kopfzeile
\usepackage[automark,headsepline=.4pt]{scrlayer-scrpage}

   
    \RequirePackage{scrlayer-scrpage} % provides headers and footers (KOMA Script)
     \clearpairofpagestyles
  




    
    \let\MakeMarkcase\spacedlowsmallcaps
    \ifthenelse{\boolean{ct@nochapters}}%
        {\relax}%
        {\renewcommand{\chaptermark}[1]{\markboth{\spacedlowsmallcaps{#1}}{\spacedlowsmallcaps{#1}}}} 
 \renewcommand{\chaptermark}[1]{\markrboth{\textsc{\thechapter}\enspace\spacedlowsmallcaps{#1}\hline}
   \automark[chapter]{chapter}
   {\textsc{\thechapter}\enspace\spacedlowsmallcaps{#1}\hline}}
    %links
    \lehead{\mbox{\hfil{\small\pagemark\kern25em}\headmark\hfil}}
        %rechts
    \rohead{\mbox{\hfil{\small\headmark\kern25em\pagemark}}}
  
  \ofoot[\small\pagemark]{}% only for plain.scrheadings page style (first page of a chapter)



    
    \renewcommand{\headfont}{\small}
 \DeclareRobustCommand{\fixBothHeadlines}[2]{} % <--- ToDo
         \def\toc@heading{%
            \ifthenelse{\boolean{ct@nochapters}}%
            {\chapter*{\contentsname}}%chapters
            \@mkboth{\spacedlowsmallcaps{\contentsname}}{\spacedlowsmallcaps{\contentsname}}} 

答案1

頁首左側有編號的章節和頁首右側頁碼可以使用以下指令完成:

\usepackage{scrlayer-scrpage}
\automark[chapter]{chapter}
\clearpairofpagestyles
\ihead{\headmark}
\ohead*{\pagemark}

要在標題下方新增水平線,只需新增 optionheadsepline或 option plainheadsepline

要進一步更改標記的大小寫,您確實可以重新定義\MakeMarkcase.看來您正在尋找類似的東西:

\usepackage{microtype}
\DeclareRobustCommand{\spacedlowsmallcaps}[1]{\textsc{\textls[80]{\MakeLowercase{#1}}}}
\AtBeginDocument{\let\MakeMarkcase\spacedlowsmallcaps}

但要僅更改字體,您確實可以使用\setkomafont{…}{…}or \addtokomafont{…}{…},例如:

\setkomafont{pageheadfoot}{}

注意:\normalfont已經是基礎了,所以我沒有在這裡添加它。

總而言之,您似乎正在尋找類似的東西:

\documentclass[headsepline]{scrbook}
\usepackage{blindtext}
\usepackage{microtype}
\DeclareRobustCommand{\spacedlowsmallcaps}[1]{\textsc{\textls[80]{\MakeLowercase{#1}}}}
\usepackage{scrlayer-scrpage}
\automark[chapter]{chapter}
\clearpairofpagestyles
\ihead{\headmark}
\ohead*{\pagemark}
\setkomafont{pageheadfoot}{}
\AtBeginDocument{\let\MakeMarkcase\spacedlowsmallcaps}
\begin{document}
\blinddocument
\end{document}

在此輸入影像描述

如果您也希望章節起始頁上有標題,則需要一個支援此功能的類別(如 KOMA-Script 類別),例如,添加

\renewcommand*{\chapterpagestyle}{headings}

到上面範例的文檔序言中得到:

在此輸入影像描述

而不是僅在章節起始頁上顯示頁碼。

請參閱“頁首和頁尾scrlayer-scrpageKOMA腳本手冊以及“如何更改頁首和頁尾”在 KOMA-Script wiki 中了解有關使用scrlayer-scrpage.另請參閱標記在這裡。已經有幾個關於此的問題和答案。

相關內容