
다음에서samcarter_is_at_topanswers.xyz의 답변입니다.질문과 관련하여 section title in \frametitle beamer
제공된 답변을 사용했습니다.
\makeatletter
\patchcmd\beamer@@tmpl@frametitle{\insertframetitle}{\insertsection-\insertframetitle}{}{}
\makeatother
내 주요 beamer
문서에. 내 하위 섹션이 더 관련성이 높 \insertsection
도록 수정했습니다 . \insertsubsection
그러나 이것을 사용하면 frame
이 비어 있는지 여부에 관계없이 \insertsubsection
(예: TOC 페이지의 경우) 모든 my 에 영향을 미칠 것으로 예상됩니다. 내 기본 문서는 현재 다음과 같습니다( \insertsection\ - \insertframetitle
대신 하이픈 주위의 공백을 확인했습니다).
\patchcmd
하위 섹션이 있을 때(또는 작동하는 방법/부서를 통해) 의 효과를 어떻게 테스트하거나 포함할 수 있습니까 ? 또한 다음을 사용하여 섹션당 목차를 포함합니다.
\AtBeginSection[]
{
\ifnum \value{framenumber}>1
\begin{frame}<beamer>
\frametitle{Outline}
\tableofcontents[currentsection]
\end{frame}
\else
\fi
}
그리고 마지막에는 참고자료와 아마도 용어집이 있을 것입니다. 내가 볼 수 있는 한 가지 가능한 해결책은 \beamer@@tmpl@frametitle
제목에 하위 섹션이 있는 것을 원하거나 원하지 않는 슬라이드 전후에 명령을 다시 패치하는 것입니다. 그러나 아마도 내 지식을 넘어서는 더 나은 방법이 있을 수 있습니다. 다른 사람들이 도달하므로 질문이 있습니다.나는 중복된 질문을 저장하기 위해 이것을 시도했지만 다음과 같이 실패했습니다.
사용:
\newcommand\showSubsec{
\makeatletter
\patchcmd\beamer@@tmpl@frametitle{\insertframetitle}{\insertsubsection\ - \insertframetitle}{}{}
\makeatother
}
\newcommand\hideSubsec{
\makeatletter
\patchcmd\beamer@@tmpl@frametitle{\insertsubsection\ - \insertframetitle}{\insertframetitle}{}{}
\makeatother
}
MWE:
\documentclass{beamer}
\usepackage{xpatch}
\makeatletter
\patchcmd\beamer@@tmpl@frametitle{\insertframetitle}{\insertsubsection\ - \insertframetitle}{}{}
\makeatother
% For TOC at each section
\AtBeginSection[]
{
\ifnum \value{framenumber}>1
\begin{frame}<beamer>
\frametitle{Outline}
\tableofcontents[currentsection]
\end{frame}
\else
\fi
}
\begin{document}
\begin{frame}
\frametitle{Outline}
\tableofcontents
\end{frame}
\begin{frame}
\frametitle{Introduction}
Introduction
\end{frame}
\section{First section}
\subsection{First subsection}
\begin{frame}
\frametitle{First slide Title}
Text
\end{frame}
\subsection{Second subsection}
\begin{frame}
\frametitle{Second slide Title}
\small
Text
\end{frame}
\section{Conclusions and Future Work}
\subsection{Conclusions}
\begin{frame}
\frametitle{Conclusions}
\centering
Text
\end{frame}
\subsection{Future Work}
\begin{frame}
\frametitle{Future Work}
\centering
Text
\end{frame}
\section*{Back matter}
\subsection*{References}
\begin{frame}
\frametitle{References}
References
\end{frame}
\end{document}
MWE 출력:
이상적으로는 관련 프레임에 하위 섹션 제목을 원하지만 목차/참조/소개 슬라이드 등이 아닌 하위 섹션이 있는 경우에만 필요합니다. 이것이 가능하지 않으면 하위 섹션이 없는 상태로 되돌리겠지만 \frametitle
가능하다면 좋을 것입니다. 제발.
답변1
예를 들어 하위 섹션 카운터가 0보다 큰지 테스트할 수 있습니다.
\documentclass{beamer}
\usepackage{xpatch}
\makeatletter
\patchcmd\beamer@@tmpl@frametitle{\insertframetitle}{%
\ifnum\thesubsection>0
\insertsubsection\ -
\fi
\insertframetitle
}{}{}
\makeatother
% For TOC at each section
\AtBeginSection[]
{
\ifnum \value{framenumber}>1
\begin{frame}<beamer>
\frametitle{Outline}
\tableofcontents[currentsection]
\end{frame}
\else
\fi
}
\begin{document}
\begin{frame}
\frametitle{Outline}
\tableofcontents
\end{frame}
\begin{frame}
\frametitle{Introduction}
Introduction
\end{frame}
\section{First section}
\subsection{First subsection}
\begin{frame}
\frametitle{First slide Title}
Text
\end{frame}
\subsection{Second subsection}
\begin{frame}
\frametitle{Second slide Title}
\small
Text
\end{frame}
\section{Conclusions and Future Work}
\subsection{Conclusions}
\begin{frame}
\frametitle{Conclusions}
\centering
Text
\end{frame}
\subsection{Future Work}
\begin{frame}
\frametitle{Future Work}
\centering
Text
\end{frame}
\section*{Back matter}
\subsection*{References}
\begin{frame}
\frametitle{References}
References
\end{frame}
\end{document}