# Including a document into another one without redefining setting

For a publication, I have to include another publication. The second one is in English and uses IEEEtr style.

I could of course compile the second one into a pdf file and include the pdf into the second one, but then the page numbers won't match.

Removing the header data of the second file is'nt really an option because the settings are quite different (other language, style, definitions, content)...

You potentially can use the combine package, but it may take work. The default for the combine package is for all the individual documents to be of the same class and for that class to be supported (article, memoir, book, report, and letter). The documentation says that with some limitations and work you can get it to work for other cases.

I could of course compile the second one into a pdf file and include the pdf into the second one, but then the page numbers won't match.

this is the approach I would take since getting the page numbering to work is relatively easy and the solution is given in this question xr - temporarily redefine \label for exporting section counter to sister document?. Then you just need the pdfpages package and arara to bring it all together (although arara is technically optional it makes things easier).

I create 3 files:

main.tex

\documentclass{article}
\usepackage{pdfpages}

\begin{document}
\includepdf[pages={-}]{docA.pdf}\clearpage
\includepdf[pages={-}]{docB.pdf}
\end{document}

% arara: pdflatex: { files: [ docA.tex] }
% arara: pdflatex: { files: [ docB.tex] }
% arara: pdflatex: { files: [ main.tex] }

docA.tex

\documentclass{article}
\usepackage{zref-lastpage}
\usepackage{lipsum}

\makeatletter
\zref@ifpropundefined{pagevalue}{\zref@newprop*{pagevalue}[0]{\number\value{page}}}{}
\makeatother

\begin{document}
\lipsum[1-10]
\end{document}

docB.tex

\documentclass{article}
\usepackage{zref-xr}
\usepackage{zref-lastpage}
\usepackage{lipsum}

\makeatletter
\zref@ifpropundefined{pagevalue}{\zref@newprop*{pagevalue}[0]{\number\value{page}}}{}
\zref@ifrefundefined{pre-LastPage}{\@latex@error{Zref label LastPage' of DocumentA' is undefined}\@ehc}{%