En Beamer, ¿cómo se agrega un título a una figura dentro de un nodo tikz?

En Beamer, ¿cómo se agrega un título a una figura dentro de un nodo tikz?

Pensé que encontraría la respuesta.AQUÍ, pero la solución no parece funcionar en este caso particular...

En general: ¿Cómo se colocan los títulos de las figuras dentro de los nodos tikz? Hice el siguiente MWE, pero este no es el diseño que uso en mi presentación, solo uno aleatorio, así que necesito una solución general, no solo para este ejemplo...

En este ejemplo, solo quiero colocar un título justo debajo de la figura B, ¿cómo debo hacerlo?

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}

Produce:

higo

Respuesta1

En el caso de que su título tenga solo una línea, puede obtener el resultado deseado sin usar el captionpaquete ni figureel entorno:

\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}

ingrese la descripción de la imagen aquí

Sin embargo, puedes dividir la imagen de TikZ en dos partes:

\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}

Si no desea tener Figureuna etiqueta en el título, solo necesita configurar captionla plantilla en consecuencia, por ejemplo, agregarla al preámbulo:

\setbeamerfont{caption}{size=\scriptsize}
\setbeamertemplate{caption}{\insertcaption\par}

Anexo: No me queda claro cuál es el propósito de los nodos TikZ. Las imágenes en nodos se pueden organizar en la misma forma de marco que antes sin ellos:

\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}

La imagen del marco es la misma que antes, pero el código es más simple y conciso.

Respuesta2

Utilice la justification=centeringopción en el captionpaquete.

\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}

ingrese la descripción de la imagen aquí

información relacionada