Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to know how to center the listings gerenated caption in LaTeX. It always go to the left of the code. The rest of the captions (tables) are OK.

\documentclass[11pt,a4paper,oneside, onecolumn]{IEEEtran}
\begin{lstlisting}[caption={Exemplo de uso da função CorelDB.},label={list1}]
fileName = 'CorelGCH.arff';
features = CorelDB(@NormalizedGCH);
dlmwrite(fileName, features, ',');

I think the problem is with the IEEEtran...

share|improve this question
From LaTeX Community: Cannot align caption to the center, you need the conference option added to your \documentclass line. –  Mike Renfro Jul 2 '12 at 13:59
That works. And I found that: \usepackage[justification=centering]{caption} Works too. –  CaioMendes Jul 2 '12 at 14:05
Consider answering your own question (two ways, yours and Mike Renfro's) and accepting your answer. Then the question won't appear on the list of those needing attention. You earn some reputation that way too. –  Ethan Bolker Jul 2 '12 at 14:59
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. –  Jubobs Mar 1 at 22:36
add comment

1 Answer

To center the caption in the class IEEEtran you have two possibilities:

  1. Load the class with the option conference. This was discussed at LaTeX Community: Cannot align caption to the center,

  2. Load the package caption with the option justification=centering:

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.