无法在最新的 texlive 中的章节标题中使用 \rule

无法在最新的 texlive 中的章节标题中使用 \rule

使用 XeLaTeX

在 texlive 2014(5 月之前的版本或 texlive 2013 或更早版本)中,可以\rule{width}{height}在章节标题中使用。但是在最新的 texlive(6 月之后的版本)中,使用 ctan\rule会导致立即停止并抛出错误。

以下是一个例子

\documentclass{book}

\begin{document}

\chapter{a\rule{1cm}{0cm}b}

\end{document}

这是错误

! Use of \@chapter doesn't match its definition.
\@ifnextchar ... \reserved@d =#1\def \reserved@a {
                                                  #2}\def \reserved@b {#3}\f...
l.6 \chapter{a\rule{1cm}{0cm}b}

有什么方法可以解决这个问题吗?或者有人能解释一下为什么会发生这种情况吗?

也许这不是一个错误,而是故意这样做的。或者只是因为新的 texlive 正在开发中。

答案1

\rule在 LaTeX 中从未如此强大。您可以使用\protect\rule

\usepackage{fixltx2e}

它更新了各种内容,包括使其\rule更强大。也许您之前的文档正在使用该包。

相关内容