In LaTeX, I use a package listingsto display a piece of code inside a table. But it seems that when using this package, the vertical alignment of the cells changes.
Here is the code:
\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern,textcomp}
\usepackage[frenchb]{babel}
\usepackage{listings}
\begin{document}
\begin{tabular}{ll}
\hline Méthode & Exemple d'utilisation\\
\hline isLetter()&
\begin{lstlisting}
QChar MyChar('x');
bool IsLetter = MyChar.isLetter();
// IsLetter vaut vrai
// bla bla bla
\end{lstlisting}\\
\hline
\end{tabular}
\end{document}
and here is what I get (note the centered vertical alignment of the first column):
http://img820.imageshack.us/img820/8509/image4l.png .
If I do not use the package listingsinside the table, the vertical alignment is different (in the center):
\begin{tabular}{lp{5cm}}
\hline Méthode & Exemple d'utilisation\\
\hline isLetter()&
QChar MyChar('x');
bool IsLetter = MyChar.isLetter();
// IsLetter vaut vrai
// bla bla bla
\\
\hline
\end{tabular}
http://img691.imageshack.us/img691/8585/image5gy.png .
I would like to add code inside the table, but keep the vertical alignment at the top for the cells.