LaTex issue: How to make the figure captions centered?

Couple days ago, I spent so many hours figuring out how to make my figure captions centered in LaTex. I use WindEdt 6 Editor and IEEE journal template for that. The problem was, the IEEE journal template will automatically make the figure captions  left justified. Several minutes later, I found a great page written by Michael Shell to solve this problem. Here’s the link : http://www.michaelshell.org/tex/ieeetran/

According to the above link, basically what I need to do is to add an additional code in my tex file as follows:

[contentblock id=1 img=adsense.png]

[syntax type=”css”]
makeatletter
longdef@makecaption#1#2{ifx@captype@IEEEtablestring%
footnotesizebegin{center}{normalfontfootnotesize #1}
{normalfontfootnotesizescshape #2}end{center}%
@IEEEtablecaptionsepspace
else
@IEEEfigurecaptionsepspace
setbox@tempboxahbox{normalfontfootnotesize {#1.}~~ #2}%
ifdim wd@tempboxa >hsize%
setbox@tempboxahbox{normalfontfootnotesize {#1.}~~ }%
parbox[t]{hsize}{normalfontfootnotesize noindentunhbox@tempboxa#2}%
else
hbox tohsize{normalfontfootnotesizehfilbox@tempboxahfil}fifi}
makeatother
[/syntax]

I have added the above code after my document class initialization in my tex file and it has worked perfectly for me. I really need to thank Michael Shell for his useful information regarding this matter :D. Hope this information will also help those who face the same problem.

One Reply to “LaTex issue: How to make the figure captions centered?”

  1. I faced a same problem.
    Could you please send me file that you already fixed or tell detail how to fix it.
    Thank you very much!!

Leave a Reply