# Conditional based on the version of pdflatex?

I would like to do this:

\pdfsuppresswarningpagegroup=1


However, this feature is only supported by pdftex 1.40.15 and higher. How can I do this conditionally, so that my document won't be broken in other tex engines or in earlier versions of pdftex?

As a side issue, does this command go in the preamble? (I can't test it because I'm not yet running 1.40.15+.)

-
According to the docs, it was introduced in 1.40.14 :-) –  Joseph Wright Aug 29 at 21:48
See How can I programmatically populate a PDF's pdfcreator field? for some detail on conditioning based on the version of pdfTeX. –  Werner Aug 29 at 21:50
@JosephWright pdftex-a.pdf says 1.40.14, but NEWS says 1.40.15. Anyway I would not check for the version, but for the feature instead. –  Heiko Oberdiek Aug 29 at 22:21
I have 1.40.14, and the feature is not present in my version. –  Ben Crowell Aug 30 at 17:38

Of course, the version number can be checked, but it is not so trivial, because the numbering scheme has changed in the past several times. I think, it is easier to check for the feature, whether \pdfsuppresswarningpagegroup is defined:

\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname pdfsuppresswarningpagegroup\endcsname\relax
\else
\pdfsuppresswarningpagegroup=1\relax
\fi


\csname has the side effect, that it defines an undefined command with the meaning of \relax. Therefore \ifx with \csname is executed inside a local group.

\pdfsuppresswarningpagegroup should then be set before it is used. Therefore the preamble is a good place for it.

-
+1 Someone is perfectionist here :p I would simply do \begingroup\expandafter\ifx\csname pdfsuppresswarningpagegroup\endcsname\relax\else\global\pdfsuppresswarningpagegr‌​oup=1\relax\fi\endgroup –  tohecz Aug 29 at 22:54