AtBeginSection Beamer를 올바르게 사용하십시오.

AtBeginSection Beamer를 올바르게 사용하십시오.

나는 이 MWE를 가지고 있습니다.이것)

\documentclass{beamer}
\usepackage{graphicx}

\usepackage{xparse}

\let\beameroldsection\section% Store the old definition first

\def\sectiondesc{}
\RenewDocumentCommand{\section}{sO{#3}m O{}}{%
    \gdef\sectiondesc{}
    \IfBooleanTF{#1}{% Grab the starred version, i.e. \section*
        \beameroldsection*{#3}%
    }{%
        \beameroldsection[#2]{#3}%
        \gdef\sectiondesc{#4}% Store argument 4
    }%
}

\setbeamertemplate{section page}
{
    \begin{centering}
        \begin{beamercolorbox}[sep=12pt,center]{part title}
            \usebeamerfont{section title}{\insertsection}\par \insertsectionhead
        \end{beamercolorbox}
    \end{centering}

    \begin{center}
        \sectiondesc        
    \end{center}

}


\AtBeginSection[]{
    \begin{frame}{Overview}
        \hfill
        \begin{minipage}{.45\textwidth}
            nothing?\sectionpage%\sectiondesc %%% Tried both `\sectionpage` and `\sectiondesc`
        \end{minipage}
    \end{frame}
}


\begin{document}


    \section[short title]{Long Title}[Really long description \\ multiple lines, often with graphics \includegraphics[width=.5\textwidth]{example-image-a}]

    \begin{frame}
    \sectionpage
    \end{frame}


%   \section*{Foo}
%   \begin{frame}
%   \sectionpage
%   \end{frame}

\end{document}

제가 시도한 것은 \sectionpage모든 섹션의 시작 부분에 를 두는 것입니다. 그러나 \sectiondesc이 페이지에는 비어 있습니다.

\sectiondesc시작 슬라이드에서 인쇄하려면 어떻게 해야 합니까 ?

답변1

코드 \AtBeginSection는 나머지 부분 \section, 즉 실제 섹션 코드( \beameroldsection)가 호출되기 전에 '실행'됩니다. 연결된 질문의 답변 정의에서 는 로 \sectiondesc지정 \gdef되므로 {}처음에는 항상 비어 있습니다.

\gdef\sectiondesc{#4}작동합니다. 설명이 없으면(즉, 네 번째 인수가 비어 있는 경우) 매크로 \sectiondesc는 아무 것도 확장되지 않습니다.

\documentclass{beamer}
\usepackage{graphicx}

\usepackage{xparse}

\let\beameroldsection\section% Store the old definition first

\def\sectiondesc{}
\RenewDocumentCommand{\section}{sO{#3}m O{}}{%
  \gdef\sectiondesc{#4}% Store the 4th argument beforehand
    \IfBooleanTF{#1}{% Grab the starred version, i.e. \section*
        \beameroldsection*{#3}%
    }{%
        \beameroldsection[#2]{#3}%
     }%
}

\setbeamertemplate{section page}
{
    \begin{centering}
        \begin{beamercolorbox}[sep=12pt,center]{part title}
            \usebeamerfont{section title}{\insertsection}\par \insertsectionhead
        \end{beamercolorbox}
    \end{centering}

    \begin{center}
      \sectiondesc
    \end{center}

}


\AtBeginSection[]{
    \begin{frame}{Overview}
        \hfill
        \begin{minipage}{.45\textwidth}
            \sectionpage%%% Tried both `\sectionpage` and `\sectiondesc`
        \end{minipage}
    \end{frame}
}


\begin{document}


\section[short title]{Long Title}[Really long description \\ multiple lines, often with graphics \includegraphics[width=.5\textwidth]{example-image-a}]

\begin{frame}
  \sectionpage
\end{frame}


\end{document}

여기에 이미지 설명을 입력하세요

관련 정보