TransWikia.com

Beamer Title Slide Customisation (text alignment)

TeX - LaTeX Asked by Matt Jolly on May 22, 2021

I’m using Pandoc + Beamer to generate presentations from MarkDown source, but I’m having some issues with text alignment on my title slide.

I’m attempting to align text to the bottom right of the slide (to overlay some graphics), but seem to run against something on the bottom of the frame. I’m probably missing something basic here (like a default block or something), but what do I need to do to achieve the desired result?

My title slide customisation is:

defbeamertemplate*{title page}{customised}[1][]
{
AddToShipoutPicture*{BackgroundPic}
mbox{}
vfill
begin{flushright}vfillcolor{white}
  usebeamerfont{date}insertdatepar
  bigskip
  usebeamerfont{title}inserttitlepar
  %usebeamerfont{subtitle}insertsubtitlepar
end{flushright}
}

The complete pandoc template is:

% Lackadaisical Beamer Template
% Use to generate presentations from MarkDown via Pandoc
% Heavily based on the pandoc default template, but customised for beamer

% Variables:
% background-image          String - Path to image to be used as background on every slide.
% font:
%                           fontsize - Number - Base font size.
%                           mainfont - String - Body font
%                           sansfont - String - Heading font
%                           monofont - String - Monospaced font
% links-as-notes            Boolean - Make links footnotes rather than hyperlinks.
% navigation                String - Navigation Symbols:
%                               - default: none
%                               - Not sure what other values are valid, but they're rarely used!
% table-row-highlighting    Boolean - Enable alternate row colours.
% title-page-background     String - Path to image to be used as background on title page.
% toc-title                 String - Title on the Table of Contents slide. Default: none

PassOptionsToPackage{hyphens}{url}

documentclass[
$if(fontsize)$
  $fontsize$,
$endif$
$if(papersize)$
  $papersize$paper,
$endif$
  ignorenonframetext,
$if(handout)$
  handout,
$endif$
$if(aspectratio)$
  aspectratio=$aspectratio$,
$endif$
$for(classoption)$
  $classoption$$sep$,
$endfor$
xcolor={table},]{beamer}

% Background image for each slide.
$if(background-image)$
usebackgroundtemplate{%
includegraphics[width=paperwidth, height=paperheight]{/working/templates/template_resources/lackadaisical_beamer_background.pdf}%
}
$endif$

% Navigation symbols should be suppressed by default, but can be enabled.
setbeamercolor{caption name}{fg=normal text.fg}
beamertemplatenavigationsymbols$if(navigation)$$navigation$$else$empty$endif$
$for(beameroption)$
setbeameroption{$beameroption$}
$endfor$

% Set beamer font theme early
usefonttheme{serif}

widowpenalties 1 10000
raggedbottom

% Define some colours and then tell beamer to use them.
definecolor{blue}{HTML}{0D324D}
definecolor{burgandy}{HTML}{880D1E}
definecolor{green}{HTML}{6A8E7F}
definecolor{white}{RGB}{251,252,255}

definecolor{foreground}{RGB}{2, 2, 2} % Black
definecolor{background}{RGB}{251,252,255} % White
definecolor{grey}{RGB}{155,155,155}
definecolor{subtitle}{RGB}{102,255,204}
%definecolor{hilight}{RGB}{102,255,204}
%definecolor{vhilight}{RGB}{255,111,207}

% Titles on every page
setbeamercolor{titlelike}{fg=burgandy}
% Titles witin blocks
setbeamercolor{block title}{fg=blue}

% Titlepage items.
setbeamercolor{subtitle}{fg=green}
setbeamercolor{institute}{fg=grey}

% Body text
setbeamercolor{normal text}{fg=foreground,bg=background}

% Lists
setbeamercolor{item}{fg=blue} % Bullet colour
setbeamercolor{itemize items}{fg=blue}
setbeamercolor{subitem}{fg=grey}
setbeamercolor{itemize/enumerate subbody}{fg=grey}
setbeamertemplate{itemize subitem}{{textendash}} % Use en-dash for subitems.
setbeamerfont{itemize/enumerate subbody}{size=footnotesize} % make them smaller.
setbeamerfont{itemize/enumerate subitem}{size=footnotesize}


$if(section-titles)$
setbeamertemplate{part page}{
  centering
  begin{beamercolorbox}[sep=16pt,center]{part title}
    usebeamerfont{part title}insertpartpar
  end{beamercolorbox}
}
setbeamertemplate{section page}{
  centering
  begin{beamercolorbox}[sep=12pt,center]{part title}
    usebeamerfont{section title}insertsectionpar
  end{beamercolorbox}
}
setbeamertemplate{subsection page}{
  centering
  begin{beamercolorbox}[sep=8pt,center]{part title}
    usebeamerfont{subsection title}insertsubsectionpar
  end{beamercolorbox}
}
AtBeginPart{
  frame{partpage}
}
AtBeginSection{
  ifbibliography
  else
    frame{sectionpage}
  fi
}
AtBeginSubsection{
  frame{subsectionpage}
}
$endif$

% ulem is needed for underlining and strikethrough text commands.
% the option "normalem" is needed to preserve _italics_. Without the option,
% _italics_ will become underlines, which is not desirable.
usepackage[normalem]{ulem}


$if(theme)$
usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$}
$endif$
$if(colortheme)$
usecolortheme{$colortheme$}
$endif$
$if(fonttheme)$
usefonttheme{$fonttheme$}
$endif$
$if(mainfont)$
usefonttheme{serif} % use mainfont rather than sansfont for slide text
$endif$
$if(innertheme)$
useinnertheme{$innertheme$}
$endif$
$if(outertheme)$
useoutertheme{$outertheme$}
$endif$

%
% Configure Fonts
%

% fontspec provides an easy interface to XeTeX's font configuration.
usepackage{fontspec}

$if(monofont)$
  setmonofont{$monofont$}
$else$
  setmonofont{Inconsolata}[Scale=MatchLowercase]
$endif$

defaultfontfeatures{ Ligatures=TeX } % This is actually a default option for main and sans font, but applies to all fonts set after this point.
$if(mainfont)$
  setmainfont{$mainfont$}
$else$
  setmainfont[%
    BoldFont={Noto Sans Bold},
    ItalicFont={Noto Sans Italic},
    BoldItalicFont={Noto Sans Bold Italic}
  ]{Noto Sans}
    % We can use ucharclasses to setup font transitions based on unicode blocks.
  usepackage[CJK, Latin, Mathematics, Malayalam, Thai, Sinhala, Symbols]{ucharclasses}

  newfontfamily{cjkfont}{NotoSansCJK-Regular.ttc}
  newfontfamily{japanesefont}{NotoSansCJK-Regular.ttc}
  newfontfamily{latinfont}{Noto Sans}
  newfontfamily{malayalamfont}{Noto Sans Malayalam}
  newfontfamily{sinhalafont}{Noto Sans Sinhala}
  newfontfamily{thaifont}{Noto Sans Thai}
  newfontfamily{unifiedCJKfont}{NotoSansCJK-Regular.ttc}
  newfontfamily{mathsfont}{Noto Sans Math}
  newfontfamily{symbolfont}{Noto Sans Symbols}


% We're beginning and ending groups here so that the transition works anywhere.
% This means that if e.g. a symbol is used within monospaced text that it will return to being monospaced
% instead of going back to our defaultmain font!

  setTransitionsForCJK{begingroupcjkfont}{endgroup}
  setTransitionsForJapanese{begingroupjapanesefont}{endgroup}
  setTransitionsForMathematics{begingroupmathsfont}{endgroup}
  setTransitionsForSymbols{begingroupsymbolfont}{endgroup}

  setTransitionFrom{Malayalam}{endgroup}
  setTransitionFrom{Sinhala}{endgroup}
  setTransitionFrom{Thai}{endgroup}
  setTransitionTo{Malayalam}{begingroupmalayalamfont}
  setTransitionTo{Sinhala}{begingroupsinhalafont}
  setTransitionTo{Thai}{begingroupthaifont}
$endif$

$if(sansfont)$
  setsansfont{$sansfont$}
$else$
  setsansfont{Liberation Sans}
$endif$


usepackage{unicode-math}

%
% Required for pandoc to generate tables.
%

$if(tables)$
  usepackage{longtable,booktabs,array,caption}
  % Make caption package work with longtable
  makeatletter
  deffnum@table{tablename~thetable}
  makeatother
$endif$

$if(table-row-highlighting)$
  letoldtabulartabular
  letendoldtabularendtabular
  renewenvironment{tabular}{%
    rowcolors{2}{green}{}
    oldtabular
  }{endoldtabular}

  letoldlongtablelongtable
  letendoldlongtableendlongtable
  renewenvironment{longtable}{%
    rowcolors{2}{green}{}
    oldlongtable
  }{endoldlongtable}
$endif$


% Pandoc puts lists within tightlist. We need to provide that command else the conversion will fail.
providecommand{tightlist}{
  setlength{itemsep}{0pt}setlength{parskip}{0pt}}

% Use upquote if available, for straight quotes in verbatim environments
IfFileExists{upquote.sty}{usepackage{upquote}}{}
IfFileExists{microtype.sty}{% use microtype if available
  usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype}
  UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}

newififbibliography

$if(listings)$
usepackage{listings}
newcommand{passthrough}[1]{#1}
lstset{defaultdialect=[5.3]Lua}
lstset{defaultdialect=[x86masm]Assembler}
$endif$

$highlighting-macros$

$if(graphics)$
usepackage{graphicx}
makeatletter
defmaxwidth{ifdimGin@nat@width>linewidthlinewidthelseGin@nat@widthfi}
defmaxheight{ifdimGin@nat@height>textheighttextheightelseGin@nat@heightfi}
makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in includegraphics[width, height, ...]{}
setkeys{Gin}{width=maxwidth,height=maxheight,keepaspectratio}
% Set default figure placement to htbp
makeatletter
deffps@figure{htbp}
makeatother
$endif$

$if(links-as-notes)$
% Make links footnotes instead of hotlinks:
DeclareRobustCommand{href}[2]{#2footnote{url{#1}}}
$endif$

$if(natbib)$
usepackage[$natbiboptions$]{natbib}
bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
$endif$
$if(biblatex)$
usepackage[$if(biblio-style)$style=$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex}
$for(bibliography)$
addbibresource{$bibliography$}
$endfor$
$endif$
$if(csl-refs)$
newlength{cslhangindent}
setlength{cslhangindent}{1.5em}
newlength{csllabelwidth}
setlength{csllabelwidth}{3em}
newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing
 {% don't indent paragraphs
  setlength{parindent}{0pt}
  % turn on hanging indent if param 1 is 1
  ifodd #1 everypar{setlength{hangindent}{cslhangindent}}ignorespacesfi
  % set entry spacing
  ifnum #2 > 0
  setlength{parskip}{#2baselineskip}
  fi
 }%
 {}
usepackage{calc}
newcommand{CSLBlock}[1]{#1hfillbreak}
newcommand{CSLLeftMargin}[1]{parbox[t]{csllabelwidth}{#1}}
newcommand{CSLRightInline}[1]{parbox[t]{linewidth - csllabelwidth}{#1}break}
newcommand{CSLIndent}[1]{hspace{cslhangindent}#1}
$endif$

% Slide number in lower right
definecolor{white}{RGB}{255,255,255}
setbeamertemplate{footline}{%
    raisebox{5pt}{makebox[paperwidth]{hfillmakebox[20pt]{color{white}
          scriptsizeinsertframenumber}}}hspace*{5pt}}

% Required for title page background. Provides AddToShipoutPicture
% We use the PDF for a vector image because XeLaTeX can't determine the SVG width.
usepackage[pscoord]{eso-pic}
usepackage{calc}
newcommandBackgroundPic{
    put(0,0){
    parbox[b][paperheight]{paperwidth}{%
    centering
    includegraphics[width=paperwidth,height=paperheight]{/working/templates/template_resources/lackadaisical_beamer_title.pdf}
}}}

%
% Set metadata & content variables
%

% PDF metadata, also some other URL
% options (breaklinks breaks URLs so they aren't ugly)
%usepackage[hyphens]{url} % This package breaks links even better
usepackage{hyperref}
hypersetup{
unicode=true,
breaklinks=true,
colorlinks=true,
linkcolor=[rgb]{0.00,0.00,0.00},
urlcolor=[rgb]{0.00,0.00,0.00},
pdftitle={$title$},
pdfsubject={$subject$},
pdfauthor={$author$},
pdfkeywords={$keywords$},
pdfproducer={Pandoc and XeLaTeX},
pdfborder={0 0 0},
pdfpagemode=UseNone
}

% Set some content variables.
title{$title$}
$if(author)$
author{$author$}
$endif$
subtitle{$subtitle$}

% Set the date (use today to get date when generated)
$if(date)$
date{$date$}
$else$
date{today}
$endif$

%
% Customise beamer title page
%
defbeamertemplate*{title page}{customised}[1][]
{
AddToShipoutPicture*{BackgroundPic}
mbox{}
vfill
begin{flushright}vfillcolor{white}
  usebeamerfont{date}insertdatepar
  bigskip
  usebeamerfont{title}inserttitlepar
  %usebeamerfont{subtitle}insertsubtitlepar
end{flushright}
}

$if(logo)$
logo{includegraphics{$logo$}}
$endif$

%
% Fix Section Headings
% Hyperref stops hyperlinks from looking bad as content buuuuut
% It also changes the colour of section titles. Let's stop that happening.

AtBeginSection[]{
  begin{frame}
  vfill
  centering
  begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
    usebeamerfont{title}%
    hypersetup{hidelinks}%
    insertsectionheadpar%
  end{beamercolorbox}
  vfill
  end{frame}
}

%
% DOCUMENT BEGINS HERE
%

begin{document}
$if(has-frontmatter)$
frontmatter
$endif$
$if(title)$
frame{titlepage}
$if(abstract)$
begin{abstract}
$abstract$
end{abstract}
$endif$
$endif$

$for(include-before)$
$include-before$
$endfor$

$if(toc)$
$if(toc-title)$
renewcommand*contentsname{$toc-title$}
$endif$
begin{frame}[allowframebreaks]
$if(toc-title)$
  frametitle{$toc-title$}
$endif$
  tableofcontents[hideallsubsections]
end{frame}
$endif$

$if(lot)$
listoftables
$endif$

$if(lof)$
listoffigures
$endif$

$if(linestretch)$
setstretch{$linestretch$}
$endif$

$if(has-frontmatter)$
mainmatter
$endif$

$body$

$if(has-frontmatter)$
backmatter
$endif$

$if(natbib)$
$if(bibliography)$
$if(biblio-title)$
$if(has-chapters)$
renewcommandbibname{$biblio-title$}
$else$
renewcommandrefname{$biblio-title$}
$endif$
$endif$
begin{frame}[allowframebreaks]{$biblio-title$}
  bibliographytrue
  bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
end{frame}

$endif$
$endif$

$if(biblatex)$
begin{frame}[allowframebreaks]{$biblio-title$}
  bibliographytrue
  printbibliography[heading=none]
end{frame}
$else$
printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
$endif$

$for(include-after)$
$include-after$
$endfor$

end{document}

And some markdown source that will generate a titlepage:

---
title: Example Presentation
background-image: true
author: Matt Jolly
keywords:
 - example
subject: example

aspectratio: 169
table-row-highlighting: true
toc: true
slide-level: 2

---

# General information

## What am I looking at?

This is a beamer presentation generated from MarkDown Source.

> The name is taken from the German word "Beamer" as a pseudo-anglicism for "video projector".

## MarkDown

In this presentation, when referring to MarkDown it specifically means [pandoc Markdown](https://pandoc.org/MANUAL.html#pandocs-markdown), which is a superset of [CommonMark](https://commonmark.org/).

Thanks for the assistance!

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