
답을 찾을 수 있을 거라 생각했어요여기, 하지만 이 특별한 경우에는 솔루션이 작동하지 않는 것 같습니다...
일반적으로 tikz 노드 내부에 그림 캡션을 어떻게 배치합니까? 다음 MWE를 만들었지만 이는 프레젠테이션에서 사용하는 레이아웃이 아니라 임의의 레이아웃이므로 이 예제뿐만 아니라 일반적인 솔루션이 필요합니다...
이 예에서는 그림 B 바로 아래에 캡션을 배치하고 싶은데 어떻게 해야 합니까?
MWE:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\usepackage[labelformat=empty,font=scriptsize,skip=0pt,
justification=raggedright,singlelinecheck=false]{caption}
\begin{document}
\begin{frame}
\begin{figure}
\begin{tikzpicture}[remember picture, every node/.style={inner sep=0,outer sep=0}]
\node[anchor=west] (A) at (0,0) {\includegraphics[width=2.25cm]{example-image-a}};
\node[right=0.75cm of A.east, anchor=west] (B) {\includegraphics[width=2.25cm]{example-image-b}
%\captionof{figure}{my caption here}%I was hoping this would work...
};
\node[below=\belowcaptionskip of B,text width=\linewidth]
{\captionof{figure}{my caption here}};%And this doesn't work either...
\node [right=0.75cm of B.east, anchor=west] (C) {\includegraphics[width=2.25cm]{example-image-c}};
\node [below=0.75cm of A.south east, anchor=north west] (D) {\includegraphics[width=2.25cm]{example-image}};
\node [right=0.75cm of D.east, anchor=west] (E) {\includegraphics[width=2.25cm]{example-image}};
\node [right=0.75cm of E.east, anchor=west] (F) {\includegraphics[width=2.25cm]{example-image}};
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
생산물:
답변1
어떤 경우에는 캡션에 한 줄만 있으면 caption
패키지 및 figure
환경을 사용하지 않고도 원하는 결과를 얻을 수 있습니다.
\documentclass{beamer}
\usepackage{lmodern,tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{frame}
\begin{center}
\begin{tikzpicture}[node distance=2mm and 5mm]
\node (A) {\includegraphics[width=2.25cm]{example-image-a}};
\node [right=of A] (B) {\includegraphics[width=2.25cm]{example-image-b}};
\node [right=of B] (C) {\includegraphics[width=2.25cm]{example-image-c}};
\node (capt) [below=of B,text width=\linewidth, align=center,font=\scriptsize]
{my caption here};
\node [below=of A |- capt.south] (D) {\includegraphics[width=2.25cm]{example-image}};
\node [right=of D] (E) {\includegraphics[width=2.25cm]{example-image}};
\node [right=of E] (F) {\includegraphics[width=2.25cm]{example-image}};
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
그러나 TikZ 사진을 두 부분으로 나눌 수 있습니다.
\documentclass{beamer}
\usepackage{lmodern,tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{frame}
\begin{figure}\centering
\begin{tikzpicture}[node distance=2mm and 5mm]
\node (A) {\includegraphics[width=2.25cm]{example-image-a}};
\node [right=of A] (B) {\includegraphics[width=2.25cm]{example-image-b}};
\node [right=of B] (C) {\includegraphics[width=2.25cm]{example-image-c}};
\end{tikzpicture}
\caption{my caption here}
\begin{tikzpicture}[node distance=2mm and 5mm]
\node (D) {\includegraphics[width=2.25cm]{example-image}};
\node [right=of D] (E) {\includegraphics[width=2.25cm]{example-image}};
\node [right=of E] (F) {\includegraphics[width=2.25cm]{example-image}};
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
캡션에 레이블을 붙이고 싶지 않은 경우 그에 따라 템플릿을 Figure
설정하기만 하면 됩니다 caption
(예: 서문에 추가).
\setbeamerfont{caption}{size=\scriptsize}
\setbeamertemplate{caption}{\insertcaption\par}
부록: TikZ 노드의 목적이 무엇인지는 나에게 명확하지 않습니다. 노드의 이미지는 노드 없이 이전과 동일한 프레임 형식으로 정렬할 수 있습니다.
\documentclass{beamer}
\setbeamerfont{caption}{size=\scriptsize}
\setbeamertemplate{caption}{\insertcaption\par}
\begin{document}
\begin{frame}
\begin{figure}\centering
\includegraphics[width=2.25cm]{example-image-a}\hfil
\includegraphics[width=2.25cm]{example-image-b}\hfil
\includegraphics[width=2.25cm]{example-image-c}
\caption{my caption here}
\includegraphics[width=2.25cm]{example-image}\hfil
\includegraphics[width=2.25cm]{example-image}\hfil
\includegraphics[width=2.25cm]{example-image}
\end{figure}
\end{frame}
\end{document}
프레임의 이미지는 이전과 동일하지만, 코드가 더욱 단순하고 간결해졌습니다.
답변2
justification=centering
패키지 의 옵션을 사용하세요 caption
.
\documentclass{beamer}
\usepackage{lmodern,tikz}
\usetikzlibrary{positioning,calc}
\usepackage[labelformat=empty,font=scriptsize,skip=0pt,
justification=centering,singlelinecheck=false]{caption}
\begin{document}
\begin{frame}
\begin{figure}\centering
\begin{tikzpicture}
\node [anchor=west] (A) at (0,0) {\includegraphics[width=2.25cm]{example-image-a}};
\node [right=0.75cm of A.east, anchor=west] (B) {\includegraphics[width=2.25cm]{example-image-b}};
\node [below=\belowcaptionskip of B,text width=\linewidth]{\captionof{figure}{my caption here}};
\node [right=0.75cm of B.east, anchor=west] (C) {\includegraphics[width=2.25cm]{example-image-c}};
\node [below=0.75cm of A.south, anchor=north] (D) {\includegraphics[width=2.25cm]{example-image}};
\node [right=0.75cm of D.east, anchor=west] (E) {\includegraphics[width=2.25cm]{example-image}};
\node [right=0.75cm of E.east, anchor=west] (F) {\includegraphics[width=2.25cm]{example-image}};
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}