I try to vertically align hyperref's TextField such that the filled text is level with the surrounding text, for any text size. The accepted solution to How to align text in Textfield form to the bottom rather than the top suggests to down-shift the TextField by 0.25\baselineskip. This number, first of all, is not quite right to bring down the filled-in text to level with the surrounding text. Secondly, this number has to change if the height of the TextField is modified (personally, I prefer to use a TextField of height=12pt for a 10pt font to avoid overlapping TextFields on consecutive lines). Here comes a MWE to illustrate the problem:


\newcommand{\baseline}{% %% helper to show text baseline 



Leading text, \raisebox{0\baselineskip}{\TextField{field neither scaled nor shifted:}}, trailing text

Leading text, \raisebox{-.25\baselineskip}{\TextField{field not scaled, but shifted:}}, trailing text

Leading text,  \raisebox{0\baselineskip}{\TextField[height=12pt]{field scaled, but not shifted:}}, trailing text 

Leading text, \raisebox{-.25\baselineskip}{\TextField[height=12pt]{field scaled and shifted:}}, trailing text


None of the Textfields entries is precisely vertically aligned with the surrounding text (nor its label, for that matter). So my question is: By how much does one have to shift a TextField of arbitrary height to have the filled-in text sit exactly on the external baseline? I have consulted the hyperref manual but couldn't understand enough of it to come up with a general, let alone elegant, solution.

Your Answer

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

Browse other questions tagged or ask your own question.