TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Please consider the following MWE, in a form of a batch file, which creates two tex files (one of them gets \includepdfd in the other):

cat > insert.tex <<'EOF'

\hypersetup{colorlinks=true, linkcolor=blue, citecolor=blue, filecolor=blue, urlcolor=blue} %


A test of url: \href{http://www.example.com}{http://www.example.com}

A test of cite: \cite{mytest}


\bibitem{mytest} Just Testing, \emph{Just Testing}, 2012.



pdflatex insert.tex
pdflatex insert.tex

pdfannotextractor insert.pdf

cat > includer.tex <<'EOF'

\hypersetup{colorlinks=true, linkcolor=red, citecolor=red, filecolor=red, urlcolor=red} %



\def\excerpt{\section{A test of inclusion}

Turns out we cannot just use includepdf in between section and
text, even if it is scaled down - must define the whole section
and use it as a pagecommand, see \url{http://tex.stackexchange.com/questions/5911/}.




# pdflatex includer.tex
# pdflatex includer.tex

xelatex includer.tex
xelatex includer.tex

If I compile the second file, includer.tex, with pdflatex - then all the links work fine in the includer.pdf.

However, if I try to compile includer.tex with xelatex (as in the example), I get:

! Package pax Error: Missing pdfTeX in PDF mode.

See the pax package documentation for explanation.

... after which, the process can continue - but no links in the included pdf work.

The error message is actually quite clear, in that pax doesn't as of yet support xelatex - but I was wandering if anyone, maybe, knows a hack/workaround, so the links would work also with xelatex?

share|improve this question
up vote 7 down vote accepted

pax uses the following pdftex primitives:


Only the last one has a counterpart in xetex. You may have better luck with luatex, but \pdfstrcmp and \pdfescapename are only available as \pdf@strcmp and \pdf@escapename by loading pdftexcmds, so possibly


can work. There's nothing similar with xetex, that uses a completely different model for inserting hyperlinks.

share|improve this answer
Many thanks for that, @egreg - wasn't even aware that there are different pdftex primitives supported between engines (pdftex, xetex, luatex) - and it's great to see there's some hope with luatex as it also supports (most) of the fontspec stuff... Many thanks again - cheers! – sdaau Jun 18 '12 at 3:17
@sdaau Unfortunately, my experiment failed, because my Perl doesn't have a module required by pdfannotextractor. I will retry. – egreg Jun 18 '12 at 6:54
Hi @egreg - strange, because I actually tried your solution (on my actual work, not on the MWE, though), and works damn fine with my .pax files and lualatex so far!? :) Cheers! – sdaau Jun 18 '12 at 7:00
@sdaau I tried on a machine where Perl has no problem, and it seems to work: differently from xetex, luatex descends from pdftex and shares many of the specific primitives introduced by it. Some of them have been removed, because they can be emulated with Lua functions (what pdftexcmds does). – egreg Jun 18 '12 at 7:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.