你不能在垂直模式下使用 \raise 错误

你不能在垂直模式下使用 \raise 错误

在此处输入图片描述

\documentclass{article}
\usepackage{mwe}
\usepackage{pdfpages}
\usepackage{tikz}

\NewDocumentEnvironment{Insert}{m}{%
\AddToHookNext{shipout/foreground}
\bgroup
  \put(0,-\pdfpageheight)
        \bgroup
                \begin{tikzpicture}[remember picture,overlay]
                        \begin{scope}[x={(current page.south east)},y={(current page.north west)}]                          
}{%
                            \draw[help lines,xstep=0.1,ystep=0.1,red] (0,0) grid (1,1);
                            \foreach \x in {0,1,...,10} {\node [anchor=south] at (\x/10,0) {\x}; }
                            \foreach \y in {0,1,...,10} {\node [anchor=west] at (0,\y/10) {\y}; }
                        \end{scope}
                \end{tikzpicture}
        \egroup
\egroup
\includepdf[pages=#1,fitpaper=true]{example-image-a.pdf}}

\begin{document}
\begin{Insert}{1}
\node at (0.5,0.5){xxxxx};
\end{Insert}
\end{document}

答案1

\documentclass{article}
\usepackage{pdfpages}
\usepackage{tikz}

\NewDocumentEnvironment{Insert} {m +b} {%
  \AddToHookNext{shipout/foreground}
  {%
    \put(0,-\pdfpageheight)
    {\begin{tikzpicture}[overlay]
      \begin{scope}[x={(current page.south east)},y={(current page.north west)}]                          
        #2
        \draw[help lines,xstep=0.1,ystep=0.1,red] (0,0) grid (1,1);
        \foreach \x in {0,1,...,10} {\node [anchor=south] at (\x/10,0) {\x}; }
        \foreach \y in {0,1,...,10} {\node [anchor=west] at (0,\y/10) {\y}; }
      \end{scope}
    \end{tikzpicture}}%
  }%
  \includepdf[pages=#1,fitpaper=true]{example-image-a.pdf}%
}{}

\begin{document}
\begin{Insert}{1}
  \node at (0.5,0.5){xxxxx};
\end{Insert}
\end{document}

重叠的网格,没有记忆

相关内容