summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/newpax/doc-use-pax.tex
blob: 08bfe5abe7fd21f8e3907e32aa4e1b1c5954bd3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
% !Mode:: "TeX:UTF-8:Main"
\documentclass{article}
\usepackage{ifluatex,etoolbox}
\usepackage{pdfpages}
%pax needs this to run with lualatex
\ifluatex
\usepackage{pdftexcmds}
\makeatletter
\let\pdfstrcmp\pdf@strcmp
\let\pdfescapename\pdf@escapename
\makeatother
\usepackage{luatex85}
\fi
%load pax
\usepackage{pax}
%correct a bug in pax affecting clipping
\makeatletter
\patchcmd\PAX@pdf@annot{\PAX@pagellx}{\PAX@page@llx}{}{\fail}
%allow hashes and percent in the pax file
\patchcmd\PAX@AddAnnots{\InputIfFileExists\PAX@file{}{\typeout{* Missing: \PAX@file}}}
 {\begingroup \catcode`\#=12 \catcode`\%=12
  \InputIfFileExists\PAX@file{}{\typeout{* Missing: \PAX@file}}\endgroup}{}{\fail}
\makeatother
\begin{document}
\includegraphics[scale=0.5,trim=5cm 15cm 8cm 3cm,clip,page=2]{doc-input1}
\includegraphics[scale=0.5,trim=5cm 15cm 8cm 3cm,clip,page=1]{doc-input1}

\includepdf[pages=-]{doc-input2}
\end{document}