@celenius - if you really want to get rid of that pagebreak, here's a very dirty trick to do it...
\makeatletter
\let\O@@input@\@input@
\def\@noclearpage{\@ifnextchar\clearpage\@gobble\relax}
\def\@input@#1{\O@@input@{#1}\@noclearpage}
\let\O@@include\@include
\def\@include{\expandafter\@noclearpage\O@@include}
\let\O@include\include
\def\include{\expandafter\@noclearpage\O@include}
\makeatother
Basically we perform surgery on the \include
macro to get rid of all the \clearpage
instances, but the cleanest way to do this, as you can see, is still really dirty. This is horribly brittle and will likely only work for the article
class, so if you're using a different \documentclass
, you're out of luck. I basically derived this by enabling \tracingcommands=1
and \tracingmacros=1
and grepping the .log
file for \clearpage
so that I could hack whatever gets called before it to insert a \@noclearpage
.
I don't recommend this solution - it would be much better to look into how chapterbib
works and fix it the right way, without depending on \include
and the separate .aux
files it generates... but I'm positive that would be a pretty difficult task. I guess another workaround would be to write a command to emulate \include
's breaking up of .aux
files, without actually doing the includes...
EDIT: okay, here's a quickie
\makeatletter
\newenvironment{auxfile}[1]{\relax
\ifnum\@auxout=\@partaux
\@latex@error{auxfile environments cannot be nested or \string\include d}
\@eha
\else\@changeaux{#1}\fi
}{\immediate\closeout\@partaux\let\@auxout\@mainaux}
\def\@changeaux#1{%
\immediate\write\@mainaux{\string\@input{#1.aux}}%
\let\@auxout\@partaux
\immediate\openout\@partaux#1.aux%
\immediate\write\@partaux{\relax}}
\makeatother
Then you can just insert \begin{auxfile}{foo}...\end{auxfile}
and it will use foo.aux
instead of the normal .aux
file. This is fully compatible with chapterbib
. I don't think CTAN has anything like this, so maybe I'll submit it as a mini-package.