TeX - LaTeX Asked on February 12, 2021
Please check this mwe.tex
documentclass[10pt,xcolor=dvipsnames,xcolor=table,handout]{beamer}
definecolor{dcol}{HTML}{034da1}
usetheme{Mwe}
title{mwe}
author{mwe}
institute{mwe}
begin{document}
maketitle
begin{frame}{Table of Contents}
tableofcontents
end{frame}
section{Hello}
subsection{Hello}
begin{frame}{Hello Title}
Hello text
begin{itemize}
item Hello
end{itemize}
end{frame}
end{document}
and the corresponding beamerthemeMwe.sty:
mode<presentation>
usepackage[sfdefault]{roboto}
usecolortheme[named=dcol]{structure}
setbeamercolor*{palette primary}{use=structure,fg=white,bg=dcol}
setbeamercolor*{palette quaternary}{bg=dcol,fg=white}
setbeamercolor{normal text}{fg=dcol}
%%%%%%%%%%%%%%%%%%%%%
% FOOTLINE
%%%%%%%%%%%%%%%%%%%%%
defbeamertemplate*{footline}{mat theme}{%
begin{beamercolorbox}[wd=paperwidth,ht=0.04paperheight,dp=2.25ex]{title in head/foot}%
begin{minipage}[c]{0.25paperwidth}%
hskip10ptinsertshortauthor%
end{minipage}%
begin{minipage}[c]{0.60paperwidth}%
centering
inserttitle%
end{minipage}%
begin{minipage}[t]{0.10paperwidth}%
begin{flushright}
ifnum insertpagenumber=1
includegraphics[width=.06pagewidth]{example-image-a}%hskip20pt
else
insertframenumber{}hfillvfill%
fi
end{flushright}
end{minipage}%
end{beamercolorbox}%
vfill%
}
AtBeginDocument{%
pgfdeclareverticalshading{b@matshade}{thepaperwidth}
{rgb(0pt)=(1,1,1); rgb(3pt)=(0.8,0.8,0.8);rgb(5pt)=(0.75,0.75,0.75)}
}
The problem is, I would like insert the image from preamble. At present, the logo is hard coded, as example-image-a
:
begin{flushright}
ifnum insertpagenumber=1
includegraphics[width=.06pagewidth]{example-image-a}%hskip20pt
else
insertframenumber{}hfillvfill%
fi
I am trying to change it, with some option, so that I can change the image in preamble as
setlogo{example-image-b}
How I can do that?
I have asked this question before, in use variable image in setbeamertheme but the answer is not working, and I had got error (the exact output is not with me right now).
In your beamer style, define setlogo
as follows.
newcommandsetlogo[1]{def@logo{#1}}
Moreover, change the part where you load the logo to the following code. If the logo hasn't been set, it will print the page number, otherwise the logo.
begin{minipage}[t]{0.10paperwidth}%
begin{flushright}
ifnum insertpagenumber=1
ifcsname @logoendcsname
includegraphics[width=.06paperwidth]{@logo}%
else
insertframenumber{}hfillvfill
fi
else
insertframenumber{}hfillvfill
fi
end{flushright}
end{minipage}%
% main.tex
documentclass[10pt,xcolor=dvipsnames,xcolor=table,handout]{beamer}
definecolor{dcol}{HTML}{034da1}
usetheme{Mwe}
setlogo{example-image-a}
title{mwe}
author{mwe}
institute{mwe}
begin{document}
maketitle
begin{frame}{Table of Contents}
tableofcontents
end{frame}
section{Hello}
subsection{Hello}
begin{frame}{Hello Title}
Hello text
begin{itemize}
item Hello
end{itemize}
end{frame}
end{document}
% beamerthemeMwe.sty
mode<presentation>
usepackage[sfdefault]{roboto}
usecolortheme[named=dcol]{structure}
setbeamercolor*{palette primary}{use=structure,fg=white,bg=dcol}
setbeamercolor*{palette quaternary}{bg=dcol,fg=white}
setbeamercolor{normal text}{fg=dcol}
newcommandsetlogo[1]{def@logo{#1}}
%%%%%%%%%%%%%%%%%%%%%
% FOOTLINE
%%%%%%%%%%%%%%%%%%%%%
defbeamertemplate*{footline}{mat theme}{%
begin{beamercolorbox}[wd=paperwidth,ht=0.04paperheight,dp=2.25ex]{title in head/foot}%
begin{minipage}[c]{0.25paperwidth}%
hskip10ptinsertshortauthor%
end{minipage}%
begin{minipage}[c]{0.60paperwidth}%
centering
inserttitle%
end{minipage}%
begin{minipage}[t]{0.10paperwidth}%
begin{flushright}
ifnum insertpagenumber=1
ifcsname @logoendcsname
includegraphics[width=.06paperwidth]{@logo}%hskip20pt
else
insertframenumber{}hfillvfill
fi
else
insertframenumber{}hfillvfill
fi
end{flushright}
end{minipage}%
end{beamercolorbox}%
vfill%
}
AtBeginDocument{%
pgfdeclareverticalshading{b@matshade}{thepaperwidth}
{rgb(0pt)=(1,1,1); rgb(3pt)=(0.8,0.8,0.8);rgb(5pt)=(0.75,0.75,0.75)}
}
Answered by gernot on February 12, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP