我正在定义这个beamer style
文件,并在我的 beamer tex 中使用它。
\defbeamertemplate*{footline}{mat theme}{%
\begin{beamercolorbox}[wd=\paperwidth,ht=0.04\paperheight,dp=2.25ex]{title in head/foot}%
\begin{minipage}[t]{0.25\paperwidth}%
\hskip10pt\insertshortauthor%
\end{minipage}%
\begin{minipage}[t]{0.60\paperwidth}%
\centering
\inserttitle\vfill%
\end{minipage}%
\begin{minipage}[t]{0.10\paperwidth}%
\begin{flushright}
\ifnum \insertpagenumber=1
\includegraphics[width=.1\pagewidth]{/tmp/g1915.png} %PATH HARDCODED
\else
\insertframenumber{}\hfill\vfill%
\fi
\end{flushright}
\end{minipage}%
\end{beamercolorbox}%
\vfill%
}
唯一的问题是这里的标志,即
\includegraphics[width=.1\pagewidth]{/tmp/g1915.png}
如您所见,路径是硬编码的。我在这里寻找一些变量,以便在我的主 tex 文件中,我可能有
\setlogo{/tmp/g1915.png}
以达到同样的效果。
我怎样才能做到这一点?
更新我尝试过 egreg 的回复,但没有用(抱歉,我又改了,所以没有确切的错误),但是这里是mwe
:
韋斯特
%mwe
%
%
\mode<presentation>
\usepackage[customcolors,shade]{hf-tikz}
\usetikzlibrary{arrows,shadows,petri,decorations.markings,shapes}
\RequirePackage[many]{tcolorbox}
\usepackage{mathtools}
%%%%%%%%%%%%%%%%%%%%%%%%%
% HOW TO DEFINE ITEMS
%%%%%%%%%%%%%%%%%%%%%%%%%
\def\insertframetitle{}
\setbeamertemplate{section in toc}[circle]
\setbeamertemplate{subsection in toc}[square]
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{enumerate items}{\begingroup\fontfamily{lmr}\selectfont\textbullet\endgroup}
\setbeamertemplate{itemize items}{\begingroup\fontfamily{lmr}\selectfont\textbullet\endgroup}
%%%%%%%%%%%%%%%%%%%%%
% FOOTLINE
%%%%%%%%%%%%%%%%%%%%%
\defbeamertemplate*{footline}{mat theme}{%
\begin{beamercolorbox}[wd=\paperwidth,ht=0.04\paperheight,dp=2.25ex]{title in head/foot}%
\begin{minipage}[t]{0.25\paperwidth}%
\hskip10pt\insertshortauthor%
\end{minipage}%
\begin{minipage}[t]{0.60\paperwidth}%
\centering
\inserttitle\vfill%
\end{minipage}%
\begin{minipage}[t]{0.10\paperwidth}%
\begin{flushright}
\ifnum \insertpagenumber=1
\includegraphics[width=.06\pagewidth]{/tmp/logo.png}%\hskip20pt
\else
\insertframenumber{}\hfill\vfill%
\fi
\end{flushright}
\end{minipage}%
\end{beamercolorbox}%
\vfill%
}
麦格
\documentclass[8pt,xcolor=dvipsnames,xcolor=table]{beamer}
\usetheme{mwe}
\title{MWE}
\begin{document}
\maketitle
\end{document}
答案1
通常的做法是
\newcommand{\matthemelogo}{example-image}% initialize to something
\newcommand{\setmatthemelogo}[1]{%
\gdef\matthemelogo{#1}%
}
并在模板代码中使用\matthemelogo
而不是硬连线文本。
在你的文档中你可以说
\setmatthemelogo{/tmp/g1915.png}
(由于缺乏 MWE,因此未经测试)