我正在尝试使用该包将背景图像用作书籍标题页background
。该书有很多 TikZ 图像,因此我想使用 TikZexternal
包。
它不起作用:有时我会收到编译错误,有时它可以编译但背景图像却不显示。(我怀疑差异与文件中的杂散命令aux
或其他东西有关,但我似乎无法重现它。)
梅威瑟:
\documentclass{article}
\usepackage{background}
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize[prefix=tikz/]
\begin{document}
\backgroundsetup{scale=1,angle=0,contents={\includegraphics[width=\paperwidth,height=\paperheight]{example-image-a}}}
\lipsum[1-2]
\end{document}
我(有时)遇到的编译错误是:
./background-mwe-copy.tex:20: Package tikz Error: Sorry, the system call 'pdfla
tex -shell-escape -halt-on-error -interaction=batchmode -jobname "tikz/backgrou
nd-mwe-copy-figure0" "\def\tikzexternalrealjob{background-mwe-copy}\input{backg
round-mwe-copy}"' did NOT result in a usable output file 'tikz/background-mwe-c
opy-figure0' (expected one of .pdf:.jpg:.jpeg:.png:). Please verify that you ha
ve enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'. Someti
mes it is also named 'write 18' or something like that. Or maybe the command si
mply failed? Error messages can be found in 'tikz/background-mwe-copy-figure0.l
og'. If you continue now, I'll try to typeset the picture.
See the tikz package documentation for explanation.
Type H <return> for immediate help.
...
l.20 \end{document}
(我有启用系统调用,通过-shell-escape
TeXShop 首选项 > 引擎 > pdfTeX > Latex。)
如果我注释掉\tikzexternalize[prefix=tikz/]
,它看起来不错: