
私のシステムは 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 を使用するオプションの 1 つ。すべての距離は紙の左上隅から測定されます (別の原点を選択するように簡単に変更できます)。
\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}