[Tex/LaTex] Avoid newpage when using abstract with article class

abstract

How is it possible to avoid LaTeX putting an abstract on a new page when using article class and titlepage enabled?

\documentclass[11pt,a4paper,titlepage]{article}
\begin{document}
Some text...
\begin{abstract} Some text unfortunately put on a new page \end{abstract}
\end{document}

Thanks for any help!

Best Answer

As long you are not using twocolumn option, this will work.

I patched out the occurence of \newpage in the titlepage environment, which is used due to the titlepage option.

Since the original code contains @ characters, \makeatletter and \makeatother have to be used to give @ a different meaning temporarily.

\documentclass[11pt,a4paper,titlepage]{article}
\usepackage{xpatch}
\usepackage{blindtext}
\makeatletter
\xpatchcmd{\titlepage}{\@restonecolfalse\newpage}{\@restonecolfalse}{}{}
\xpatchcmd{\endtitlepage}{\if@restonecol\twocolumn \else \newpage \fi}{\if@restonecol\twocolumn \else  \fi}{\typeout{success}}{\typeout{fail}}
\makeatother
\begin{document}
Some text...

\begin{abstract} \blindtext \end{abstract}

Regular text:

\blindtext
\end{document}

enter image description here