使用 Beamer 在 LaTeX 演示文稿的标题页中显示 MS VBA 代码

使用 Beamer 在 LaTeX 演示文稿的标题页中显示 MS VBA 代码

下面您可以找到一个可以运行的 MVE。我的问题是如何将可视化的 MS VBA 代码与 minted 包集成到 中\defbeamertemplate*{title page}。我知道如何在标题页之外执行此操作,但最好将其包含在标题页的定义中。有什么想法吗?

例如:

标题应显示:

Function InspiredLearningSession (YouKnowMSVBA As Boolean) As String
  
  Dim YouCanReadThis As Boolean
  YouCanReadThis = False
  
      ' Repeat until condition is met
      Do While YouCanReadThis
      
        If You YouCanReadThis = True Then
        
            MsgBox "Congratulations on understanding some basic MS VBA syntax!"
            Exit Do
        
        End If
      
      Loop

End Function

我知道 MS VBA 代码实际上还不正确。所以不必担心。

\documentclass{beamer}
\usepackage{tikz}
\usepackage[fixed]{fontawesome5}
\usepackage{listings}
\usepackage{minted}
\usemintedstyle{vbnet}

% Define colour properties
\definecolor{ZurichBlue}{RGB}{33,103,174}
\definecolor{Black}{RGB}{160,0,0}

% Set theme colour properties
% fg = foreground colour, bg = background colour
\setbeamercolor{palette primary}{fg=ZurichBlue,bg=white}
\setbeamercolor{palette secondary}{fg=ZurichBlue,bg=white}
\setbeamercolor{structure}{fg=ZurichBlue,bg=white}
\setbeamercolor{title in head/foot}{fg=black,bg=white}
\setbeamercolor{date in head/foot}{fg=gray,bg=white}

% Set footnote properties
% dp = depth
\defbeamertemplate*{footline}{ZurichLaTeXTheme}{%
  \leavevmode%
  \hbox{\begin{beamercolorbox}[wd=.6\paperwidth,ht=3.5ex,dp=3.5ex,leftskip=3.5ex,rightskip=3.5ex]{title in head/foot}%
    \makebox[3.5ex][l]{{\usebeamerfont{title in head/foot}\textcolor{ZurichBlue}{\insertframenumber}}}%
    {\usebeamercolor{title in head/foot}\insertshorttitle}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.375\paperwidth,ht=2.5ex,dp=3.5ex,leftskip=3.5ex,rightskip=3.5ex,right]{date in head/foot}%
    \usebeamerfont{date in head/foot}\insertshortdate%
  \end{beamercolorbox}}%
  \vskip0pt%
}

% Set title page properties
\defbeamertemplate*{title page}{ZurichLaTeXTheme}[1][]
{%
  \begin{tikzpicture}[remember picture,overlay]
  \filldraw[ZurichBlue]
    (current page.north west) --
    ([yshift=-2cm]current page.north west) --
    ([xshift=-2cm,yshift=-2cm]current page.north east) {[rounded corners=15pt]--
    ([xshift=-2cm,yshift=3cm]current page.south east)} --
    ([yshift=3cm]current page.south west) --
    (current page.south west) --
    (current page.south east) --
    (current page.north east) -- cycle
    ;
  \node[text=ZurichBlue,anchor=south west,font=\sffamily\LARGE,text width=.55\paperwidth] 
  at ([xshift=15pt,yshift=-1cm]current page.west)
  (title)
  {\raggedright\inserttitle};   
  \node[text=white,font=\large\sffamily,anchor=south west]
  at ([xshift=15pt,yshift=0.5cm]current page.south west)
  (date)
  {\insertdate};
  \node[text=white,font=\large\sffamily,anchor=south west]
  at ([yshift=5pt]date.north west)
  (author)
  {\insertauthor};
  \end{tikzpicture}%
}

% remove navigation symbols
\setbeamertemplate{navigation symbols}{}

% definition of the symbols used in itemize
\newcommand\mysymbol{%
  \begin{tikzpicture}[xscale=0.85]
  \fill[ZurichBlue]
  (-1ex,1ex) to[out=-60,in=240,looseness=1.2]
  (1ex,1ex) to[out=240,in=120,looseness=1.2]
  (1ex,-1ex) to[out=120,in=60,looseness=1.2]
  (-1ex,-1ex) to[out=60,in=-60,looseness=1.2]
  cycle;  
  \end{tikzpicture}%
  }

% definition of the itemize templates
\defbeamertemplate*{itemize item}{mysymbol}{\small\raise0.5pt\hbox{\mysymbol}}
\defbeamertemplate*{itemize subitem}{mysymbol}{\footnotesize\raise0.5pt\hbox{\mysymbol}}
\defbeamertemplate*{itemize subsubitem}{mysymbol}{\footnotesize\raise0.5pt\hbox{\mysymbol}}

\title[MS VBA]{Microsoft Visual Basic for Applications (MS VBA)}
\author{Alexander Kallay}
\date{February 10, 2022}

\begin{document}

\begin{frame}[plain]
  \titlepage
\end{frame}

\begin{frame}
\frametitle{A test frame title}
\framesubtitle{A test frame subtitle}
\begin{itemize}
  \item This is some item.
  \item Another item.
  \begin{itemize}
    \item A subitem.
    \item Another subitem.
  \end{itemize}
  \item Yet another item.
\end{itemize}

\end{frame}

\end{document}

相关内容