字幕位置

字幕位置

我正在编写一个 latex 代码,其中我使用 \includegraphics[]{} 包含一个图形。标题始终位于图形下方的中心。如何将其位置更改为最左侧(图形下方)?

谢谢

答案1

防止单行标题居中的正常方法是添加

\usepackage[singlelinecheck=no]{caption}

序言。然而,根据IEEEtran 文档类(附录 A),字幕包干扰字幕格式的其他方面。因此,我认为最好的解决方案是取消居中:

\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}

然而,期刊编辑往往不喜欢这种伎俩。

字幕

答案2

无需使用measured figure环境对包中的任何内容进行修补threeparttable

\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} 

在此处输入图片描述

相关内容