# Arithmetic overflow with pax?

I am heavily using pdfpages to concatenate a set of papers. One of the papers has a big table, rotated, using the sidewaystable environment. That paper, by itself, compiles perfectly, with the desired output.

Nevertheless, when importing the PDF, the main document complains with this error:

<use 04/sample.pdf, page 7> (./04/sample.pax)
! Arithmetic overflow.
\calc@next@digit ... \multiply \calc@numerator 10
\calc@Acount \calc@numerat...
l.45 ... Juan-Manuel Torres-Moreno}{04/sample.pdf}


In fact, with this error message I am not sure if the problem is with pdfpages itself, or with the pax package. But given that that page result in the final PDF is the one shown in the figure, I expect it to be a pdfpages problem.

EDIT:

Here a MWE. Note that it includes a PDF file. You can find it at http://eremita.di.uminho.pt/~ambs/sample.pdf. I found out it is a problem with 'pax' (if I comment it, it doesn't complain). And, finally, note that it will fail only the second time you compile it.

\documentclass{article}
\usepackage{pdfpages}

\usepackage{pax}
\usepackage{hyperref}

\begin{document}
\includepdf[fitpaper=true,pages=2-]{04/sample.pdf}
\end{document}


Any hint? Suggestion? Workaround?

• Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – cryingshadow Dec 23 '15 at 13:27
• Yeah, I am trying to do it, to add it later to this post, as it will take some work. I posted earlier in case someone recognized the error meanwhile. – Alberto Dec 23 '15 at 14:00
• Dear @cryingshadow, now we have a MWE. :-) – Alberto Dec 23 '15 at 14:12
• It seems the "output" generated by the pax package (more precisely the JAR file within that package) contains computations that lead to an overflow in the TeX engine. Do you need the PDF annotations for that table? As a workaround, you could try to first extract the table using pdfpages to a separate PDF without annotations and then try the main file again with this separated PDF file instead of using that page from the original PDF. – cryingshadow Dec 23 '15 at 17:57
• I turned my comment (with a bit more of explanation and an adaption of your example) into an answer. Since we do not have a better answer yet, a partial answer is better than nothing. Whenever someone comes up with a better solution, you can still change the accepted answer (in case you accept mine). – cryingshadow Dec 23 '15 at 21:42

This is only a workaround but as long as no better answer is available, this solves at least the current problem: It seems the "output" generated by the pax package (more precisely the JAR file within that package) contains computations that lead to an overflow in the TeX engine. The pax package tries to keep PDF annotations when including PDFs. Since in the current situation no annotations need to preserved, the workaround is to first extract the table using pdfpages to a separate PDF without annotations (say, table.pdf and the page of the original PDF with that table was 42). Then the main file can be changed as follows using the separate PDF instead of all pages of the original.

\documentclass{article}
\usepackage{pdfpages}

\usepackage{pax}