如何使用以下模板修改字体颜色和使用独立背景?

如何使用以下模板修改字体颜色和使用独立背景?

你好,我正在使用 Sharelatex 在线使用 latex,它附带了几个模板来创建演示文稿,我决定使用一个名为:Radboud University Beamer 的模板,下面我放了主要两个部分的完整代码,example.tex 和 ru.sty。

我想改变字体的颜色,因此分析代码时我在 ru.sty 中发现了以下部分,

\AtBeginDocument{
  \pgfdeclareverticalshading{beamer@topshade}{\paperwidth}{%
    color(0pt)=(bg);
    color(4pt)=(black!50!bg)}

我相信这是在定义字体的颜色,但是这对我来说有点高级,我无法改变字体的颜色,我想知道如何改变它,我想知道是否有可能或者字母的颜色是否属于主题,

第二个问题与 ru.sty 中以下部分定义的背景有关:

% Background
\pgfdeclareimage[width=\paperwidth,height=\paperheight]{bg}{ru_background}
\setbeamertemplate{background}{\pgfuseimage{bg}}

在此部分,您可以选择一张图片,问题是,如果我选择某张图片,则所有页面都会具有相同的背景,我希望拥有独立的背景,非常感谢支持,欢迎提出所有建议以了解这个模板是如何工作的,下面我把构成模板的两个主要部分的完整代码放出来。

第一部分名为:example.tex

\documentclass{beamer}

\usepackage[british]{babel}
\usepackage{graphicx,hyperref,ru,url}

% The title of the presentation:
%  - first a short version which is visible at the bottom of each slide;
%  - second the full title shown on the title slide;
\title[RU style for Beamer]{
  Radboud University style for Beamer \LaTeX}

% Optional: a subtitle to be dispalyed on the title slide
\subtitle{Show where you're from}

% The author(s) of the presentation:
%  - again first a short version to be displayed at the bottom;
%  - next the full list of authors, which may include contact information;
\author[Pim Vullers MSc]{
  Pim Vullers MSc \\\medskip
  {\small \url{[email protected]}} \\ 
  {\small \url{http://www.cs.ru.nl/~pim/}}}

% The institute:
%  - to start the name of the university as displayed on the top of each slide
%    this can be adjusted such that you can also create a Dutch version
%  - next the institute information as displayed on the title slide
\institute[Radboud University Nijmegen]{
  Institute for Computing and Information Sciences -- Digital Security \\
  Radboud University Nijmegen}

% Add a date and possibly the name of the event to the slides
%  - again first a short version to be shown at the bottom of each slide
%  - second the full date and event name for the title slide
\date[slides Example 2010]{
  the 1st example presentation 2010 \\
  7th October 2010}

\begin{document}

\begin{frame}
  \titlepage
\end{frame}

\begin{frame}
  \frametitle{Outline}

  \tableofcontents
\end{frame}

% Section titles are shown in at the top of the slides with the current section 
% highlighted. Note that the number of sections determines the size of the top 
% bar, and hence the university name and logo. If you do not add any sections 
% they will not be visible.
\section{Introduction}

\begin{frame}
  \frametitle{Introduction}

  \begin{itemize}
    \item This is just a short example
    \item The comments in the \LaTeX\ file are most important
    \item This is just the result after running pdflatex
    \item The style is based on the webpage \url{http://www.ru.nl/}
  \end{itemize}
\end{frame}

\section{Background information}

\begin{frame}
  \frametitle{Background information}

  \begin{block}{Slides with \LaTeX}
    Beamer offers a lot of functions to create nice slides using \LaTeX.
  \end{block}

  \begin{block}{The basis}
    This style uses the following default styles:
    \begin{itemize}
      \item split
      \item whale
      \item rounded
      \item orchid
    \end{itemize}
  \end{block}
\end{frame}

\section{The important things}

\begin{frame}
  \frametitle{The important things}

  \begin{enumerate}
    \item This just shows the effect of the style
    \item It is not a Beamer tutorial
    \item Read the Beamer manual for more help
    \item Contact me only concerning the style file
  \end{enumerate}
\end{frame}

\section{Analysis of the work}

\begin{frame}
  \frametitle{Analysis of the work}

  This style file gives your slides some nice Radboud branding.
  When you know how to work with the Beamer package it is easy to use.
  Just add:\\ ~~~$\backslash$usepackage$\{$ru$\}$ \\ at the top of your file.
\end{frame}

\section{Conclusion}

\begin{frame}
  \frametitle{Conclusion}

  \begin{itemize}
    \item Easy to use
    \item Good results
  \end{itemize}
\end{frame}

\end{document}

第二部分叫 ru.sty

% Copyright 2009 by Pim Vullers
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/licenses/LICENSE for more details.



%%%
%%% Inherit definitions from existing themes (DO NOT MODIFY THESE)
%%%

% Layout scheme for outer elements: split header and footer
\useoutertheme{split}

% Color scheme for outer elements: use background colors
\usecolortheme{whale}

% Layout scheme for inner elements: rounded elements
\useinnertheme{rounded} 

% Color scheme for inner elements: use foreground colors
\usecolortheme{orchid}


%%%
%%% Tweak definitions of inner theme to match personal preferences (MODIFY THESE)
%%%

% Itemize items: default (triangle), circle, square, ball
\setbeamertemplate{itemize items}[circle]

% Enumerate items: default, circle, square, ball
\setbeamertemplate{enumerate items}[circle]

% Outline: default, sections numbered, subsections numbered, circle, square, ball, ball unnumbered
\setbeamertemplate{sections/subsections in toc}[default]

% General blocks: 
\setbeamertemplate{blocks}[rounded]

% Title page:
\setbeamertemplate{title page}[default][colsep=-4bp,rounded=true]

% Part page:
\setbeamertemplate{part page}[default][colsep=-4bp,rounded=true]

% Navigation symbols:
\setbeamertemplate{navigation symbols}{}


%%%
%%% Tweak definitions of outer theme to match Radboud (website) style
%%%

% Background
\pgfdeclareimage[width=\paperwidth,height=\paperheight]{bg}{ru_background}
\setbeamertemplate{background}{\pgfuseimage{bg}}

% Colors
\usecolortheme[RGB={190,49,26}]{structure}

\setbeamercolor{frametitle}{parent=subsection in head/foot}
\setbeamercolor{frametitle right}{parent=section in head/foot}


\pgfdeclarehorizontalshading[frametitle.bg,frametitle right.bg]{beamer@frametitleshade}{\paperheight}{%
  color(0pt)=(frametitle.bg);
  color(\paperwidth)=(frametitle right.bg)}

\AtBeginDocument{
  \pgfdeclareverticalshading{beamer@topshade}{\paperwidth}{%
    color(0pt)=(bg);
    color(4pt)=(black!50!bg)}
}

% Footline: AUTHOR | TITLE | DATE FRAMENUMBER

\defbeamertemplate*{footline}{ru theme}{%
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.25\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
    \usebeamerfont{author in head/foot}\insertshortauthor
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.25\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
    \usebeamerfont{author in head/foot}\insertshortdate
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.416667\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
    \usebeamerfont{title in head/foot}\insertshorttitle
  \end{beamercolorbox}%
   \begin{beamercolorbox}[wd=0.083333\paperwidth,ht=2.25ex,dp=1ex,right]{title in head/foot}%
    \insertframenumber{} / \inserttotalframenumber\hspace*{2ex} 
  \end{beamercolorbox}}%
  \vskip0pt%
}

\defbeamertemplate*{headline}{ru theme}{%
  \leavevmode%
  \@tempdimb=2.4375ex%
    \multiply\@tempdimb by\beamer@sectionmax%
  \pgfdeclareimage[height=.9\@tempdimb]{logo}{ru_logo}%
  \logo{\pgfuseimage{logo}}%
  \ifdim\@tempdimb>0pt%
    \advance\@tempdimb by 1.125ex%
    \begin{beamercolorbox}[wd=.5\paperwidth,ht=\@tempdimb]{section in head/foot}%
      \vbox to\@tempdimb{\vfil\insertsectionnavigation{.5\paperwidth}\vfil}%
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.4\paperwidth,ht=\@tempdimb,right]{subsection in head/foot}%
      \vbox to\@tempdimb{\vfil\vfil\textbf{\footnotesize\insertshortinstitute~~}\vfil}%
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.1\paperwidth,ht=\@tempdimb,left]{subsection in head/foot}%
      \vbox to\@tempdimb{\vfil\insertlogo\vfil\vfil}%
    \end{beamercolorbox}%
  \fi%
}

\defbeamertemplate*{frametitle}{ru theme}{%
  \nointerlineskip%
  %\vskip-2pt%
  \hbox{\leavevmode
    \advance\beamer@leftmargin by -12bp%
    \advance\beamer@rightmargin by -12bp%
    \beamer@tempdim=\textwidth%
    \advance\beamer@tempdim by \beamer@leftmargin%
    \advance\beamer@tempdim by \beamer@rightmargin%
    \hskip-\Gm@lmargin\hbox{%
      \setbox\beamer@tempbox=\hbox{\begin{minipage}[b]{\paperwidth}%
          \vbox{}\vskip-.75ex%
          \leftskip0.3cm%
          \rightskip0.3cm plus1fil\leavevmode
          \insertframetitle%
          \ifx\insertframesubtitle\@empty%
            \strut\par%
          \else
            \par{\usebeamerfont*{framesubtitle}{\usebeamercolor[fg]{framesubtitle}\insertframesubtitle}\strut\par}%
          \fi%
          \nointerlineskip
          \vbox{}%
          \end{minipage}}%
      \beamer@tempdim=\ht\beamer@tempbox%
      \advance\beamer@tempdim by 2pt%
      \begin{pgfpicture}{0.1mm}{0pt}{1.01\paperwidth}{\beamer@tempdim}
        \usebeamercolor{frametitle right}
        \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\beamer@tempdim}}
        \pgfusepath{clip}
        \pgftext[left,base]{\pgfuseshading{beamer@frametitleshade}}
      \end{pgfpicture}
      \hskip-\paperwidth%
      \box\beamer@tempbox%
    }%
    \hskip-\Gm@rmargin%
  }%
%  \nointerlineskip
%    \vskip-0.2pt
%    \hbox to\textwidth{\hskip-\Gm@lmargin\pgfuseshading{beamer@topshade}\hskip-\Gm@rmargin}
%    \vskip-2pt
}

答案1

  • 要更改文本颜色,您只需使用

    \setbeamercolor{normal text}{fg=red}
    
  • 要获得不同的背景图像,您只需\pgfdeclareimage在演示过程中覆盖即可。


\documentclass{beamer}

\setbeamercolor{normal text}{fg=red}

\pgfdeclareimage[width=\paperwidth,height=\paperheight]{bg}{example-image}
\setbeamertemplate{background}{\pgfuseimage{bg}}

\begin{document}

\begin{frame}
text
\end{frame}

\pgfdeclareimage[width=\paperwidth,height=\paperheight]{bg}{example-image-b}

\begin{frame}
another image
\end{frame}


\end{document}

在此处输入图片描述

相关内容