我正在尝试复制 Impress 演示文稿的风格,该演示文稿的标题页上有棕色底黄色标题。我创建了一个.sty
文件,打开时显示以下内容:
\mode<presentation>
\ProcessOptionsBeamer
% ---------------------------------
% color definitions
\usepackage{color}
\definecolor{new_yellow}{RGB}{251,190,94}
% ---------------------------------
% set colors of elements
% set the title color
\setbeamercolor{title}{fg=new_yellow}
在.tex
文档中,事情很正常:
\documentclass[aspectratio=169]{beamer}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{courier}
\usepackage[T1]{fontenc}
% -----------
% Set new style
\usetheme{new}
% -- Section title pages
\AtBeginSection[]{
\begin{frame}
\vfill
\centering
\begin{block}{}
\begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
\usebeamerfont{title}\insertsectionhead\par%
\end{beamercolorbox}
\end{block}
\vfill
\end{frame}
}
%----------------
% Title and authors
\title{My presentation}
\subtitle{Coded with \LaTeX}
\author[Jane Smith]{Jane Smith}
\institute[The Institute]{The Institute}
\date{\today}
%====================================================================
\begin{document}
%----------------
% Title frame
% load backgound for title
\setbeamertemplate{background}{
\includegraphics[width=\paperwidth,height=\paperheight]
{background_title.png}}
{ \setbeamertemplate{footline}{} % no footer on title
\begin{frame}
\titlepage
\end{frame}
}
但最终的结果是这样的:
我如何将定义的颜色应用于new_yellow
标题页标题?
更新:关于编译器,我使用的pdflatex
是 TeX Live 2015:
$ pdflatex
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex)
restricted \write18 enabled.
**
答案1
事实证明,插入标题时必须明确应用文本颜色。如下所示:\textcolor{new_yellow}{\inserttitle}}
。标题页中的其他元素(如副标题或作者姓名)也是如此。以下是文件中标题页的完整示例.sty
:
% ---------------------------------
% title page
\defbeamertemplate*{title page}{customized}[1][]
{
\vspace{0.05\paperheight}
\usebeamerfont{title}\textbf{\textcolor{new_yellow}{\inserttitle}}
\par
\vspace{0.02\paperheight}
\usebeamerfont{subtitle}\textcolor{new_yellow}{\insertsubtitle}
\par
\vspace{0.05\paperheight}
\normalsize{\textcolor{new_yellow}{\insertauthor}}
\par
\tiny{\textcolor{new_yellow}{\insertdate}}
}