我在将图片标题居中时遇到了问题。特别是,我知道我们可以使用\usepackage[justification=centering]{caption}
居中标题,但是,我只对将特定标题居中感兴趣。我读过标题手册,但没有成功,所以我的问题是:如何将特定标题居中?
答案1
您可以\captionsetup
在特定figure
(或table
)环境中使用:
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\begin{document}
\begin{figure}[hp]
\centering
\includegraphics[scale=.30]{example-image-a}
\caption{A caption with long text bla bla bla bla bla bla bla bla
bla bla bla bla bla bla bla bla bla bla}
\end{figure}
\begin{figure}[hp]
\centering
\captionsetup{justification=centering}
\includegraphics[scale=.30]{example-image-b}
\caption{A caption with long text bla bla bla bla bla bla bla bla
bla bla bla bla bla bla bla bla bla bla}
\end{figure}
\begin{figure}[hp]
\centering
\captionsetup{justification=centering,margin=2cm}
\includegraphics[scale=.30]{example-image-c}
\caption{A caption with long text bla bla bla bla bla bla bla bla
bla bla bla bla bla bla bla bla bla bla}
\end{figure}
\end{document}