3

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)...

3
+100

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.

Despite your comment

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}}}{}
\zref@addprops{LastPage}{pagevalue}
\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@addprops{LastPage}{pagevalue}
\zexternaldocument[pre-]{docA}\relax
\zref@ifrefundefined{pre-LastPage}{\@latex@error{Zref label `LastPage' of `DocumentA' is undefined}\@ehc}{%
\setcounter{page}{\numexpr\zref@extractdefault{pre-LastPage}{pagevalue}{0}+1\relax}}
\makeatother

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

and then run arara on main.tex. You can make the arara directives as complicated as necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.