Plain TeX 中的 \usetikzlibrary 给出命令未找到错误

Plain TeX 中的 \usetikzlibrary 给出命令未找到错误

这是我的纯 TeX 文件:

\input miniltx%
\input graphicx.sty%
\input tikz.tex%
\usetikzlibrary{calc}%
\nopagenumbers%
\pdfpagewidth 8.5truein
\pdfpageheight 11truein
\baselineskip=12pt
\hsize=6.3truein
\vsize=8.7truein
\tikzpicture[remember picture, overlay]
\draw (current page.west) -- (current page.east);
\draw (current page.north) -- (current page.south);
\node[draw,inner sep=0pt,anchor=north west] at ($(current page.north west)+(0.5,0.5)$);
\endtikzpicture
\bye

这会导致以下编译错误:

! Undefined control sequence.
l.23 \usetikzlibrary
                    {calc}%
? 

我正在运行最近安装的 TeX Live。

答案1

  1. 您不应该\input以 % 结尾:TeX 没有机会解析文件名。日志显示tikz.tex从未读入。这里需要空格或换行符。

  2. 您需要一个(可能是空的)节点文本。

这有效:

\input miniltx
\input graphicx.sty
\input tikz.tex
\usetikzlibrary{calc}%
\nopagenumbers%
\pdfpagewidth 8.5truein
\pdfpageheight 11truein
\baselineskip=12pt
\hsize=6.3truein
\vsize=8.7truein
\tikzpicture[remember picture, overlay]
\draw (current page.west) -- (current page.east);
\draw (current page.north) -- (current page.south);
\node[draw,inner sep=0pt,anchor=north west] at ($(current page.north
west)+(0.5,0.5)$) {};
\endtikzpicture
\bye

相关内容