[twocolumn] 选项和 \fancyhdr 包之间有冲突吗?
页面右侧的页眉显示字母“I”,而不是与该页面上的其他文本一致的页眉。左侧的页眉没有问题。
这是代码,我很抱歉它太长了;它是由 Pandoc 自动生成的。我仔细检查了一遍,但还是搞不清楚是什么导致了错误。
它必须是序言中的内容,我尝试使用仅包含标题部分和 fancyhdr 包的 MWE,并且标题运行正常。
下图显示了有问题的字符“I”(或者是右边的“[”)
So here is the code if anyone has any ideas:
% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
\documentclass[twocolumn,a4paper,9pt]{scrbook}
\usepackage{amsmath,amssymb}
%% fonts
%\usepackage{crimson}
%\usepackage{nimbusserif}
\usepackage{fontspec}
\setmainfont{Biblia Serif}
\usepackage{iftex}
\ifPDFTeX
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
\usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
%%%%%%%%%%%%%%%%% Headers
\usepackage{fancyhdr}
\usepackage{extramarks}
\pagestyle{fancy}
\pagestyle{headings}
\fancyhead[L]{\nouppercase{\rightmark}}
\fancyhead[R]{\nouppercase{\leftmark}}
\addtolength{\headwidth}{\marginparsep}
%%%%%%%%%% Lists
\usepackage{enumitem}
\usepackage{paralist} %%% compactenum
\usepackage{lipsum}
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
\KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\IfFileExists{bookmark.sty}{\usepackage{bookmark}} {\usepackage{hyperref}}
\hypersetup{
hidelinks,
pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs
\usepackage{longtable,booktabs,array}
\usepackage{calc} % for calculating minipage widths
% Correct order of tables after \paragraph* or \subparagraph
\usepackage{etoolbox}
\makeatletter
\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
\makeatother
% Allow footnotes in longtable head/foot
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}} {\usepackage{footnote}}
\makesavenoteenv{longtable}
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@ width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@ nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...] {}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\ifLuaTeX
\usepackage{selnolig} % disable illegal ligatures
\fi
%%%%%%%%%%%%%%%%%%%%% Extra
\usepackage{setspace}
\usepackage{tocloft}
%\usepackage{savetrees}
\author{}
\date{}
%%%%%%%%%%%%%%%%%%%%%% End Preamble
%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%\setcounter{tocdepth}{3}
\tableofcontents
\hypertarget{introduction}{%
\section{Introduction}\label{introduction}}
\sectionmark{Introduction}
\lipsum{20}
\section{ANTI-MONEY LAUNDERING AND COUNTER-TERRORIST FINANCING RULES}
\sectionmark{AML RULES}
\lipsum[20]
\end{document}
我也尝试使用 Koma 类、scrbook 并删除所有“标题”条目保存
\pagestyle{headings}
但结果就是这样。
在此处输入图片描述
从序言中删除章节行:
更新:至少在 Koma 类中;所有背面页面上的“0 [”已被“Contents”一词取代。现在我要做的就是更改“Contents”以与页面上的内容相对应。文档最初属于 Article 类,该类没有章节标题,但在书籍类中很容易用“Chapter”替换“Section”。但这会消除页眉中的“Contents”一词吗?
将“section”改为“Chapter”解决了这个问题,或者至少删除了“Contents”这个词并替换为章节的名称。