aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-09-23 16:51:15 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2025-09-23 16:51:15 +0200
commita6ab979032bb048f65573863a2c2989343d2fa60 (patch)
tree82618b898e550b3c9a17684147c97e5f91becca8
parent767d8fe25608129e7ee949d0d4ece6268294916a (diff)
downloadunterricht-a6ab979032bb048f65573863a2c2989343d2fa60.tar.gz
unterricht-a6ab979032bb048f65573863a2c2989343d2fa60.zip
keep the beamer template as close as possible to the pandoc default
-rw-r--r--pandoc/templates/beamer.tex100
1 files changed, 81 insertions, 19 deletions
diff --git a/pandoc/templates/beamer.tex b/pandoc/templates/beamer.tex
index 53b23e37..b3ebd677 100644
--- a/pandoc/templates/beamer.tex
+++ b/pandoc/templates/beamer.tex
@@ -23,6 +23,9 @@ $endif$
$if(aspectratio)$
aspectratio=$aspectratio$,
$endif$
+$if(babel-lang)$
+ $babel-lang$,
+$endif$
$endif$
$for(classoption)$
$classoption$$sep$,
@@ -152,13 +155,37 @@ $endif$
\ifPDFTeX\else
% xetex/luatex font selection
$if(mainfont)$
- \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
+ $if(mainfontfallback)$
+ \ifLuaTeX
+ \usepackage{luaotfload}
+ \directlua{luaotfload.add_fallback("mainfontfallback",{
+ $for(mainfontfallback)$"$mainfontfallback$"$sep$,$endfor$
+ })}
+ \fi
+ $endif$
+ \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$$if(mainfontfallback)$,RawFeature={fallback=mainfontfallback}$endif$]{$mainfont$}
$endif$
$if(sansfont)$
- \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
+ $if(sansfontfallback)$
+ \ifLuaTeX
+ \usepackage{luaotfload}
+ \directlua{luaotfload.add_fallback("sansfontfallback",{
+ $for(sansfontfallback)$"$sansfontfallback$"$sep$,$endfor$
+ })}
+ \fi
+ $endif$
+ \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$$if(sansfontfallback)$,RawFeature={fallback=sansfontfallback}$endif$]{$sansfont$}
$endif$
$if(monofont)$
- \setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$]{$monofont$}
+ $if(monofontfallback)$
+ \ifLuaTeX
+ \usepackage{luaotfload}
+ \directlua{luaotfload.add_fallback("monofontfallback",{
+ $for(monofontfallback)$"$monofontfallback$"$sep$,$endfor$
+ })}
+ \fi
+ $endif$
+ \setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$if(monofontfallback)$,RawFeature={fallback=monofontfallback}$endif$]{$monofont$}
$endif$
$for(fontfamilies)$
\newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$}
@@ -288,15 +315,17 @@ $endif$
$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}
+\newsavebox\pandoc@box
+\newcommand*\pandocbounded[1]{% scales image to fit in text height/width
+ \sbox\pandoc@box{#1}%
+ \Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}%
+ \Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}%
+ \ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both
+ \ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}%
+ \else\usebox{\pandoc@box}%
+ \fi%
+}
% Set default figure placement to htbp
-\makeatletter
\def\fps@figure{htbp}
\makeatother
$endif$
@@ -310,6 +339,22 @@ $-- also used for underline
\usepackage[soul]{lua-ul}
\else
\usepackage{soul}
+$if(beamer)$
+ \makeatletter
+ \let\HL\hl
+ \renewcommand\hl{% fix for beamer highlighting
+ \let\set@color\beamerorig@set@color
+ \let\reset@color\beamerorig@reset@color
+ \HL}
+ \makeatother
+$endif$
+$if(CJKmainfont)$
+ \ifXeTeX
+ % soul's \st doesn't work for CJK:
+ \usepackage{xeCJKfntef}
+ \renewcommand{\st}[1]{\sout{#1}}
+ \fi
+$endif$
\fi
$endif$
\setlength{\emergencystretch}{3em} % prevent overfull lines
@@ -327,14 +372,28 @@ $if(beamer)$
$else$
$if(block-headings)$
% Make \paragraph and \subparagraph free-standing
+\makeatletter
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
- \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
+ \renewcommand{\paragraph}{
+ \@ifstar
+ \xxxParagraphStar
+ \xxxParagraphNoStar
+ }
+ \newcommand{\xxxParagraphStar}[1]{\oldparagraph*{#1}\mbox{}}
+ \newcommand{\xxxParagraphNoStar}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
- \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
+ \renewcommand{\subparagraph}{
+ \@ifstar
+ \xxxSubParagraphStar
+ \xxxSubParagraphNoStar
+ }
+ \newcommand{\xxxSubParagraphStar}[1]{\oldsubparagraph*{#1}\mbox{}}
+ \newcommand{\xxxSubParagraphNoStar}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
+\makeatother
$endif$
$endif$
$if(pagestyle)$
@@ -386,7 +445,7 @@ $if(babel-lang)$
$if(mainfont)$
\ifPDFTeX
\else
-\babelfont{rm}[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
+\babelfont{rm}[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$$if(mainfontfallback)$,RawFeature={fallback=mainfontfallback}$endif$]{$mainfont$}
\fi
$endif$
$endif$
@@ -399,13 +458,15 @@ $endfor$
% get rid of language-specific shorthands (see #6817):
\let\LanguageShortHands\languageshorthands
\def\languageshorthands#1{}
+$if(selnolig-langs)$
+\ifLuaTeX
+ \usepackage[$for(selnolig-langs)$$it$$sep$,$endfor$]{selnolig} % disable illegal ligatures
+\fi
+$endif$
$endif$
$for(header-includes)$
$header-includes$
$endfor$
-\ifLuaTeX
- \usepackage{selnolig} % disable illegal ligatures
-\fi
$if(dir)$
\ifPDFTeX
\TeXXeTstate=1
@@ -493,7 +554,7 @@ $if(institute)$
\institute{$for(institute)$$institute$$sep$ \and $endfor$}
$endif$
$if(titlegraphic)$
-\titlegraphic{\includegraphics{$titlegraphic$}}
+\titlegraphic{\includegraphics$if(titlegraphicoptions)$[$for(titlegraphicoptions)$$titlegraphicoptions$$sep$, $endfor$]$endif${$titlegraphic$}}
$endif$
$if(logo)$
\logo{\includegraphics{$logo$}}
@@ -530,7 +591,8 @@ $if(beamer)$
$if(toc-title)$
\frametitle{$toc-title$}
$endif$
- \tableofcontents[hideallsubsections]
+ \setcounter{tocdepth}{$toc-depth$}
+ \tableofcontents
\end{frame}
$else$
{