【问题标题】:Vim beamer: dynamic frame titleVim beamer:动态框架标题
【发布时间】:2016-03-05 15:12:16
【问题描述】:

我正在尝试在 Latex Beamer 中创建一个新命令,以根据部分和子部分自动添加框架标题和副标题。一般来说,我的命令如下所示:

\newcommand {\myframe}[1] {
    \begin{frame}
    if in a section {
        \frametitle{\secname}
    }
    if in a subsection {
        \framesubtitle{\subsecname}
    }
    #1
    \end{frame}
}

如何检测框架是在一个部分还是小部分?

【问题讨论】:

    标签: latex beamer


    【解决方案1】:

    您可以向\section\subsection 命令添加条件,您可以使用它们在\myframe 宏中进行测试:

    \documentclass{beamer}
    
    \let\Tiny\tiny% http://tex.stackexchange.com/a/94159/5764
    
    \newif\ifinsection
    \newif\ifinsubsection
    
    \let\oldsection\section
    \renewcommand{\section}{%
      \global\insectiontrue% In section
      \global\insubsectionfalse% Not in subsection
      \oldsection}
    \let\oldsubsection\subsection
    \renewcommand{\subsection}{%
      %\global\insectionfalse% No in section
      \global\insubsectiontrue% In subsection
      \oldsubsection}
    
    \newcommand {\myframe}[1] {%
      \begin{frame}
      \ifinsection\frametitle{\secname}\fi
      \ifinsubsection\framesubtitle{\subsecname}\fi
      #1
      \end{frame}
    }
    
    \begin{document}
    
    \begin{frame}
      \frametitle{A frame}
    \end{frame}
    
    \section{A section}
    
    \myframe{Some content}
    
    \subsection{A subsection}
    
    \myframe{Some content}
    
    \end{document}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-02-04
      • 2020-01-21
      • 2012-11-05
      • 2014-06-10
      • 1970-01-01
      • 1970-01-01
      • 2015-10-17
      相关资源
      最近更新 更多