The following code gets the chapter title on the first page of the included PDF and enables the correct page references. mypages is a 16 page PDF used merely for demonstration purposes.
\documentclass{memoir}
\usepackage{pdfpages}
\usepackage{hyperref}
\usepackage{cleveref}
\makeatletter
\newcommand\incpdfchapter{%
\ifartopt\par\@nameuse{chapterblock}\else
\thispagestyle{chapter}
\global\@topnum\z@
\fi
\m@mindentafterchapter
\@ifstar{\@m@mschapter}{\@m@mchapter}}
\makeatother
\begin{document}
\chapter{Foo}
Foo\cpagerefrange{appendix:b}{appendix:bslut}.
\chapter{Bar}
\clearforchapter
\includepdf[scale=0.8,pages=1,pagecommand=\incpdfchapter{Multipage}\label{appendix:b}]{mypages}
\includepdf[scale=0.8,pages=2-15,pagecommand={}]{mypages}
\includepdf[scale=0.8,pages=16,pagecommand={}\label{appendix:bslut}]{mypages}
\end{document}
If you would prefer a more automated solution at the cost of a bit less flexibility in specifying your labels, you might try something like this:
\documentclass{memoir}
\usepackage{pdfpages}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{xparse}
\makeatletter
\newcommand\incpdfchapter{%
\ifartopt\par\@nameuse{chapterblock}\else
\thispagestyle{chapter}
\global\@topnum\z@
\fi
\m@mindentafterchapter
\@ifstar{\@m@mschapter}{\@m@mchapter}}
\newcounter{incpdfpages}
\NewDocumentCommand\myincpdf{ d<> O {} m m }{%
\clearforchapter
\IfNoValueTF{#1}{%
\def\incpdflabel{#3}}{%
\def\incpdflabel{#1}}
\includepdf[#2, pages=1, pagecommand=\incpdfchapter{#3}\label{\incpdflabel}]{#4}%
\setcounter{incpdfpages}{1}%
\includepdf[#2, pages=2-, pagecommand=\refstepcounter{incpdfpages}\label{\incpdflabel:\theincpdfpages}]{#4}%
}
\NewDocumentCommand\mysingpdf{ d<> O {} m m }{%
\clearforchapter
\IfNoValueTF{#1}{%
\def\incpdflabel{#3}}{%
\def\incpdflabel{#1}}
\includepdf[#2, pages=1, pagecommand=\incpdfchapter{#3}\label{\incpdflabel}]{#4}%
}
\makeatother
\begin{document}
\chapter{Foo}
Foo\cpagerefrange{appendix:b}{appendix:b:16}. Here is a reference to \cpageref{appendix:c}.
\chapter{Bar}
\myincpdf<appendix:b>[scale=0.8]{My Pages}{mypages}
\mysingpdf<appendix:c>[scale=0.8]{My Other Page}{mygraphics}
\end{document}
Again, mypages.pdf is assumed to be a 16 page PDF. The command \myincpdf<>[]{}{} takes 2 optional and 2 mandatory arguments.
- The first optional argument is specified using
<> and should be the label you'd like to use for the first page of the included PDF. Labels for later pages are constructed from this label by appending :n where n is the number of the page in the original PDF. For example, if the PDF has 16 pages, the last page gets the label baselabel:16 where baselabel is the label you specified for the first page. If you do not specify the label, it will be set to the value of the chapter title. (Be careful that you do not leave the label unset if the chapter title includes characters which don't work in labels.)
- The second optional argument is specified using
[]. Include any extra options you want passed to \includepdf here.
- The first mandatory argument should specify the title of the chapter.
- The second mandatory argument should give the PDF file to be included.
Obviously, this is not really tested. I checked it worked for my example and for cases where I omitted the optional arguments but that's all. Caveat emptor.
EDIT: I've updated the code in response to the question concerning single-page PDFs in the comments. \mysingpdf is just like \myincpdf but it will include only the first page of the PDF. Use this command for single-page documents or for cases where you only want the first page to be included.
labelling only works correctly,if there is\refstepcounterformat done before. You need a counter for yourincludepdf, maybe a\begin{figure}...\end{figure}environment or something else. Please provide a small MWE – Jun 01 '14 at 10:03myref.styis. – Andrew Swann Jun 01 '14 at 11:26Interview 1.1, Interview 1.2etc? – Jun 01 '14 at 11:54pagecommand=\chapter{Multipage}\label{appendix:b}. (Naturally this means that you will have to use a special\includepdffor the last page). – Ulrike Fischer Jun 01 '14 at 16:53multipage.pdf. – cfr Jun 01 '14 at 17:02pagecommand= \chapter{abc}should work fine. – Ulrike Fischer Jun 01 '14 at 20:21