如何添加如下图中红色框出的文本字段?我花了好几天时间才找到解决方案。必须能够以电子方式填写文本字段。也欢迎提出改进布局的想法。提前致谢!
代码如下:
\documentclass[pagesize=pdftex,DIV=16]{scrartcl}
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage[danish]{babel}
\usepackage[utf8]{inputenc}
\newsavebox\TBox
\begin{document}
\begin{Form}
\section*{Application for xxx}
\sbox\TBox{Name: }%
\TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr\linewidth-\wd\TBox]{
Name: }\\[1ex]
\sbox\TBox{Organization: }%
\TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr\linewidth-\wd\TBox]{
Organization: }\\[1ex]
\sbox\TBox{Address: }%
\TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr\linewidth-\wd\TBox]{
Address: }\\[1ex]
\sbox\TBox{Postal code: }%
\TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr0.5\linewidth-\wd\TBox]{Postal code: }
\sbox\TBox{Abcd:. }%
\TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr0.5\linewidth-\wd\TBox]{Abcd: }\\[1ex]
\sbox\TBox{E-mail: }%
\TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr\linewidth-\wd\TBox]{E-mail: }
\end{Form} \\\\
\begin{Form}
\begin{tabular}{l}
\hspace*{-0.73cm} Question \hspace*{1cm}
\CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
\CheckBox[name=second,width=1em]{Nej} \\\\[-0.2cm]
\hspace*{-0.73cm} Another question \hspace*{0.5cm}
\CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
\CheckBox[name=second,width=1em]{Nej} \\\\[-0.2cm]
\hspace*{-0.73cm} Another question \hspace*{0.5cm}
\CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
\CheckBox[name=second,width=1em]{Nej} \\\\[-0.2cm]
\hspace*{-0.73cm} Another question \hspace*{0.5cm}
\CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
\CheckBox[name=second,width=1em]{Nej} \\\\[-0.2cm]
\hspace*{-0.73cm} Last question \hspace*{0.5cm}
\CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
\CheckBox[name=second,width=1em]{Nej} \\\\[0.2cm]
\end{tabular}
\end{Form}\\
Motivation:
\end{document}
答案1
\hspace
这似乎有效。顺便说一句,手册上说只允许一个表单。另外,如果你一开始不添加间隙,你不需要所有这些负面因素。
需要注意的是,默认字符大小(charsize
)为 10pt,表格的有效字符\baselineskip
大小约为 11.5pt。
\documentclass[pagesize=pdftex,DIV=16]{scrartcl}
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage[danish]{babel}
\usepackage[utf8]{inputenc}
\newsavebox\TBox
\begin{document}
\begin{Form}
\section*{Application for xxx}
\sbox\TBox{Name: }%
\TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr\linewidth-\wd\TBox,height=\baselineskip]%
{Name: \strut}\\[1ex]
\sbox\TBox{Organization: }%
\TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr\linewidth-\wd\TBox]%
{Organization: \strut}\\[1ex]
\sbox\TBox{Address: }%
\TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr\linewidth-\wd\TBox]%
{Address: \strut}\\[1ex]
\sbox\TBox{Postal code: }%
\TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr0.5\linewidth-\wd\TBox]{Postal code: \strut}
\sbox\TBox{ Abcd: }%
\TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr0.5\linewidth-\wd\TBox]{Abcd: \strut}\\[1ex]
\sbox\TBox{E-mail: }%
\TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr\linewidth-\wd\TBox]{E-mail: \strut}
\bigskip
\noindent\begin{tabular}{@{}l}
Question \hspace*{1cm}
\CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
\CheckBox[name=second,width=1em]{Nej} \\\\[-0.2cm]
Another question \hspace*{0.5cm}
\CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
\CheckBox[name=second,width=1em]{Nej} \\\\[-0.2cm]
Another question \hspace*{0.5cm}
\CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
\CheckBox[name=second,width=1em]{Nej} \\\\[-0.2cm]
Another question \hspace*{0.5cm}
\CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
\CheckBox[name=second,width=1em]{Nej} \\\\[-0.2cm]
Last question \hspace*{0.5cm}
\CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
\CheckBox[name=second,width=1em]{Nej} \\\\[0.2cm]
\end{tabular}
\sbox\TBox{Motivation: }%
\noindent\TextField[multiline,backgroundcolor=gray!20,borderwidth=0,width=\dimexpr \linewidth-\wd\TBox,height=115pt]%
{\strut\raisebox{104.5pt}{Motivation:} }
\end{Form}
\end{document}