title: Center Latex lstlisting
body: <p>This is driving me crazy.</p>
  
  <p>I want to center a lstlisting in LaTeX.</p>
  
  <p>After 3 hours attempting here's some code:</p>
  
  <pre><code>\lstset{ %
      caption=Descriptive Caption Text,
      label=lst:descr_capti_text,
      basicstyle=\ttfamily\footnotesize\bfseries,
      frame=tb,
      linewidth=0.6\textwidth
   }
  \centering\begin{tabular}{c}
  \begin{lstlisting}
  printf("this should be centered!");
  \end{lstlisting}
  \end{tabular}
  </code></pre>
  
  <p>This is putting the lstlisting on the center but not its caption, that goes to the right. If I take out the tabular, then caption gets centered but the code goes to the left! :(</p>
  
  <p>Thank you.</p>