使用 xwatermark 时未定义控制序列 \color

使用 xwatermark 时未定义控制序列 \color

我正在尝试使用该xwatermark包。我有一份这样的文档:

\documentclass[]{article}
\usepackage[printwatermark]{xwatermark}

\begin{document}

\newwatermark[allpages]{UNAPPROVED}

Foo

\end{document}

构建tectonic失败:

$ tectonic demo.tex
note: this is a BETA release; ask questions and report bugs at https://tectonic.newton.cx/
Running TeX ...
error: something bad happened inside TeX; its output follows:

===============================================================================
(demo.tex
LaTeX2e <2018-04-01> patch level 4
Babel <3.20> and hyphenation patterns for 84 language(s) loaded.
(article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(size10.clo)) (xwatermark.sty (catoptions.sty (pdftexcmds.sty (infwarerr.sty)
(ifluatex.sty) (ltxcmds.sty) (ifpdf.sty))) (fix-cm.sty (ts1enc.def))
(picture.sty) (graphicx.sty (keyval.sty) (graphics.sty (trig.sty) (graphics.cfg
) (xetex.def))) (atbegshi.sty) (fancyhdr.sty) (atveryend.sty) (ltxkeys.sty)
(framed.sty)) (hyperref.sty (hobsub-hyperref.sty (hobsub-generic.sty))
(ifxetex.sty) (auxhook.sty) (kvoptions.sty) (pd1enc.def) (hyperref.cfg)
(url.sty)) (hxetex.def (puenc.def) (stringenc.sty) (rerunfilecheck.sty))
No file demo.aux.
(nameref.sty (gettitlestring.sty))

Package hyperref Warning: Rerun to get /PageLabels entry.

! Undefined control sequence.
<argument> ...e \@tempdima \@parboxrestore \color
                                                  {\wmk@textcolor }\cptdimde...
l.10 \end{document}

No pages of output.
Transcript written on demo.log.
===============================================================================

error: the TeX engine had an unrecoverable error
caused by: halted on potentially-recoverable error as specified

如何使用xwatermark(与tectonic)?

答案1

\color由 LaTeX 的基本支持包定义color,因此加载它将消除该错误。但是,此包仅提供基本的颜色支持,并且xwatermark似乎需要xcolor包中的扩展功能(因此添加\usepackage{xcolor}是安全的选择)。

虽然这看起来很像一个错误xwatermark:如果包需要xcolor那么它应该明确加载xcolor而不是信任用户去执行它......

相关内容