I am setting up appendices like suggested in the answer to this question:
Appendix - Adding PDF, using the MWE suggested by cfr:
\documentclass[a4paper]{article}
\usepackage{geometry}
\usepackage{fancyhdr}
\usepackage{pdfpages}
\usepackage{xparse}
\usepackage{kantlipsum}
\makeatletter
\NewDocumentCommand\headerspdf{ O {pages=-} m }{% [options for include pdf]{filename.pdf}
\includepdf[%
#1,
pagecommand={\thispagestyle{fancy}},
scale=.7,
]{#2}}
\NewDocumentCommand\secpdf{somO{1}m}{% [short title]{section title}[page specification]{filename.pdf} --- possibly starred
\clearpage
\thispagestyle{fancy}%
\includepdf[%
pages=#4,
pagecommand={%
\IfBooleanTF{#1}{%
\section*{#3}}{%
\IfNoValueTF{#2}{%
\section{#3}}{%
\section[#2]{#3}}}},
scale=.65,
]%
{#5}}
\makeatother
\pagestyle{fancy}
\begin{document}
Reference to my appendix \ref{secpdf:Test}.
\newpage
\appendix
\secpdf[Short Title]{PDF on Section Page with Short Title}{/usr/local/texlive/2013/texmf-dist/doc/latex/mwe/mwe.pdf}
\label{secpdf:Test}
\kant[3]
\headerspdf[pages=2-3]{/usr/local/texlive/2013/texmf-dist/doc/latex/mwe/mwe.pdf}
\end{document}
It correctly delivers Appendix A in appendix, but now I am having troubles with the cross-referencing. I tried a reference like shown in the example but it does not work properly.
There is a similar case, which I cannot manage to transfer on my case: How to correctly label an included PDF?
xparseso far, but I recognize an unnumbered\section*command by far ;-) This command does not issue an\refstepcountercommand, and that's possibly the reason why the label points to some other place. – Aug 03 '14 at 20:34\end{document}command ;-) – Aug 03 '14 at 22:10