![什么原因导致红框不能正确与网格对齐?](https://linux22.com/image/293955/%E4%BB%80%E4%B9%88%E5%8E%9F%E5%9B%A0%E5%AF%BC%E8%87%B4%E7%BA%A2%E6%A1%86%E4%B8%8D%E8%83%BD%E6%AD%A3%E7%A1%AE%E4%B8%8E%E7%BD%91%E6%A0%BC%E5%AF%B9%E9%BD%90%EF%BC%9F.png)
什么原因导致红框不能正确与网格对齐?
\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