我尝试使用 pdftex (Plain TeX) (一种独立程序) 根据图片尺寸设置 pdf 页面。这样的图片应该显示在文档的中心。但我失败了。
\input tikz
\def\fitpagetothebox0%
{%
\ifdim\pagetotal>0pt
\errmessage{page must be clear to call the command \string\fitpagetothebox0 macro}
\fi
\hoffset=-1in
\voffset=-1in
\pdfpagewidth=\wd0
\pdfpageheight=\ht0
\advance \pdfpageheight by \dp0
\hsize=\wd0
\vsize=\ht0
\output{\shipout
\vbox
{\noindent
\vfil
\hbox{\hfil\box255\hfil}
\vfil}}
}
\setbox0=\hbox
{%
\tikzpicture
\tikzstyle{every node}=[draw, double, line width=1pt,
circle, text width=1.2cm, text centered]
\node[double=red!30, fill=white!90] (eletron) at (-3,0) {$e^-$};
\node[double=blue!50, fill=white!90] (proton) at (3,0) {$p^+$};
\foreach \i in {0,12,...,360}
\draw[<-<,overlay,out=\i] (eletron) to [in=180-\i](proton);
\endtikzpicture
}%
\fitpagetothebox0
\hbox to \hsize{\hfil\box0\hfil}
\end
我究竟做错了什么?