0

enter image description here

What can I do that the TextFields etc. (except for a small "outer sep") fit exactly into the table cells (with their set dimensions)?

\documentclass[fontsize=14pt]{scrreprt}
\usepackage{tabularx, xcolor}
\usepackage{hyperref}

% Style
\renewcommand*{\DefaultOptionsofText}{print, bordercolor=red,
borderstyle={U}, 
bordercolor={red},
backgroundcolor=lightgray!60
}
% Textfields
\def\Name{\mbox{\TextField[name=Name,height=1em, width=0.375\textwidth]{Name:}}%
}
\def\Career{\mbox{\TextField[name=Career,height=1em, width=0.375\textwidth]{Career:}}%
}

\usepackage{mwe}
\begin{document}

\begin{Form}
\renewcommand{\tabularxcolumn}[1]{m{#1}}
\begin{tabularx}{\textwidth}{|m{0.5\textwidth} | X |}
\hline
 \Name &  \Career \\ \hline
\end{tabularx} \par
\end{Form}

\end{document}
2

The width can be done rather easily by measuring the label. The height is more difficult: the best values depends also a bit on the pdf viewer used and on the exact visual effect you want to achieve.

\documentclass[fontsize=14pt]{scrreprt}
\usepackage{tabularx, xcolor,calc}
\usepackage{hyperref}

% Style
\renewcommand*{\DefaultOptionsofText}{print, bordercolor=red,
borderstyle={U},
bordercolor={red},
backgroundcolor=lightgray!60
}
% Textfields
\newlength\lentmpa

\newcommand\Name{%
 \settowidth\lentmpa{Name: }%
 \mbox{%  
  \TextField[name=Name,
        height=\dimexpr\normalbaselineskip-4\arrayrulewidth, 
        width=\dimexpr\linewidth-\lentmpa]{Name:}}}
\newcommand\Career{\settowidth\lentmpa{Career: }%
         \mbox{%
          \TextField[name=Career,
           height=\dimexpr\normalbaselineskip-4\arrayrulewidth, 
           width=\dimexpr\linewidth-\lentmpa]{Career:}}%
}

\def\LayoutTextField#1#2{% label, field
  #1 \raisebox{-0.3\normalbaselineskip+2\arrayrulewidth}[0pt][0pt]{#2}%
}
\usepackage{mwe}
\begin{document}

\begin{Form}
\renewcommand{\tabularxcolumn}[1]{m{#1}}
\begin{tabularx}{\textwidth}{|m{0.5\textwidth} | X |}
\hline
 \Name &  \Career \\ \hline
\end{tabularx} \par
\end{Form}

\end{document}

enter image description here

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.