標題未與文字框架對齊

標題未與文字框架對齊

我有以下序言試圖自訂頁首和頁尾。但是,我發現該包babel似乎導致左側頁面的標題未與文字框架對齊。如何使其與右側頁面上的文字方塊對齊?我需要在某處指定我的文檔是用德語和英語編寫的,但不一定是通過babel.

左頁:

在此輸入影像描述

右頁:

在此輸入影像描述

\documentclass[
    twoside,
    footinclude=false,
    fontsize=12pt,
    paper=a4,
    listof=totoc,
    bibliography=totoc,
    BCOR=12mm,
    DIV=12,
    chapterprefix=on,
    numbers=noenddot
]{scrbook}


\usepackage[ngerman,english]{babel} % <--- This line causes headers on the left page not aligned with the text frame

\usepackage{xcolor}
\usepackage{lipsum}

\usepackage[
    top=2cm,
    bottom=2cm,
    inner=3cm,
    outer=2cm,
    a4paper,
    headsep=0.5cm,
    footskip=1cm
]{geometry}

% ------------------------------------------------------
\usepackage{scrlayer-scrpage}
\clearpairofpagestyles   % Removes the default page header and footer entries

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}   % Change this to include chapter name only

\usepackage[final,letterspace=175]{microtype}   % For micro-typographical adjustments
% The package 'microtype' provides the command '\textls{<letterspaced-text>}'
% (Source: https://tex.stackexchange.com/a/62351/245306)

\lehead{\color{gray} \sffamily \textls{\MakeUppercase\leftmark}}
\rohead{\color{gray} \sffamily \textls{\MakeUppercase\leftmark}}
\lefoot[\pagemark]{\color{gray} \sffamily \textls{\pagemark}}
\rofoot[\pagemark]{\color{gray} \sffamily \textls{\pagemark}}
% ------------------------------------------------------

% ------------------------------------------------------
\usepackage{varioref}
\usepackage[unicode,hidelinks,bookmarksnumbered]{hyperref} % 'hidelinks' removes colored boxes around references and links
% According to the documentation, 'hyperref' should be loaded as the last package
% A list of packages that should be loaded after 'hyperref' can be found at:
% https://tex.stackexchange.com/questions/1863/which-packages-should-be-loaded-after-hyperref-instead-of-before
\hypersetup{
    colorlinks=true,
    linkcolor=codegreen,
    citecolor=blue,
    filecolor=codegray,
    urlcolor=darkblue,
}
\newcommand{\aref}[1]{\hyperref[#1]{Appendix~\ref*{#1}}}
\addto\extrasenglish{
    \renewcommand{\chapterautorefname}{Chapter}
    \renewcommand{\sectionautorefname}{Section}
    \let\subsectionautorefname\sectionautorefname
    \let\subsubsectionautorefname\sectionautorefname
}
\usepackage{url}
\usepackage[nameinlink,noabbrev]{cleveref}
\providecommand\algorithmname{Algorithm}
\usepackage{nameref}
% ------------------------------------------------------


\begin{document}

\frontmatter
\pagestyle{plain}
\listoffigures
\listoftables

\mainmatter
\pagestyle{scrheadings}

\chapter{Introduction}
\lipsum[1-50]
\chapter{Methodology}
\lipsum[1-50]

\end{document}

答案1

實際上,空格是由\addto\extrasenglish指令引入的。加到%不以巨集結尾的行的末尾。

\addto\extrasenglish{%
    \renewcommand{\chapterautorefname}{Chapter}%
    \renewcommand{\sectionautorefname}{Section}%
    \let\subsectionautorefname\sectionautorefname
    \let\subsubsectionautorefname\sectionautorefname
}

答案2

在 MWE 中scrbook使用 KOMA-Script 類別。因此你可以替換\addto\extrasenglish{...}

\renewcaptionname{english}{\chapterautorefname}{Chapter}
\renewcaptionname{english}{\sectionautorefname}{Section}
\renewcaptionname{english}{\subsectionautorefname}{\sectionautorefname}
\renewcaptionname{english}{\subsubsectionautorefname}{\sectionautorefname}

相關內容