tikz 驱动程序 dvipdfm 用于定位

tikz 驱动程序 dvipdfm 用于定位

我正在跟进这个问题 提供的答案对我不起作用,这里是 MWE:

\documentclass[dvipdfmx]{beamer}

\def\pgfsysdriver{pgfsys-dvipdfmx.def} 
\usepackage{tikz}
\begin{document}

\begin{frame}
\begin{tikzpicture}[overlay,remember picture,every node/.style={draw,minimum size=2.5cm,circle}]
\node [anchor=east] at (current page.east){};
\node [anchor=west] at (current page.west){};
\node [anchor=north] at (current page.north){};
\node [anchor=south] at (current page.south){};
\end{tikzpicture}
\end{frame}

\end{document}

圆圈的位置不太好,甚至由于“记住图片”的原因,每次乳胶传递时圆圈都会发生移动……

答案1

pdfTeX 的定位功能需要知道纸张高度并用于\pdfpageheight此目的。如果 pdfTeX 在 PDF 模式下使用,则通常不设置和。DVI 格式没有纸张/页面/介质大小的概念。驱动程序\pdfpagewidth包含一个解决方法:\pdfpageheightpgfsys-xetex.def

\ifx\paperheight\@undefined
\else
  \pdfpagewidth\paperwidth
  \pdfpageheight\paperheight % this is to work around a positioning problem in xetex.
\fi

在问题示例中进行此项设置可解决问题:

\documentclass[dvipdfmx]{beamer}

\def\pgfsysdriver{pgfsys-dvipdfmx.def}
\pdfpagewidth=\paperwidth
\pdfpageheight=\paperheight

\usepackage{tikz}
\begin{document}

\begin{frame}
\begin{tikzpicture}[
  overlay,
  remember picture,
  every node/.style={draw, minimum size=2.5cm, circle}]
\node [anchor=east] at (current page.east){};
\node [anchor=west] at (current page.west){};
\node [anchor=north] at (current page.north){};
\node [anchor=south] at (current page.south){};
\end{tikzpicture}
\end{frame}

\end{document}

.aux文件包含稳定的位置:

\pgfsyspdfmark {pgfid1}{1864679}{10310646}

经过两次latex运行后dvipdfmx,结果是:

结果

相关内容