什么原因导致红框不能正确与网格对齐?

什么原因导致红框不能正确与网格对齐?

什么原因导致红框不能正确与网格对齐?

\documentclass[tikz,border=12pt]{standalone}
\usepackage{filecontents}
\begin{filecontents*}{diagram.tex}
\documentclass[pstricks,border=0bp]{standalone}
\usepackage{pst-plot}
\begin{document}
\begin{psgraph}{->}(0,0)(-1,-1)(3,2){4cm}{3cm}%
\end{psgraph}%
\end{document}
\end{filecontents*}

\usepackage{pgffor}
\usepackage{graphicx}
\foreach \compiler/\ext in {latex/tex,dvips/dvi,{ps2pdf -dAutoRotatePages=/None}/ps}{\immediate\write18{\compiler\space diagram.\ext}}

\fboxsep=0bp\relax
\begin{document}
\begin{tikzpicture}
    \node[anchor=south west,inner sep=0] at (0,0){\color{red}\fbox{\includegraphics{diagram}}};
    \draw (-1,-1) grid (5,4);
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

 \node[anchor=south west,inner sep=0] at (-1.5\fboxrule,-1.5\fboxrule)
     {\color{red}\fbox{\includegraphics{diagram}}};

1 规则宽度和 0.5 为 dimen=middle

相关内容