
ヘッダーとフッターをカスタマイズしようとした次のプリアンブルがあります。しかし、パッケージが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ではKOMA-Scriptクラスscrbook
が使用されています。したがって、\addto\extrasenglish{...}
次のように置き換えることができます。
\renewcaptionname{english}{\chapterautorefname}{Chapter}
\renewcaptionname{english}{\sectionautorefname}{Section}
\renewcaptionname{english}{\subsectionautorefname}{\sectionautorefname}
\renewcaptionname{english}{\subsubsectionautorefname}{\sectionautorefname}