# hyperref TextField extends into margin

Whenever the line would have to break right before the TextField, it doesn't and instead lets the TextField run off the page. MWE:

\documentclass{scrartcl}

\usepackage{hyperref}

\begin{document}

\begin{Form}

\TextField[width=12cm]{very long text explaining the type of entry that should go here:}\\

\end{Form}

\end{document}


the label text is simply printed at after it the box. You would get the same with normal text and e.g. a picture. You could e.g. use a parbox:

\documentclass{scrartcl}

\usepackage{hyperref}

\begin{document}

\begin{Form}

\TextField[width=12cm]{\parbox[t]{5cm}{very long text explaining the type of entry that should go here:}}

\end{Form}
\end{document}


Or redefine \LayoutTextField.

• I tried out some stuff as well and adding \newline at the end of the label text also works (might not be very clean though). I was wondering whether there was an automatic solution, but either of these two does the job. Apr 21, 2020 at 11:58
• no there is nothing automatic. It is not really possible to guess which behaviour is wanted here (a break at a fix width, or a newline or ....). So the default definition of \LayoutTextField is very simple. But as I wrote you can adapt it. Apr 21, 2020 at 12:03