1. 测试.tex
运行 Test.tex(见下文)保存坐标(作为 pt,而不是 mm 或 sp)
\eins{标题 1}{一些文字}
在文件 Test.pos 中,内容如下:
% this is Test.tex
\documentclass{article}
\usepackage[paperwidth=210 mm,paperheight=297 mm,textheight=0mm,left=30mm,right=0mm,top=40mm,bottom=0mm]{geometry}
\topskip=0pt
\setlength{\parindent}{0pt}
\usepackage{zref-abspos}
%%%%%%%%%%%%%%%%%%%%%% Producing .pos file %%%%%%%%%%%%%%%%%%%%%%%%%
\newwrite\mywrite
\immediate\openout\mywrite=\jobname.pos\relax
\newcommand{\eins}[2]%
{\zsavepos{#1}
{#2}% Output the text provided as mandatory argumentm
\immediate\write\mywrite{\withoutpt{\the\dimexpr \zposx{#1}sp \relax},\withoutpt{\the\dimexpr \zposy{#1}sp \relax}}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%% makes the output in .pos without pt %%%%%%%%%%%%%%%%%
\makeatletter
\newcommand\withoutpt[1]{%
\strip@pt\dimexpr \dimexpr#1\relax\relax
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\eins{title 1}{some text }
\end{document}
2. Testtt.tex
Testtt.tex 获取 pdf“blabla.pdf”并将“一些新文本...”放到坐标 (10,20)(以 pt 为单位)
% this is Testtt.tex
\documentclass{article}
\usepackage[paperwidth=210 mm,paperheight=297 mm,textheight=0mm,left=30mm,right=0mm,top=40mm,bottom=0mm]{geometry}
\topskip=0pt
\setlength{\parindent}{0pt}
\begin{document}
\includepdf[
picturecommand*={
\put(10,20){some new text for the coordinates in Test.pos}%
}]{blabla.pdf}
\end{document}
但是如果我改变
\放入(10,20)
到
\put(\input{测试.pos})
它不起作用。因此它不采用 Test.pos 中的坐标。
有人有主意吗?谢谢帮助!