Error in compiling \includepdf

My latex file is something like this:

\usepackage{pdfpages}
\begin{document}
...
\bibliographystyle{abbrv}
\bibliography{my_bib}
\includepdf[pages=-]{my_file.pdf}
\end{document}

The problem is that while compiling, the last page of the main document i.e. the references appear with the last page of my_file.pdf. What could be the possible solution ?

• A \newpage before includepdf? – Ignasi Jun 18 '16 at 9:19
• No, it didn't help, the same problem – user2907045 Jun 18 '16 at 9:24
• Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. A suggestion: Do us a favour and change your username to something more telling than "user1234". – Martin Schröder Jun 19 '16 at 12:26

UPDATE I think I have reproduced your error now, after using the IEEEtran document class as you said, because when adding more lipsum, text started to float into the included pdf file. Fixed it by adding a \cleardoublepage. I noticed newpage alone is not enough here.

\documentclass{IEEEtran}
\usepackage{lipsum}
\usepackage{pdfpages}
\begin{document}
\lipsum
\cite{ref1}
\lipsum
\bibliographystyle{abbrv}
\bibliography{my_bib}
\cleardoublepage
\includepdf[pages=-]{my_file.pdf}
\end{document}
• I suppose its the problem with my document class, I changed my documentclass and its working without any warning. But I have been using \documentclass{IEEEtran} and ignored one warning: usage of caption package is not recommended. I guess the whole problem is because of this warning ? – user2907045 Jun 18 '16 at 9:49
• Ah, maybe for the next time it's handy to include a MWE of which you know it doesn't work, so including the documentclass and everthing we need with which we can reproduce the error. You can test this out yourself, in a new file or something. But anyway, when I use \documentclass{IEEEtran} my MWE still compiles fine... it doesn't on your side? Seems that it has to do with some package, maybe? the caption package doesn't cause any problems on my side. – PHPirate Jun 18 '16 at 9:57
• Yes, Now I figured it out, it was because of this particular doumentclass. I used the this post tex.stackexchange.com/questions/133037/… and problem is solved. – user2907045 Jun 18 '16 at 10:13
• Hmm, maybe I solved a different problem then? Ah well, the more solutions the better. I'm glad it is solved anyway! – PHPirate Jun 18 '16 at 10:14