我遵循Koma-Script 操作指南_章节与行重新格式化章节标题。随着 LaTeX 内核 2022 年 6 月更新,这不再起作用并进入无限循环。我正在运行LaTeX2e <2022-06-01> patch level 5 L3 programming layer <2022-07-04>
中断编译后的错误消息是:
chapter 1.
^C! Interruption.
\tl_if_head_is_N_type:nTF ...w \prg_do_nothing: #1
}{\exp_after:wN {\token_t...
l.35 \chapter{Introduction}
演示该问题的 MWE 是:
\documentclass{scrreprt}
\usepackage{microtype}
% Do not put a dot after Section/Chapter, nor in the figure caption.
\KOMAoptions{numbers=noendperiod}
% Write Chapter 1 at beginning of each chapter
\KOMAoptions{chapterprefix=true,appendixprefix=true}
\makeatletter
% Code from https://sourceforge.net/p/koma-script/wiki-de/HowTo_ChapterWithLines/
\renewcommand*{\chapterlinesformat}[3]{%
\Ifstr{#1}{chapter}{%
\rule[.3\baselineskip]{\linewidth}{1pt}\par\nobreak
}{}%
\@hangfrom{\textsl{\MakeUppercase{#2}}}{\textsl{\MakeUppercase{#3}}}%
\Ifstr{#1}{chapter}{%
\rule[.3\baselineskip]{\linewidth}{1pt}\par\nobreak
}{}%
}
\renewcommand*{\chapterlineswithprefixformat}[3]{%
\Ifstr{#1}{chapter}{%
\raggedleft
\textls{\MakeUppercase{#2}}%
\rule[.3\baselineskip]{\linewidth}{1pt}\par\nobreak
\raggedchapter
\textls{#3}%
\rule[.3\baselineskip]{\linewidth}{1pt}\par\nobreak
}{#2#3}%
}
\makeatother
\begin{document}
\chapter{Introduction}
Here is an introduction.
\end{document}
答案1
很抱歉,之前能起作用真是奇迹,但是这可以恢复edef
:
\documentclass{scrreprt}
\usepackage{microtype}
% Do not put a dot after Section/Chapter, nor in the figure caption.
\KOMAoptions{numbers=noendperiod}
% Write Chapter 1 at beginning of each chapter
\KOMAoptions{chapterprefix=true,appendixprefix=true}
\makeatletter
% Code from https://sourceforge.net/p/koma-script/wiki-de/HowTo_ChapterWithLines/
\renewcommand*{\chapterlinesformat}[3]{%
\protected@edef\tmp@chaphead{#2}%
\Ifstr{#1}{chapter}{%
\rule[.3\baselineskip]{\linewidth}{1pt}\par\nobreak
}{}%
\@hangfrom{\textsl{\MakeUppercase{\tmp@chaphead}}}{\textsl{\MakeUppercase{#3}}}%
\Ifstr{#1}{chapter}{%
\rule[.3\baselineskip]{\linewidth}{1pt}\par\nobreak
}{}%
}
\renewcommand*{\chapterlineswithprefixformat}[3]{%
\Ifstr{#1}{chapter}{%
\raggedleft
\protected@edef\tmp@chaphead{#2}%
\textls{\MakeUppercase{\tmp@chaphead}}%
\rule[.3\baselineskip]{\linewidth}{1pt}\par\nobreak
\raggedchapter
\textls{#3}%
\rule[.3\baselineskip]{\linewidth}{1pt}\par\nobreak
}{#2#3}%
}
\makeatother
\begin{document}
\chapter{Introduction}
Here is an introduction.
\end{document}