Beamer *.sty 文件与 TeXmaker 和 Windows 7 存在错误吗?

Beamer *.sty 文件与 TeXmaker 和 Windows 7 存在错误吗?

我正在写一个演示文稿,并使用我的 TeX 发行版(Windows 7 上的 TeXLive 2013)的默认主题之一进行测试,但在提交最终作品之前,我想应用我的beamerthemeMyTheme.sty从此处创建和下载的Beamer 网站。然而,当我编译main.tex在 TeXMaker - QuickBuild 中编译时,我收到错误!也许 TeXLive 无法识别.sty文件?我已将*.麦粒肿文件到C:\texlive\2013\texmf-dist\tex\latex\beamer\themes\theme所有其他“原生”主题所在的位置。下面您将找到主文本文件和样式文件。请帮我找出错误。

\documentclass[10pt]{beamer}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\usepackage{graphicx}

\title{My Presentation}
\author[J. Doe]{Jane Doe \\ \texttt{[email protected]}}
\date[]{July 2015}
\institute[unika]{University of Know All}

\usetheme{MyTheme}
%\useoutertheme[right]{sidebar}
%\setbeamercovered{dynamic}

\graphicspath{{pictures/}}

\begin{document}

\section{Introduction}
\begin{frame}
\maketitle
\end{frame}

\end{document}

现在beamerthemeMyTheme.sty文件:

\ProvidesPackageRCS $Header: /cvsroot/latex-beamer/latex-beamer/themes/theme/monTheme.sty,v 1.0 23/05/2015 20:23:32 G.FALLOURD-M.LEBRETON Exp $
\mode<presentation>
\definecolor{sectionColor}{RGB}{0,51,102}
\definecolor{subsectionColor}{RGB}{153,0,0}
\definecolor{sectionTextColor}{RGB}{255,255,255}
\definecolor{subsectionTextColor}{RGB}{255,255,255}
\definecolor{leftFootlineColor}{RGB}{102,0,0}
\definecolor{middleFootlineColor}{RGB}{51,0,0}
\definecolor{rightFootlineColor}{RGB}{102,0,0}
\definecolor{authorColor}{RGB}{255,255,255}
\definecolor{footlineTitleColor}{RGB}{255,255,255}
\definecolor{instituteColor}{RGB}{0,0,0}
\definecolor{dateColor}{RGB}{0,0,0}
\definecolor{pageColor}{RGB}{255,255,255}
\definecolor{titleColor}{RGB}{102,0,0}
\definecolor{titleTextColor}{RGB}{255,255,255}
\definecolor{bodyColor}{RGB}{255,255,255}
\definecolor{normalTextColor}{RGB}{0,0,0}
\definecolor{exampleTextColor}{RGB}{51,153,51}
\definecolor{alertTextColor}{RGB}{204,51,51}
\definecolor{chipColor}{RGB}{0,0,102}
\definecolor{chipTextColor}{RGB}{255,255,255}
\definecolor{normalBlockColor}{RGB}{102,153,255}
\definecolor{normalTitleBlockColor}{RGB}{0,0,102}
\definecolor{normalBlockTextColor}{RGB}{255,255,255}
\definecolor{normalBlockTitleTextColor}{RGB}{255,255,255}
\definecolor{exampleBlockColor}{RGB}{0,204,0}
\definecolor{exampleTitleBlockColor}{RGB}{0,153,0}
\definecolor{exampleBlockTextColor}{RGB}{255,255,255}
\definecolor{exampleBlockTitleTextColor}{RGB}{255,255,255}
\definecolor{alertBlockColor}{RGB}{255,153,153}
\definecolor{alertTitleBlockColor}{RGB}{204,51,51}
\definecolor{alertBlockTextColor}{RGB}{255,255,255}
\definecolor{alertBlockTitleTextColor}{RGB}{255,255,255}
\setbeamercolor{section in head/foot}{bg=sectionColor, fg=sectionTextColor}
\setbeamercolor{subsection in head/foot}{bg=subsectionColor, fg=subsectionTextColor}
\setbeamercolor*{block title}{fg=normalBlockTitleTextColor,bg=normalTitleBlockColor}
\setbeamercolor*{block body}{fg=normalBlockTextColor,bg=normalBlockColor}
\setbeamercolor*{block title alerted}{fg=alertBlockTitleTextColor,bg=alertTitleBlockColor}
\setbeamercolor*{block body alerted}{fg=alertBlockTextColor,bg=alertBlockColor}
\setbeamercolor*{block title example}{fg=exampleBlockTitleTextColor,bg=exampleTitleBlockColor}
\setbeamercolor*{block body example}{fg=exampleBlockTextColor,bg=exampleBlockColor}
\setbeamerfont{block title}{size={}}
\setbeamercolor{titlelike}{fg=titleTextColor,bg=titleColor}
\setbeamercolor*{normal text}{fg=normalTextColor,bg=bodyColor}
\setbeamercolor*{example text}{fg=exampleTextColor}
\setbeamercolor*{alerted text}{fg=alertTextColor}
\useinnertheme{default}
\setbeamercolor{item projected}{bg=chipColor,fg=chipTextColor}
\setbeamercolor*{sidebar}{bg=sectionColor, fg=sectionTextColor}
\setbeamercolor*{palette sidebar primary}{bg=subsectionColor,fg=subsectionTextColor}
\setbeamercolor*{palette sidebar secondary}{bg=sectionColor,fg=sectionTextColor}
\newdimen\beamer@sidebarwidth
\newdimen\beamer@headheight
\beamer@sidebarwidth=4.5\baselineskip
\beamer@headheight=2.5\baselineskip
\reset@font
\def\beamer@lefttext{left}
\DeclareOptionBeamer{hideothersubsections}[]{\beamer@nav@subsectionstyle{show/show/hide}}
\DeclareOptionBeamer{hideallsubsections}[]{\beamer@nav@subsectionstyle{hide}}
\DeclareOptionBeamer{width}{\beamer@sidebarwidth=#1}
\DeclareOptionBeamer{height}{\beamer@headheight=#1}
\DeclareOptionBeamer{left}{\def\beamer@sidebarside{left}}
\DeclareOptionBeamer{right}{\def\beamer@sidebarside{right}}
\ExecuteOptionsBeamer{right}
\ProcessOptionsBeamer
\ifdim\beamer@headheight>0pt
\defbeamertemplate*{frametitle}{sidebar theme}
{%
\nointerlineskip%
\vskip-\beamer@headheight%
\vbox to \beamer@headheight{%
\vfil
\leftskip=-\beamer@leftmargin%
\advance\leftskip by0.3cm%
\rightskip=-\beamer@rightmargin%
\advance\rightskip by0.3cm plus1fil%
{\usebeamercolor[fg]{frametitle}\usebeamerfont{frametitle}\insertframetitle\par}%
{\usebeamercolor[fg]{framesubtitle}\usebeamerfont{framesubtitle}\insertframesubtitle\par}%
\vbox{}%
\vskip-1em%
\vfil
}%
}
\defbeamertemplate*{headline}{sidebar theme}
{%
\begin{beamercolorbox}[wd=\paperwidth]{frametitle}
\ifx\beamer@sidebarside\beamer@lefttext%
\else%
\hfill%
\fi%
\ifdim\beamer@sidebarwidth>0pt%
\usebeamercolor[bg]{logo}%
\vrule width\beamer@sidebarwidth height \beamer@headheight%
\hskip-\beamer@sidebarwidth%
\hbox to \beamer@sidebarwidth{\hss\vbox to
\beamer@headheight{\vss\hbox{\color{fg}\insertlogo}\vss}\hss}%
\else%
\vrule width0pt height \beamer@headheight%
\fi%
\end{beamercolorbox}
}
\fi
\def\beamer@sidebarformat#1#2#3{%
\begin{beamercolorbox}[wd=\beamer@sidebarwidth,leftskip=#1,rightskip=1ex plus1fil,vmode]{#2}
\vbox{}%
#3\par%
\vbox{}%
\vskip-1.5ex%
\end{beamercolorbox}
}
\defbeamertemplate*{section in sidebar}{sidebar theme}
{%
\vbox{%
\vskip1ex%
\beamer@sidebarformat{3pt}{section in sidebar}{\insertsectionhead}%
}%
}
\defbeamertemplate*{section in sidebar shaded}{sidebar theme}
{%
\vbox{%
\vskip1ex%
\beamer@sidebarformat{3pt}{section in sidebar shaded}{\insertsectionhead}%
}%
}
\defbeamertemplate*{subsection in sidebar}{sidebar theme}
{%
\beamer@sidebarformat{5pt}{subsection in sidebar}{\insertsubsectionhead}%
}
\defbeamertemplate*{subsection in sidebar shaded}{sidebar theme}
{%
\beamer@sidebarformat{5pt}{subsection in sidebar shaded}{\insertsubsectionhead}%
}
\defbeamertemplate*{subsubsection in sidebar}{sidebar theme}
{%
\beamer@sidebarformat{7pt}{subsubsection in sidebar}{\insertsubsubsectionhead}%
}
\defbeamertemplate*{subsubsection in sidebar shaded}{sidebar theme}
{%
\beamer@sidebarformat{7pt}{subsubsection in sidebar shaded}{\insertsubsubsectionhead}%
}
\ifdim\beamer@sidebarwidth>0pt
\setbeamersize{sidebar width \beamer@sidebarside=\beamer@sidebarwidth}
\defbeamertemplate*{sidebar \beamer@sidebarside}{sidebar theme}
{
\beamer@tempdim=\beamer@sidebarwidth%
\advance\beamer@tempdim by -6pt%
{\usebeamerfont{title in sidebar}%
\vskip1.5em%
\hskip3pt%
\insertshorttitle[width=\beamer@tempdim,center,respectlinebreaks]\par%
\vskip1.25em%
}%
\insertverticalnavigation{\beamer@sidebarwidth}%
\vfill
\ifx\beamer@sidebarside\beamer@lefttext%
\else%
\llap{\usebeamertemplate***{navigation symbols}\hskip0.1cm}%
\vskip2pt%
\fi%
}%
\setbeamersize{text margin left=0.5cm,text margin right=0.5cm}
\fi
\setbeamercolor{author in head/foot}{bg=leftFootlineColor, fg=authorColor}
\setbeamercolor{title in head/foot}{bg=middleFootlineColor, fg=footlineTitleColor}
\setbeamercolor{institute in head/foot}{fg=instituteColor}
\setbeamercolor{date in head/foot}{bg=rightFootlineColor, fg=dateColor}
\defbeamertemplate*{footline}{infolines theme}
{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
\usebeamerfont{author in head/foot}\insertshortauthor~~
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
\usebeamerfont{title in head/foot}\insertshorttitle
\end{beamercolorbox}%
\insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
\end{beamercolorbox}
}%
\vskip0pt%
}
\mode
<all>

编辑:这是 TexMaker 错误内存的快照。有人知道这是什么意思吗? 在此处输入图片描述

答案1

如果我将 .sty 文件放在与演示文稿相同的目录中,那么该主题也适用于我。

你的主题中缺少了一些东西\begin{colorbox}。我怀疑倒数第 8 行应该包含\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{page in head/foot}%或类似内容。

以下是添加了此行的完整主题:

\ProvidesPackageRCS $Header: /cvsroot/latex-beamer/latex-beamer/themes/theme/monTheme.sty,v 1.0 23/05/2015 20:23:32 G.FALLOURD-M.LEBRETON Exp $
\mode<presentation>
\definecolor{sectionColor}{RGB}{0,51,102}
\definecolor{subsectionColor}{RGB}{153,0,0}
\definecolor{sectionTextColor}{RGB}{255,255,255}
\definecolor{subsectionTextColor}{RGB}{255,255,255}
\definecolor{leftFootlineColor}{RGB}{102,0,0}
\definecolor{middleFootlineColor}{RGB}{51,0,0}
\definecolor{rightFootlineColor}{RGB}{102,0,0}
\definecolor{authorColor}{RGB}{255,255,255}
\definecolor{footlineTitleColor}{RGB}{255,255,255}
\definecolor{instituteColor}{RGB}{0,0,0}
\definecolor{dateColor}{RGB}{0,0,0}
\definecolor{pageColor}{RGB}{255,255,255}
\definecolor{titleColor}{RGB}{102,0,0}
\definecolor{titleTextColor}{RGB}{255,255,255}
\definecolor{bodyColor}{RGB}{255,255,255}
\definecolor{normalTextColor}{RGB}{0,0,0}
\definecolor{exampleTextColor}{RGB}{51,153,51}
\definecolor{alertTextColor}{RGB}{204,51,51}
\definecolor{chipColor}{RGB}{0,0,102}
\definecolor{chipTextColor}{RGB}{255,255,255}
\definecolor{normalBlockColor}{RGB}{102,153,255}
\definecolor{normalTitleBlockColor}{RGB}{0,0,102}
\definecolor{normalBlockTextColor}{RGB}{255,255,255}
\definecolor{normalBlockTitleTextColor}{RGB}{255,255,255}
\definecolor{exampleBlockColor}{RGB}{0,204,0}
\definecolor{exampleTitleBlockColor}{RGB}{0,153,0}
\definecolor{exampleBlockTextColor}{RGB}{255,255,255}
\definecolor{exampleBlockTitleTextColor}{RGB}{255,255,255}
\definecolor{alertBlockColor}{RGB}{255,153,153}
\definecolor{alertTitleBlockColor}{RGB}{204,51,51}
\definecolor{alertBlockTextColor}{RGB}{255,255,255}
\definecolor{alertBlockTitleTextColor}{RGB}{255,255,255}
\setbeamercolor{section in head/foot}{bg=sectionColor, fg=sectionTextColor}
\setbeamercolor{subsection in head/foot}{bg=subsectionColor, fg=subsectionTextColor}
\setbeamercolor*{block title}{fg=normalBlockTitleTextColor,bg=normalTitleBlockColor}
\setbeamercolor*{block body}{fg=normalBlockTextColor,bg=normalBlockColor}
\setbeamercolor*{block title alerted}{fg=alertBlockTitleTextColor,bg=alertTitleBlockColor}
\setbeamercolor*{block body alerted}{fg=alertBlockTextColor,bg=alertBlockColor}
\setbeamercolor*{block title example}{fg=exampleBlockTitleTextColor,bg=exampleTitleBlockColor}
\setbeamercolor*{block body example}{fg=exampleBlockTextColor,bg=exampleBlockColor}
\setbeamerfont{block title}{size={}}
\setbeamercolor{titlelike}{fg=titleTextColor,bg=titleColor}
\setbeamercolor*{normal text}{fg=normalTextColor,bg=bodyColor}
\setbeamercolor*{example text}{fg=exampleTextColor}
\setbeamercolor*{alerted text}{fg=alertTextColor}
\useinnertheme{default}
\setbeamercolor{item projected}{bg=chipColor,fg=chipTextColor}
\setbeamercolor*{sidebar}{bg=sectionColor, fg=sectionTextColor}
\setbeamercolor*{palette sidebar primary}{bg=subsectionColor,fg=subsectionTextColor}
\setbeamercolor*{palette sidebar secondary}{bg=sectionColor,fg=sectionTextColor}
\newdimen\beamer@sidebarwidth
\newdimen\beamer@headheight
\beamer@sidebarwidth=4.5\baselineskip
\beamer@headheight=2.5\baselineskip
\reset@font
\def\beamer@lefttext{left}
\DeclareOptionBeamer{hideothersubsections}[]{\beamer@nav@subsectionstyle{show/show/hide}}
\DeclareOptionBeamer{hideallsubsections}[]{\beamer@nav@subsectionstyle{hide}}
\DeclareOptionBeamer{width}{\beamer@sidebarwidth=#1}
\DeclareOptionBeamer{height}{\beamer@headheight=#1}
\DeclareOptionBeamer{left}{\def\beamer@sidebarside{left}}
\DeclareOptionBeamer{right}{\def\beamer@sidebarside{right}}
\ExecuteOptionsBeamer{right}
\ProcessOptionsBeamer
\ifdim\beamer@headheight>0pt
\defbeamertemplate*{frametitle}{sidebar theme}
{%
\nointerlineskip%
\vskip-\beamer@headheight%
\vbox to \beamer@headheight{%
\vfil
\leftskip=-\beamer@leftmargin%
\advance\leftskip by0.3cm%
\rightskip=-\beamer@rightmargin%
\advance\rightskip by0.3cm plus1fil%
{\usebeamercolor[fg]{frametitle}\usebeamerfont{frametitle}\insertframetitle\par}%
{\usebeamercolor[fg]{framesubtitle}\usebeamerfont{framesubtitle}\insertframesubtitle\par}%
\vbox{}%
\vskip-1em%
\vfil
}%
}
\defbeamertemplate*{headline}{sidebar theme}
{%
\begin{beamercolorbox}[wd=\paperwidth]{frametitle}
\ifx\beamer@sidebarside\beamer@lefttext%
\else%
\hfill%
\fi%
\ifdim\beamer@sidebarwidth>0pt%
\usebeamercolor[bg]{logo}%
\vrule width\beamer@sidebarwidth height \beamer@headheight%
\hskip-\beamer@sidebarwidth%
\hbox to \beamer@sidebarwidth{\hss\vbox to
\beamer@headheight{\vss\hbox{\color{fg}\insertlogo}\vss}\hss}%
\else%
\vrule width0pt height \beamer@headheight%
\fi%
\end{beamercolorbox}
}
\fi
\def\beamer@sidebarformat#1#2#3{%
\begin{beamercolorbox}[wd=\beamer@sidebarwidth,leftskip=#1,rightskip=1ex plus1fil,vmode]{#2}
\vbox{}%
#3\par%
\vbox{}%
\vskip-1.5ex%
\end{beamercolorbox}
}
\defbeamertemplate*{section in sidebar}{sidebar theme}
{%
\vbox{%
\vskip1ex%
\beamer@sidebarformat{3pt}{section in sidebar}{\insertsectionhead}%
}%
}
\defbeamertemplate*{section in sidebar shaded}{sidebar theme}
{%
\vbox{%
\vskip1ex%
\beamer@sidebarformat{3pt}{section in sidebar shaded}{\insertsectionhead}%
}%
}
\defbeamertemplate*{subsection in sidebar}{sidebar theme}
{%
\beamer@sidebarformat{5pt}{subsection in sidebar}{\insertsubsectionhead}%
}
\defbeamertemplate*{subsection in sidebar shaded}{sidebar theme}
{%
\beamer@sidebarformat{5pt}{subsection in sidebar shaded}{\insertsubsectionhead}%
}
\defbeamertemplate*{subsubsection in sidebar}{sidebar theme}
{%
\beamer@sidebarformat{7pt}{subsubsection in sidebar}{\insertsubsubsectionhead}%
}
\defbeamertemplate*{subsubsection in sidebar shaded}{sidebar theme}
{%
\beamer@sidebarformat{7pt}{subsubsection in sidebar shaded}{\insertsubsubsectionhead}%
}
\ifdim\beamer@sidebarwidth>0pt
\setbeamersize{sidebar width \beamer@sidebarside=\beamer@sidebarwidth}
\defbeamertemplate*{sidebar \beamer@sidebarside}{sidebar theme}
{
\beamer@tempdim=\beamer@sidebarwidth%
\advance\beamer@tempdim by -6pt%
{\usebeamerfont{title in sidebar}%
\vskip1.5em%
\hskip3pt%
\insertshorttitle[width=\beamer@tempdim,center,respectlinebreaks]\par%
\vskip1.25em%
}%
\insertverticalnavigation{\beamer@sidebarwidth}%
\vfill
\ifx\beamer@sidebarside\beamer@lefttext%
\else%
\llap{\usebeamertemplate***{navigation symbols}\hskip0.1cm}%
\vskip2pt%
\fi%
}%
\setbeamersize{text margin left=0.5cm,text margin right=0.5cm}
\fi
\setbeamercolor{author in head/foot}{bg=leftFootlineColor, fg=authorColor}
\setbeamercolor{title in head/foot}{bg=middleFootlineColor, fg=footlineTitleColor}
\setbeamercolor{institute in head/foot}{fg=instituteColor}
\setbeamercolor{date in head/foot}{bg=rightFootlineColor, fg=dateColor}
\defbeamertemplate*{footline}{infolines theme}
{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
\usebeamerfont{author in head/foot}\insertshortauthor~~
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
\usebeamerfont{title in head/foot}\insertshorttitle
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{page in head/foot}%
\insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
\end{beamercolorbox}
}%
\vskip0pt%
}
\mode
<all>

相关内容