I would like to align the first lines of the code and the captions in the following listings. This is my LaTeX code. I've also uploaded an image of the output.
\begin{figure}[H]
\begin{minipage}[t]{0.5\textwidth}
\centering
\begin{minted}{c++}
void MyClass::Run()
{
// no work
if (!m_HasWork)
return;
/* process the new frame */
// done
m_HasWork = false;
}
\end{minted}
\captionof{listing}{Main thread (process a frame)}
\label{fig:thread1}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\centering
\begin{minted}{c++}
void MyClass::Update(
const video::ImageFrame& Frame)
{
// skip frame (not done with previous)
if (m_HasWork)
return;
/* make a local copy
* of the frame */
// indicate that there's work
m_HasWork = true;
}
\end{minted}
\captionof{listing}{Interrupt (get a frame)}
\label{fig:interrupt}
\end{minipage}
\captionof{listing}{not relevant}
\label{fig:sync}
\end{figure}
Output: (I want the captions of listings 1 and 2 on the same line)


\end{minipage}you need a%. At the moment you get an unwanted space which results in the with0.5\textwidth+0.5\textwidth+\space. – Marco Daniel Apr 27 '13 at 15:08