Beamer \visible 슬라이드 전환, 캡션이 작동하지 않습니다

Beamer \visible 슬라이드 전환, 캡션이 작동하지 않습니다

"가시적" 전환이 있는 MWE가 있습니다. <1>에 표시되는 요소와 <2>에 표시되는 요소가 있습니다.

캡션을 엉망으로 만들기 전까지는 원하는 결과를 얻었습니다. <2>(MWE에 설명됨)에 그림 B의 캡션을 추가하려고 하는 순간 다음과 같은 오류가 발생합니다.

\spacefactor가 부적절합니다. \end{프레임}

그림 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 아래에 캡션이 없다는 점에 유의하세요. 어떻게 작동하게 할 수 있나요?? 감사해요!!

답변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};

관련 정보