Changing caption width in latex
In this post I will discuss how to change the width of the figure caption. You can use the same technique to change the width of the other caption (like table caption). Here I am using the caption
package. In caption package you can specify the width while loading the package or latter using \captionsetup
command. Syntax of the both command are as following
\usepackage[<option>]{caption}
and command for captionsetup is
\captionsetup[<float type>]{<option>}
In the <option>
we can use width=0.8\textwidth
to specify width of the caption. If we specify that in the time of loading (i.e. when using with \usepackage
command) it will affect all the float (like figure, table) but if you specify it in command \usepackage
then you can specify float type. Then the specific float type will only be effected. This way you can specify two different width for different float.
You can also specify other kind of formatting (like italic text) using this package, See the caption package documentation for detail.
Bellow is one minimal working example for the same:
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage{lipsum}
\begin{document}
\lipsum[2]
\begin{figure}
\captionsetup{width=0.8\textwidth}
\centering
\includegraphics{image}
\caption{\protect\lipsum[4]}
\end{figure}
\end{document}
CheersA.Paul
Source:
Caption package documentationTeX.StacExchange answer
Comments
Post a Comment
Please dont forget to tell me if this post helped you or not...