I have an image with caption in LaTeX:
\begin{figure}[H]
\centering
\includegraphics[width=0.8\textwidth,height=0.8\textheight,keepaspectratio]{img/image9}
\caption{Text text text text text text\\*
On the basis of: \cite{Smi00}}
\label{fig:fig}
\end{figure}
it looks like that:
| |
|___________________________________________________________|
Figure 3.3 Text text text text text text
On the basis of: [4]
...
I'd like to align both lines of caption, but keep the centering of the whole caption, i.e. to change it to something like that:
| |
|___________________________________________________________|
Figure 3.3 Text text text text text text
On the basis of: [4]
...
Not:
| |
|___________________________________________________________|
Figure 3.3 Text text text text text text
On the basis of: [4]
...
Or:
| |
|___________________________________________________________|
Figure 3.3 Text text text text text text
On the basis of: [4]
...
…but all my attempts failed.
Does anybody know how it can be done?
Best Answer
Package
varwidth
provides environmentvarwidth
that is aminipage
, but the width is reduced, if the lines are shorter. The caption text can be formatted with environmentvarwidth
by an own caption format that can be defined with packagecaption
:Remarks:
\caption
to provide a (shorter) version without an explicit line break.