TransWikia.com

How to set a beamer template to be the same as another template?

TeX - LaTeX Asked by sipaq11 on August 4, 2021

Is it possible to set a beamer template to be the same as another template? I define a template named "myTemplate page" and I would like that template to be the same as the "section page" template. The purpose of this is if someone change the theme that would likely change the section page template and I want myTemplate to change as well. For example, in the MWE, the Frankfurt theme set the section page parameters as colsep=-4bp,rounded=true,shadow=beamer@themerounded@shadow. How can I pass those settings directly to "myTemplate page" without knowing them in advance?

documentclass{beamer}
usetheme{Frankfurt}

AtBeginSection[]{%
frame{sectionpage}
}%

defmyTemplatepage{usebeamertemplate*{myTemplate page}}

defbeamertemplate*{myTemplate page}{default}[1][]
{
    begingroup
    centering
    {usebeamerfont{section name}
    usebeamercolor[fg]{section name} Some text}
    vskip1empar
    begin{beamercolorbox}[sep=12pt,center,#1]{section title}
    usebeamerfont{section title} Some other text par
    end{beamercolorbox}
    endgroup
}

begin{document}
section{First section}        
begin{frame}{}
myTemplatepage 
end{frame}
    
end{document}

UPDATE

I tried to add

defbeamertemplateparent{section page}{myTemplate page}[1][default]{[#1]}

(as recommended by TobiBS) but it seems to do nothing. Also, I guessed that the template modifications should come after defining the template parent so I moved the usetheme{Frankfurt} after the defbeamertemplateparent, with no result.

I did not find many examples with defbeamertemplateparent or defbeamertemplatealias. I probably don’t understand how they work. But it feels like it should work!

UPDATE 2

I looked at the the themes provided in the beamer class and I think that the only things that changes from one another that affect the section page template is the round corners and the shadow. So I decided to manualy check those two things in the preambule and apply it to myTemplate page. This is really not the solution I wanted but it is the best I can do for now. I would have prefer something more general. I used the etoolbox package for boolean tests.

AtBeginDocument{%
@ifpackageloaded{beamerinnerthemerounded}{%
ifcsdef{beamer@themerounded@shadow}{%
edefx{beamer@themerounded@shadow}%
ifboolexpe{bool {x}}{%
setbeamertemplate{myTemplate page}[default][colsep=-4bp, rounded=true, 
shadow=true]%
}{setbeamertemplate{myTemplate page}[default][colsep=-4bp, rounded=true]}
}{}%
}{}%
}%  

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP