[Tex/LaTex] How to add a one-column figure with caption after title and before abstract in a two-column document

acmfloatspositioningtitles

I'm trying to add a teaser (figure) after title and before the abstract section in a document with acm_proc_article-sp class but no luck!

Tried to use the following solution by David Carlisle, but don't know how to change the code to put figure after the title:

How do I put a figure* before my abstract?

\documentclass{acm_proc_article-sp}

\makeatletter
\patchcmd\@maketitle\null{{\myfigure{}\par}}{}{}
\makeatother

 \begin{document}
 \newcommand\myfigure{%
    \centering
    \includegraphics[width=\linewidth]{teaser}
    \captionof{figure}{Some stuff about the teaser}
    \label{fig-teaser}
   }
\title{a title}
\maketitle

 \begin{abstract} 
  abstract
 \end{abstract}

Best Answer

This might be what you're after:

enter image description here

\documentclass{acm_proc_article-sp}% http://www.acm.org/sigs/publications/acm_proc_article-sp.cls/view
\usepackage{etoolbox,lipsum}
\makeatletter
\patchcmd\@maketitle\@author{\@author \\[\normalbaselineskip] \myfigure}{}{}
\newcommand\myfigure{%
  \makebox[0pt]{\includegraphics[width=\linewidth]{example-image}} \\[\normalbaselineskip]
  \refstepcounter{figure}\normalfont\textbf{Figure~\thefigure: Some stuff about the teaser}
  \label{fig-teaser}
}
\makeatother

\title{A title}
\author{An author}

\begin{document}
\maketitle

\begin{abstract} 
abstract
\end{abstract}

\section{A section}
\lipsum[1-10]

\begin{figure}
  \includegraphics[width=\linewidth,height=2\baselineskip]{example-image}
  \caption{A figure}
\end{figure}

\end{document}

You original patch of \@maketitle in acm_proc_article-sp inserts the figure (\myfigure) as a replacement for \null. This is too early, making the figure appear above the title. Instead, I've placed it as part of the \@author construction, and therefore comes below that (and above the abstract).

Since caption is not suggested with this document class (see the .log for some warnings), I've manually set Figure 1: <caption> using the same construction techniques employed by the class.