[Tex/LaTex] Conditional based on the version of pdflatex

conditionalspdftex

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+.)

Related: Can't silence a pdftex "PDF inclusion: multiple PDFs with page group" error

Best Answer

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.

Related Question