这是我的第一篇帖子,如果我没有遵守所有规则,请原谅。
我正在尝试使用 beamer 为我的公司制作一个 LaTex 演示模板。除了标题页,我几乎已经拥有了我想要的一切。我需要一个仅在标题页中带有渐变的侧边栏,因为这是我们公司的标准标题页。我尝试在 \defbeamertemplate 中为标题页使用“\useoutertheme{sidebar}”,但它不起作用。还尝试使用 \useoutertheme 包装 \frame 定义,但也没有成功。由于对 beamer 还很陌生,我不知道还能做什么。
这是我的 MWE:
\documentclass{beamer}
\definecolor{dark}{rgb}{0.05, 0.3, 0.5}
\definecolor{light}{rgb}{0.1, 0.5, 0.7}
% Imports
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[margin=1in]{geometry}
\usepackage{pythontex}
\usepackage[svgnames]{xcolor}
\renewcommand*{\thefootnote}{\fnsymbol{footnote}}
% Theme definitions
\DeclareOptionBeamer{compress}{\beamer@compresstrue}
\ProcessOptionsBeamer
\mode<presentation>
\useoutertheme[footline=title]{miniframes}
\useinnertheme{circles}
\setbeamertemplate{blocks}[rounded][shadow=true]
% Colors
\setbeamercolor{palette primary}{bg=dark, fg=black}
\setbeamercolor{palette secondary}{bg=light, fg=black}
\setbeamercolor{palette tertiary}{bg=dark, fg=white}
\setbeamercolor{palette quaternary}{bg=dark, fg=light}
\setbeamercolor{structure}{fg=black}
\setbeamercolor{titlelike}{parent=structure}
\setbeamercolor{title}{bg=light}
\setbeamercolor{item}{fg=light}
\setbeamercolor{itemize item}{fg=black}
\setbeamercolor{itemize subitem}{fg=black}
\setbeamercolor{institute in head/foot}{fg=white}
% Title page
\defbeamertemplate*{title page}{customized}[1][]
{
\begin{center}
\usebeamercolor[fg]{titlegraphic}\inserttitlegraphic\par
\usebeamercolor[bg]{palette primary}www.url.com\par
\vspace{0.15\paperheight}
\usebeamerfont{title}\inserttitle\par
\vspace{0.6\paperheight}
\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle
\end{center}
}
\mode
<all>
\title{Title}
\titlegraphic{Title Graphic}
\logo{Logo}
\date{}
% Begin document
\begin{document}
% Title page and contents
\frame[plain]{\titlepage}
\frame[plain]{\frametitle{Contents}\tableofcontents}
% Sections
\section{Intro}
\frame{
\frametitle{\insertsectionhead}
}
\section{Second}
\frame{
\frametitle{\insertsectionhead}
}
\end{document}
以下是我想要实现的目标:
- PS #1:我从其他模板复制了一些代码,所以可能有一些我不知道的无用的代码行
- PS #2:我不介意渐变与示例图像不完全相等(示例渐变从左侧的某种偏移/边距开始),但这对我来说是一个奖励
答案1
快速而肮脏:
\documentclass[xcolor={svgnames}]{beamer}
\definecolor{dark}{rgb}{0.05, 0.3, 0.5}
\definecolor{light}{rgb}{0.1, 0.5, 0.7}
% Imports
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
%\usepackage[margin=1in]{geometry}
\usepackage{pythontex}
%\usepackage[svgnames]{xcolor}
\renewcommand*{\thefootnote}{\fnsymbol{footnote}}
% Theme definitions
\DeclareOptionBeamer{compress}{\beamer@compresstrue}
\ProcessOptionsBeamer
\mode<presentation>
\useoutertheme[footline=title]{miniframes}
\useinnertheme{circles}
\setbeamertemplate{blocks}[rounded][shadow=true]
% Colors
\setbeamercolor{palette primary}{bg=dark, fg=black}
\setbeamercolor{palette secondary}{bg=light, fg=black}
\setbeamercolor{palette tertiary}{bg=dark, fg=white}
\setbeamercolor{palette quaternary}{bg=dark, fg=light}
\setbeamercolor{structure}{fg=black}
\setbeamercolor{titlelike}{parent=structure}
\setbeamercolor{title}{bg=light}
\setbeamercolor{item}{fg=light}
\setbeamercolor{itemize item}{fg=black}
\setbeamercolor{itemize subitem}{fg=black}
\setbeamercolor{institute in head/foot}{fg=white}
\makeatletter
\pgfdeclarehorizontalshading{beamer@titleshade}{\paperheight}{%
color(0pt)=(dark);
color(.2\paperwidth)=(white!80!dark);
color(\paperwidth)=(white)
}
\makeatother
% Title page
\defbeamertemplate*{title page}{customized}[1][]
{
\begin{pgfpicture}{30pt}{0pt}{\paperwidth}{\paperheight}
\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\paperheight}}
\pgfusepath{clip}
\pgftext[left,base]{\pgfuseshading{beamer@titleshade}}
\end{pgfpicture}
\vspace*{-.8\paperheight}
\hspace*{.1\paperwidth}
\begin{minipage}{.8\paperwidth}
\centering
\usebeamercolor[fg]{titlegraphic}\inserttitlegraphic\par
\usebeamercolor[bg]{palette primary}www.url.com\par
\vspace{0.15\paperheight}
\usebeamerfont{title}\inserttitle\par
\vspace{0.6\paperheight}
\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle
\end{minipage}
}
\mode
<all>
\title{Title}
\titlegraphic{Title Graphic}
\logo{Logo}
\date{}
% Begin document
\begin{document}
% Title page and contents
\frame[plain]{\titlepage}
\frame[plain]{\frametitle{Contents}\tableofcontents}
% Sections
\section{Intro}
\frame{
\frametitle{\insertsectionhead}
}
\section{Second}
\frame{
\frametitle{\insertsectionhead}
}
\end{document}
请注意,您不能使用\usepackage[margin=1in]{geometry}
并且\usepackage[svgnames]{xcolor}
——beamer 已经加载这些包,因此由于选项冲突,您的代码无法编译。