使用叠加选项时,如何将图片标题放在图像下方?我想避免通过\vspace{}
或类似方法手动移动标题。
\documentclass{article}%
\usepackage[a4paper,left=10mm,right=10mm,top=10mm,bottom=10mm]{geometry}%
\usepackage{tikz}%
\usepackage{mwe}
\usepackage{caption}%
\begin{document}
% This doesn't work => caption is inside of the picture //overlay is used!
\vspace*{\fill}
\begin{figure}[h!]
\centering
\begin{tikzpicture}[remember picture,overlay]
\node at (current page.center){\includegraphics[width=10cm,height=10cm]{example-image-a}};
\end{tikzpicture}
\caption{My Caption}
\end{figure}
\vfill
\clearpage
% This works => caption is inside below the picture //overlay is not used!
\vspace*{\fill}
\begin{figure}[h!]
\centering
\begin{tikzpicture}[remember picture]
\node at (current page.center){\includegraphics[width=10cm,height=10cm]{example-image-a}};
\end{tikzpicture}
\caption{My Caption}
\end{figure}
\vfill
\end{document}
答案1
我不确定你为什么要overlay
在那里使用,但你可以将标题放在带有图像的节点下方:
\documentclass{article}
\usepackage[a4paper,margin=10mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{caption}
\begin{document}
\begin{figure}[p]
\centering
\begin{tikzpicture}[remember picture,overlay]
\node (img) at (current page.center){\includegraphics[width=10cm,height=10cm]{example-image-a}};
\node[below=0cm of img,text width=\linewidth,anchor=north] {{\captionof{figure}{My Caption}}};
\end{tikzpicture}
\end{figure}
\clearpage
\begin{figure}[p]
\centering
\begin{tikzpicture}[remember picture]
\node at (current page.center){\includegraphics[width=10cm,height=10cm]{example-image-a}};
\end{tikzpicture}
\caption{My Caption}
\end{figure}
\end{document}