TransWikia.com

Beamer: Is there a cleaner way to implement this titlepage

TeX - LaTeX Asked by noibe on December 5, 2020

I have the following MWE, taken from this post, that creates a beamer titlepage showing both the candidate and the supervisor of a thesis

documentclass{beamer}

usetheme{Hannover}
usecolortheme{whale}

usefonttheme[stillsansserifsmall,stillsansseriflarge]{serif}

definecolor{Text}{HTML}{000F1C}
setbeamercolor{normal text}{fg=Text}

newsavebox{authbox}
sbox{authbox}{%
  begin{minipage}{0.5textwidth}
    centering
    {small textcolor{Text}{textrm{Candidate:}}} 
    {normalsize textcolor{Text}{textrm{Foo Bar}}}
  end{minipage}%
  begin{minipage}{0.5textwidth}
    centering
    {small textcolor{Text}{textrm{Supervisor:}}} 
    {normalsize textcolor{Text}{textrm{Prof. Foo Bar Baz}}}
  end{minipage}
}

title{An interesting topic}
author[Me]{usebox{authbox}}
institute{A university}

begin{document}

begin{frame}
  titlepage
end{frame}

end{document}

which produces the following

enter image description here

What I don’t like about this implementation is:

  1. I have to manually call textrm{...} even though I’m already using the serif font theme. A normal author{me} would already be in serif;

  2. I have to manually call textcolor{Text} even though I’m alredy setting fg=Text for normal text. A normal author{me} would already be colored in Text.

  3. The two minipages seem to be a shifted to the right. For example, if I substitute the first centering with flushleft and the second one with flushright, this is what I get

enter image description here

while I’d expect Candidate to be lined up with the left side of the title’s colorbox, and the end of Supervisor to be lined up with right side. Instead, Candidate starts a bit to the right of the left side and Supervisor ends a bit to the right of the right side.

Is there a way to fix all three of these issues? Is there a completely different implementation that is cleaner and produces the desired results?

One Answer

Alas, beamer themes cannot be searched using my usual approach, so I have no idea what colors and spacing it actually uses. A precise match by trial and error is possible, but tedious.

documentclass{beamer}

usepackage{tikz}

usetheme{Hannover}
usecolortheme{whale}

usefonttheme[stillsansserifsmall,stillsansseriflarge]{serif}

definecolor{Text}{HTML}{000F1C}
setbeamercolor{normal text}{fg=Text}

newsavebox{authbox}
sbox{authbox}{%
  begin{minipage}{0.5linewidth}
    centering
    {small textcolor{Text}{textrm{Candidate:}}} 
    {normalsize textcolor{Text}{textrm{Foo Bar}}}
  end{minipage}%
  begin{minipage}{0.5linewidth}
    centering
    {small textcolor{Text}{textrm{Supervisor:}}} 
    {normalsize textcolor{Text}{textrm{Prof. Foo Bar Baz}}}
  end{minipage}
}

title{An interesting topic}% used on every page
author[Me]{usebox{authbox}}
institute{A university}

begin{document}

begin{frame}
  titlepage
end{frame}

begin{frame}
  begin{tikzpicture}
    fill[blue] (0,0) rectangle (linewidth,1cm);
    node[white] at (0.5linewidth,0.5cm) {Largetextsf{An interesting topic}};
    node[below,align=center] at (0.25textwidth,-1cm) {Candidate:[4pt] Foo Bar};
    node[below,align=center] at (0.75textwidth,-1cm) {Supervisor:[4pt] Prof. Foo Bar Baz};
    node at (0.5linewidth, -3cm) {footnotesize A university};
    node at (0.5linewidth, -4cm) {today};
  end{tikzpicture}
end{frame}

end{document}

Correct answer by John Kormylo on December 5, 2020

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