latex3 / pdfresources

LaTeX PDF resource management
LaTeX Project Public License v1.3c
22 stars 5 forks source link

vertical alignment of \pdffield_radio #41

Closed j-hap closed 1 year ago

j-hap commented 1 year ago

In https://github.com/latex3/hyperref/issues/263 I was guided towards this package, In @u-fischer's minimal example there, one can see that the vertical alignment of the circle is on the text baseline. Looking at web forms, e.g. https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_type_radio, the radio button is aligned at the bottom, so the optical center is aligned with a imaginary strikethrough line. Is there a way to achieve this alignment for a \pdffield_radio?

u-fischer commented 1 year ago

this here is a bug tracker. General support question should better be asked at general question and answers site: https://www.latex-project.org/help/links/#question-and-answer-websites

This said: the button is normal box (and can contain other things, like the images used in the documentation l3pdffield-radio.pdf). You can change its dimension with the width, depth and height key, or move it around as you move other things in LaTeX:

\DocumentMetadata{}
\documentclass[11pt, a4paper]{article}
\usepackage{l3pdffield-testphase} % for form fields
\begin{document}

\newcommand\radiobutton{}

\ExplSyntaxOn
\cs_set_eq:NN\radiobutton\pdffield_radio:n
\pdffield_setup:n{preset-radiobutton={height=0.7\baselineskip,depth=0.3\baselineskip}} %change default preset
\ExplSyntaxOff

\radiobutton{name=A,value=OptionA}: option A 
\radiobutton{name=A,value=OptionB,width=2\baselineskip}: option B
\raisebox{1cm}{\radiobutton{name=A,value=OptionC}}: option C

\end{document}

image

j-hap commented 1 year ago

Thanks! I'll post in the forum next time.