我正在使用 Pandoc + Beamer 从 MarkDown 源生成演示文稿,但是我的标题幻灯片上的文本对齐遇到了一些问题。
我试图将文本与幻灯片的右下角对齐(以覆盖一些图形),但似乎与框架底部的某些东西相冲突。我可能在这里遗漏了一些基本的东西(例如默认块或其他东西),但我需要做什么才能达到预期的效果?
我的标题幻灯片定制是:
\defbeamertemplate*{title page}{customised}[1][]
{
\AddToShipoutPicture*{\BackgroundPic}
\mbox{}
\vfill
\begin{flushright}\vfill\color{white}
\usebeamerfont{date}\insertdate\par
\bigskip
\usebeamerfont{title}\inserttitle\par
%\usebeamerfont{subtitle}\insertsubtitle\par
\end{flushright}
}
完整的 pandoc 模板是:
% 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}\insertpart\par
\end{beamercolorbox}
}
\setbeamertemplate{section page}{
\centering
\begin{beamercolorbox}[sep=12pt,center]{part title}
\usebeamerfont{section title}\insertsection\par
\end{beamercolorbox}
}
\setbeamertemplate{subsection page}{
\centering
\begin{beamercolorbox}[sep=8pt,center]{part title}
\usebeamerfont{subsection title}\insertsubsection\par
\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 default\main font!
\setTransitionsForCJK{\begingroup\cjkfont}{\endgroup}
\setTransitionsForJapanese{\begingroup\japanesefont}{\endgroup}
\setTransitionsForMathematics{\begingroup\mathsfont}{\endgroup}
\setTransitionsForSymbols{\begingroup\symbolfont}{\endgroup}
\setTransitionFrom{Malayalam}{\endgroup}
\setTransitionFrom{Sinhala}{\endgroup}
\setTransitionFrom{Thai}{\endgroup}
\setTransitionTo{Malayalam}{\begingroup\malayalamfont}
\setTransitionTo{Sinhala}{\begingroup\sinhalafont}
\setTransitionTo{Thai}{\begingroup\thaifont}
$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
\def\fnum@table{\tablename~\thetable}
\makeatother
$endif$
$if(table-row-highlighting)$
\let\oldtabular\tabular
\let\endoldtabular\endtabular
\renewenvironment{tabular}{%
\rowcolors{2}{green}{}
\oldtabular
}{\endoldtabular}
\let\oldlongtable\longtable
\let\endoldlongtable\endlongtable
\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
}{}
\newif\ifbibliography
$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
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\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
\def\fps@figure{htbp}
\makeatother
$endif$
$if(links-as-notes)$
% Make links footnotes instead of hotlinks:
\DeclareRobustCommand{\href}[2]{#2\footnote{\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}}\ignorespaces\fi
% set entry spacing
\ifnum #2 > 0
\setlength{\parskip}{#2\baselineskip}
\fi
}%
{}
\usepackage{calc}
\newcommand{\CSLBlock}[1]{#1\hfill\break}
\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]{\hfill\makebox[20pt]{\color{white}
\scriptsize\insertframenumber}}}\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}
\newcommand\BackgroundPic{
\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}\vfill\color{white}
\usebeamerfont{date}\insertdate\par
\bigskip
\usebeamerfont{title}\inserttitle\par
%\usebeamerfont{subtitle}\insertsubtitle\par
\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}%
\insertsectionhead\par%
\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)$
\renewcommand\bibname{$biblio-title$}
$else$
\renewcommand\refname{$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}
还有一些会生成标题页的 markdown 源:
---
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/).
谢谢您的帮助!