1

I am writing a latex code where I include a graphic using \includegraphics[]{}. The caption is always at the center below the figure. How to change its location to the very left (below the figure) ?

Thanks

3
  • What document class are you using? Sep 17, 2014 at 9:28
  • \documentclass[conference]{IEEEtran}
    – tam
    Sep 17, 2014 at 9:32
  • 3
    If you use the IEEEtran class for a submission, you shouldn't modify the layout.
    – egreg
    Sep 17, 2014 at 9:51

2 Answers 2

2

The normal way to prevent centering of one line captions is to add

\usepackage[singlelinecheck=no]{caption}

to the preamble. However, according to the documentation for the IEEEtran document class (appendix A), the caption package interferes with other aspects of caption formatting. Therefore I think the best solution is to hack away the centering:

\documentclass{IEEEtran}
\usepackage{etoolbox}
\makeatletter
\patchcmd\@makecaption{\hfil\box\@tempboxa\hfil}{\box\@tempboxa\hfil}{}{}
\makeatother
\usepackage{lipsum}
\begin{document}
\begin{figure}
\centering\rule{6cm}{4cm}
\caption{A nice figure.}
\end{figure}
\lipsum[1]
\begin{figure}
\centering\rule{6cm}{4cm}
\caption{A really nice figure that happens to have a very long caption. 
         So long that it needs two lines.}
\end{figure}
\end{document}

Journal editors tend not like this type of trick, though.

captions

0

No need for patching whatever using the measured figure environment, from the threeparttable package:

\documentclass{IEEEtran}
\usepackage{graphicx}
\usepackage{threeparttable}

\begin{document}

\begin{figure}
\centering
\begin{measuredfigure}
\includegraphics[scale = 0.5]{AliceSteadman.png}
\caption{A nice figure.}
\end{measuredfigure}
\end{figure}

There was a table set out under a tree in front of the house, and the March Hare and the Hatter were having tea at it: a Dormouse was sitting between them, fast asleep, and the other two were using it as a cushion, resting their elbows on it, and talking over its head. 'Very uncomfortable for the Dormouse,' thought Alice; 'only, as it's asleep, I suppose it doesn't mind.'

 The table was a large one, but the three were all crowded together at one corner of it: 'No room! No room!' they cried out when they saw Alice coming. 'There's plenty of room!' said Alice indignantly, and she sat down in a large arm-chair at one end of the table.

 'Have some wine,' the March Hare said in an encouraging tone.

 Alice looked all round the table, but there was nothing on it but tea. 'I don't see any wine,' she remarked.

 'There isn't any,' said the March Hare.

 'Then it wasn't very civil of you to offer it,' said Alice angrily.

 'It wasn't very civil of you to sit down without being invited,' said the March Hare.

 'I didn't know it was your table,' said Alice; 'it's laid for a great many more than three.'
\end{document} 

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .