vertical position of sidecap figure w.r.t. top aligned caption

How to change the vertical position of a sidecap figure w.r.t. its top aligned caption? I want the caption to be right from the figure but align like in the attached mockup.

\documentclass{article}

\usepackage[demo]{graphicx}

\usepackage{sidecap}
\sidecaptionvpos{figure}{t}

\begin{document}

\begin{SCfigure}
\includegraphics{graphs/dataset17b.pdf}
\caption{Foo bar}
\end{SCfigure}

\end{document}


verbatimbox's addvbuffer fails for long captions:

\documentclass{article}
\usepackage{verbatimbox}
\usepackage[demo]{graphicx}

\usepackage{sidecap}
\sidecaptionvpos{figure}{t}

\begin{document}

\begin{SCfigure}
\includegraphics{graphs/dataset17b.pdf}
\end{SCfigure}

\begin{SCfigure}
\includegraphics{graphs/dataset17b.pdf}
\caption{\addvbuffer[5ex 0ex]{Foo bar Foo bar Foo bar Foo bar Foo
bar Foo bar Foo bar Foo bar Foo bar}}
\end{SCfigure}

\end{document}

-
Please, add some information about your problem. The example is surely not enough to do anything that shots in the dark: how do you produce the text above the image? –  egreg May 13 '13 at 12:21

EDIT: Solution revised to handle long captions. Place a vertical rule at the beginning of the caption:

\documentclass{article}
\usepackage[demo]{graphicx}

\usepackage{sidecap}
\sidecaptionvpos{figure}{t}

\begin{document}

\begin{SCfigure}
\includegraphics{graphs/dataset17b.pdf}
\caption{\protect\rule{0ex}{5ex}Foo bar Foo bar Foo bar Foo bar Foo bar Foo bar Foo bar }
\end{SCfigure}

\end{document}


-
Thanks. Unfortunately it fails for long captions. I added a picture and code to the original question. –  Somebody May 14 '13 at 9:06
The revised solution does not need verbatimbox anymore, does it? –  Somebody May 14 '13 at 12:38
@user1350789 Correct. I will remove it. –  Steven B. Segletes May 14 '13 at 12:51

Put the includegraphics in a minipage of matching width and insert an negative vspace.

\documentclass{article}

\usepackage[demo]{graphicx}

\usepackage{sidecap}
\sidecaptionvpos{figure}{t}

\begin{document}

\begin{SCfigure}
\begin{minipage}{0.5\linewidth}
\vspace{-\baselineskip}
\includegraphics{graphs/dataset17b.pdf}
\end{minipage}
\caption{Foo bar}
\end{SCfigure}

\end{document}


Or use trim without clip in the includegraphics.

-
Hmmm.... this shouldn't be done; it can produce undesired results with the surrounding text: see the result of this simple example using your code: \documentclass{article} \usepackage[demo]{graphicx} \usepackage{sidecap} \sidecaptionvpos{figure}{t} \begin{document} aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa \begin{SCfigure}[][!ht] \begin{minipage}{0.5\linewidth} \vspace{-\baselineskip} \includegraphics{graphs/dataset17b.pdf} \end{minipage} \caption{Foo bar} \end{SCfigure} aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa \end{document} –  Gonzalo Medina May 9 '13 at 18:16
@GonzaloMedina I agree. Any idea how to do better? –  Somebody May 9 '13 at 18:42
Exactly which is the desired alignment? –  Gonzalo Medina May 9 '13 at 18:44
I have a figure with a rule on the top but also some text above. I want to do align the caption text with the rule leaving the text in the figure a bit higher. –  Somebody May 10 '13 at 6:47
Please edit your question and add an example of the actual code you are using, showing how you are producing the rule. –  Gonzalo Medina May 10 '13 at 12:49