Beamer \ スライドの遷移が見えるが、キャプションが機能しない

Beamer \ スライドの遷移が見えるが、キャプションが機能しない

「可視」遷移を持つ MWE があります。<1> で表示される要素と <2> で表示される要素があります。

キャプションをいじろうとするまでは、望みどおりの結果が得られました。<2> (MWE でコメントされています) の図 B のキャプションを追加しようとした瞬間、次のような 100 万件ものエラーが発生してしまいました。

不適切な\spacefactor。\end{frame}

図 A と B には異なるキャプションを追加したいことに注意してください。

これが MWE です:

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\usepackage[labelformat=empty,font=scriptsize,skip=0pt,
justification=raggedright,singlelinecheck=false]{caption}
\usepackage{threeparttable}

\begin{document}

\begin{frame}
    \begin{figure}
    \begin{measuredfigure}
    \begin{tikzpicture}[remember picture, every node/.style={inner sep=0,outer sep=0,align=left}]
    \node (node1) at (0,0) {\includegraphics[width=6.8cm]{example-image}};

    \visible<1>{
        \node[right=6.9cm of node1.south west, anchor=south west] (node2) {\includegraphics[width=3.75cm]{example-image-a}};
    }
    \visible<2>{
        \node[right=6.9cm of node1.south west, anchor=south west] (node2) {\includegraphics[width=3.75cm]{example-image-b}};
    }
    \end{tikzpicture}
    \visible<1>{
        \captionof{figure}{\hspace{6.9cm}caption of figure A}
    }
    %\visible<2>{%WORKS UNTIL I TRY TO ADD THIS CAPTION
    %   \captionof{figure}{\hspace{6.9cm}caption of figure B}
    %}
    \end{measuredfigure}
    \end{figure}
\end{frame}

\end{document}

これによって次のものが生成されます:

あ

B

B の下にキャプションがないことに注意してください... どうすれば動作させることができますか? ありがとうございます!!

答え1

編集: 次の MWE を試してください。

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
\begin{frame}
    \begin{figure}
\begin{tikzpicture}[
    node distance =0mm and 5mm,
    every node/.style={anchor=west, align=center}
                    ]
\node (a) {\includegraphics[width=6.8cm]{example-image}};
\visible<1>{
\node (b) [above right=of a.south east] {\includegraphics[width=3.75cm]{example-image-a}};
\node[below=of b] {caption of figure A};
            }
\visible<2>{
\node (b) [above right=of a.south east] {\includegraphics[width=3.75cm]{example-image-b}};
\node[below=of b] {caption of figure B};
            }
\end{tikzpicture}
    \end{figure}
\end{frame}
\end{document}

複数行のキャプションの場合は、キャプション付きのノードに別のスタイルを定義します。例:

 capt/.style = {text width=#1, align=left}

\node[below=of b] {caption of figure B};代わりに

\node[capt=3.75cm, below=of b] {caption of figure B};

関連情報