# CheckBox (from hyperref) - tick by default

This may seem basic, but is there a way to make checkboxes ticked automatically? E.g.

\documentclass{minimal}
\usepackage{hyperref}

\begin{document}
\begin{Form}

\CheckBox[name=ch1]{Yes}

\end{Form}
\end{document}


giving

I'd like the above to be checked by default. Then in the .pdf one can uncheck it by clicking on the box as required.

I'm reading the hyperref manual and under 6.2 Forms optional parameters it lists the option with default as checked boolean false - I'm not sure how to pass this into \begin{Form} with a new default.

If there's an alternative method not involving hyperref I'm open to that also.

Am using EMACS & Auctex. If this is possible and there's some simpler way I could have looked it up (e.g. show/modify defaults for Form environment) up would be grateful for any pointers.

-

The check box must have the option checked:

\documentclass{minimal}
\usepackage{hyperref}

\begin{document}
\begin{Form}
\CheckBox[checked,name=ch1]{Yes}

\end{Form}
\end{document}


For change the default you can use in the preamble:

\makeatletter
\Fld@checkedtrue
\makeatother


Or only for some form:

\documentclass{minimal}
\usepackage{hyperref}

\begin{document}

\begin{Form}
\makeatletter\Fld@checkedtrue\makeatother
\CheckBox[name=ch1]{Yes}
\CheckBox[name=ch1]{No}
\end{Form}

\begin{Form}
\makeatletter\Fld@checkedfalse\makeatother
\CheckBox[name=ch1]{Yes}
\CheckBox[name=ch1]{No}
\end{Form}

\end{document}

-
Great, perfect! What lead you to this answer ? (I'm still not getting it from the docs). I'm wondering if I can set it as an environment default as I have many boxes... Also, is this a general principle - i.e. if an environment has a default like checked false then is it reversed by using checked? –  dardisco Oct 6 '13 at 4:35
@dardisco I just tried to do in this way and see what happen :). Change the default option is less intuitive, but see the updated answer. –  Fran Oct 6 '13 at 5:17
Thanks again, even better. Works fine so the rest is academic. It seems you're temporarily making Fld@checked mean Fldatchecked before calling CheckBox is this correct? How would I have been able to tell that the name of the variable I'm trying to change is Fldatchecked - is this related to the Form environment or the .pdf format? –  dardisco Oct 6 '13 at 5:36
@dardisco see What do \makeatletter and \makeatother do? As far I know is not documented how to use \Fld@checked but browsing in .sty files sometimes you can imagine tricks like this one. –  Fran Oct 6 '13 at 6:02
Yes, I was reading this one before you suggested. Quite the imagination! * looks at .sty files * –  dardisco Oct 6 '13 at 6:10