[pdftex] Using value set via \typein
Heiko Oberdiek
oberdiek at uni-freiburg.de
Fri Oct 21 14:22:53 CEST 2005
On Fri, Oct 21, 2005 at 12:37:17PM +0200, Dario Teixeira wrote:
> I am using the \typein command with pdflatex to generate
> on demand a PDF file with/without colour links.
>
> However, this does work: (the dots stand for the full
> hyperindex options)
>
> \typein[\colouroutput]{Enter "true" or "false".}
> \hypersetup{pdftex,...,colorlinks=\colouroutput}
>
> Interesting enough, if I test \colouroutput with
> \ifthenelse, then it works: (though obviously an
> ugly solution)
>
> \ifthenelse{\equal{\colouroutput}{true}}{%
> \hypersetup{pdftex,...,colorlinks=true}}{%
> \hypersetup{pdftex,...,colorlinks=false}}
>
> What am I missing?...
Surprising, that people complain, if all works ...,
however if you want to have problems:
It is safer to use expanded values: colorlinks=true instead
of colorlinks=\coloroutput. Otherwise it is difficult to know
for the key value parser, when the value must be expanded
and when it shouldn't. There are a lot of parsers, all
acting differently: LaTeX, keyval, xkeyval, ...
Thus the second version is fine. Alternative for hackers
without package ifthen:
\begingroup
\edef\x{\endgroup
\noexpand\hypersetup{colorlinks=\coloroutput}%
}%
\x
Yours sincerely
Heiko <oberdiek at uni-freiburg.de>
--
More information about the pdftex
mailing list