
내 시스템은 LaTex 문자와 템플릿을 생성합니다. 그러나 내 고객은 자신이 통제할 수 없는 미리 작성된 양식을 작성해야 합니다. 좌표를 mm 단위로 측정한 다음 해당 좌표를 mm 단위로 시작점으로 사용하여 텍스트를 배치하여 이러한 양식을 작성하고 싶습니다. 그런 다음 기존 종이 양식 위에 직접 인쇄할 수 있습니다.
이상적으로는 LaTeX가 아래와 같이 작동하길 바랍니다.
\command{x coordinate}{y coordinate}{text1}\\
\command{x coordinate}{y coordinate}{text2}\\
\command{x coordinate}{y coordinate}{text3}\\
\command{x coordinate}{y coordinate}{text4}\\
\command{x coordinate}{y coordinate}{text5}\\
\command{x coordinate}{y coordinate}{text6}\\
고객 양식이 변경되는 경우 좌표만 변경할 수 있습니다. 이 접근 방식이 가능합니까?
답변1
TikZ를 사용하는 하나의 옵션. 모든 거리는 용지의 왼쪽 상단 모서리에서 측정됩니다(다른 원점을 선택하도록 쉽게 수정할 수 있음).
\documentclass{article}
\usepackage{tikz}
\newcommand\PlaceText[3]{%
\begin{tikzpicture}[remember picture,overlay]
\node[outer sep=0pt,inner sep=0pt,anchor=south west]
at ([xshift=#1,yshift=-#2]current page.north west) {#3};
\end{tikzpicture}%
}
\begin{document}
\PlaceText{20mm}{30mm}{First text}
\PlaceText{50mm}{30mm}{Second text}
\PlaceText{60mm}{70mm}{Third text}
\end{document}
답변2
와 함께 textpos
:
\documentclass[a4paper]{article}
\usepackage[overlay,absolute]{textpos}
\newcommand\PlaceText[3]{%
\begin{textblock*}{10in}(#1,#2) %% change width of box from 10in as you wish
#3
\end{textblock*}
}%
\textblockorigin{-5mm}{0mm} %% Default origin top left corner and it can be changed in this line
\begin{document}
\PlaceText{0mm}{0mm}{Origin}
\PlaceText{20mm}{30mm}{First text}
\PlaceText{50mm}{30mm}{Second text}
\PlaceText{60mm}{70mm}{Third text}
\end{document}