diff options
-rw-r--r-- | beamer-template.tex | 280 | ||||
-rwxr-xr-x | gup/pdf.gup | 30 | ||||
-rw-r--r-- | preamble.tex | 15 |
3 files changed, 316 insertions, 9 deletions
diff --git a/beamer-template.tex b/beamer-template.tex new file mode 100644 index 0000000..89d9a28 --- /dev/null +++ b/beamer-template.tex | |||
@@ -0,0 +1,280 @@ | |||
1 | \documentclass[$if(lang)$$babel-lang$,$endif$$if(handout)$handout,$endif$$if(aspectratio)$aspectratio=$aspectratio$,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{beamer} | ||
2 | %% \setbeamertemplate{caption}[numbered] | ||
3 | %% \setbeamertemplate{caption label separator}{: } | ||
4 | %% \setbeamercolor{caption name}{fg=normal text.fg} | ||
5 | \usepackage{pgfpages} | ||
6 | \beamertemplatenavigationsymbols$if(navigation)$$navigation$$else$empty$endif$ | ||
7 | \setbeameroption{show notes on second screen} | ||
8 | $if(fontfamily)$ | ||
9 | \usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$} | ||
10 | $else$ | ||
11 | \usepackage{lmodern} | ||
12 | $endif$ | ||
13 | \usepackage{amssymb,amsmath} | ||
14 | \usepackage{ifxetex,ifluatex} | ||
15 | \usepackage{fixltx2e} % provides \textsubscript | ||
16 | \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex | ||
17 | \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc} | ||
18 | \usepackage[utf8]{inputenc} | ||
19 | $if(euro)$ | ||
20 | \usepackage{eurosym} | ||
21 | $endif$ | ||
22 | \else % if luatex or xelatex | ||
23 | \ifxetex | ||
24 | \usepackage{mathspec} | ||
25 | \else | ||
26 | \usepackage{fontspec} | ||
27 | \fi | ||
28 | \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase} | ||
29 | $for(fontfamilies)$ | ||
30 | \newfontfamily{$fontfamilies.name$}[$fontfamilies.options$]{$fontfamilies.font$} | ||
31 | $endfor$ | ||
32 | $if(euro)$ | ||
33 | \newcommand{\euro}{€} | ||
34 | $endif$ | ||
35 | $if(mainfont)$ | ||
36 | \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$} | ||
37 | $endif$ | ||
38 | $if(sansfont)$ | ||
39 | \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$} | ||
40 | $endif$ | ||
41 | $if(monofont)$ | ||
42 | \setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$endif$]{$monofont$} | ||
43 | $endif$ | ||
44 | $if(mathfont)$ | ||
45 | \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$} | ||
46 | $endif$ | ||
47 | $if(CJKmainfont)$ | ||
48 | \usepackage{xeCJK} | ||
49 | \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$} | ||
50 | $endif$ | ||
51 | \fi | ||
52 | $if(theme)$ | ||
53 | \usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$} | ||
54 | $endif$ | ||
55 | $if(colortheme)$ | ||
56 | \usecolortheme{$colortheme$} | ||
57 | $endif$ | ||
58 | $if(fonttheme)$ | ||
59 | \usefonttheme{$fonttheme$} | ||
60 | $endif$ | ||
61 | $if(mainfont)$ | ||
62 | \usefonttheme{serif} % use mainfont rather than sansfont for slide text | ||
63 | $endif$ | ||
64 | $if(innertheme)$ | ||
65 | \useinnertheme{$innertheme$} | ||
66 | $endif$ | ||
67 | $if(outertheme)$ | ||
68 | \useoutertheme{$outertheme$} | ||
69 | $endif$ | ||
70 | % use upquote if available, for straight quotes in verbatim environments | ||
71 | \IfFileExists{upquote.sty}{\usepackage{upquote}}{} | ||
72 | % use microtype if available | ||
73 | \IfFileExists{microtype.sty}{% | ||
74 | \usepackage{microtype} | ||
75 | \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts | ||
76 | }{} | ||
77 | $if(lang)$ | ||
78 | \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex | ||
79 | \usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel} | ||
80 | $if(babel-newcommands)$ | ||
81 | $babel-newcommands$ | ||
82 | $endif$ | ||
83 | \else | ||
84 | \usepackage{polyglossia} | ||
85 | \setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$} | ||
86 | $for(polyglossia-otherlangs)$ | ||
87 | \setotherlanguage[$polyglossia-otherlangs.options$]{$polyglossia-otherlangs.name$} | ||
88 | $endfor$ | ||
89 | \fi | ||
90 | $endif$ | ||
91 | \newif\ifbibliography | ||
92 | $if(natbib)$ | ||
93 | \usepackage{natbib} | ||
94 | \bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$} | ||
95 | $endif$ | ||
96 | $if(biblatex)$ | ||
97 | \usepackage[$if(biblio-style)$style=$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex} | ||
98 | $for(bibliography)$ | ||
99 | \addbibresource{$bibliography$} | ||
100 | $endfor$ | ||
101 | $endif$ | ||
102 | $if(verbatim-in-note)$ | ||
103 | \usepackage{fancyvrb} | ||
104 | $endif$ | ||
105 | \hypersetup{ | ||
106 | $if(title-meta)$ | ||
107 | pdftitle={$title-meta$}, | ||
108 | $endif$ | ||
109 | $if(author-meta)$ | ||
110 | pdfauthor={$author-meta$}, | ||
111 | $endif$ | ||
112 | $if(keywords)$ | ||
113 | pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$}, | ||
114 | $endif$ | ||
115 | $if(colorlinks)$ | ||
116 | colorlinks=true, | ||
117 | linkcolor=$if(linkcolor)$$linkcolor$$else$Maroon$endif$, | ||
118 | citecolor=$if(citecolor)$$citecolor$$else$Blue$endif$, | ||
119 | urlcolor=$if(urlcolor)$$urlcolor$$else$Blue$endif$, | ||
120 | $else$ | ||
121 | pdfborder={0 0 0}, | ||
122 | $endif$ | ||
123 | breaklinks=true} | ||
124 | \urlstyle{same} % don't use monospace font for urls | ||
125 | $if(verbatim-in-note)$ | ||
126 | \VerbatimFootnotes % allows verbatim text in footnotes | ||
127 | $endif$ | ||
128 | $if(listings)$ | ||
129 | \usepackage{listings} | ||
130 | $endif$ | ||
131 | $if(lhs)$ | ||
132 | \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{} | ||
133 | $endif$ | ||
134 | $if(highlighting-macros)$ | ||
135 | $highlighting-macros$ | ||
136 | $endif$ | ||
137 | $if(tables)$ | ||
138 | \usepackage{longtable,booktabs} | ||
139 | \usepackage{caption} | ||
140 | % These lines are needed to make table captions work with longtable: | ||
141 | \makeatletter | ||
142 | \def\fnum@table{\tablename~\thetable} | ||
143 | \makeatother | ||
144 | $endif$ | ||
145 | $if(graphics)$ | ||
146 | \usepackage{graphicx,grffile} | ||
147 | \makeatletter | ||
148 | \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} | ||
149 | \def\maxheight{\ifdim\Gin@nat@height>\textheight0.8\textheight\else\Gin@nat@height\fi} | ||
150 | \makeatother | ||
151 | % Scale images if necessary, so that they will not overflow the page | ||
152 | % margins by default, and it is still possible to overwrite the defaults | ||
153 | % using explicit options in \includegraphics[width, height, ...]{} | ||
154 | \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} | ||
155 | $endif$ | ||
156 | |||
157 | % Prevent slide breaks in the middle of a paragraph: | ||
158 | \widowpenalties 1 10000 | ||
159 | \raggedbottom | ||
160 | |||
161 | $if(section-titles)$ | ||
162 | \AtBeginPart{ | ||
163 | \let\insertpartnumber\relax | ||
164 | \let\partname\relax | ||
165 | \frame{\partpage} | ||
166 | } | ||
167 | \AtBeginSection{ | ||
168 | \ifbibliography | ||
169 | \else | ||
170 | \let\insertsectionnumber\relax | ||
171 | \let\sectionname\relax | ||
172 | \frame{\sectionpage} | ||
173 | \fi | ||
174 | } | ||
175 | \AtBeginSubsection{ | ||
176 | \let\insertsubsectionnumber\relax | ||
177 | \let\subsectionname\relax | ||
178 | \frame{\subsectionpage} | ||
179 | } | ||
180 | $endif$ | ||
181 | |||
182 | $if(links-as-notes)$ | ||
183 | % Make links footnotes instead of hotlinks: | ||
184 | \renewcommand{\href}[2]{#2\footnote{\url{#1}}} | ||
185 | $endif$ | ||
186 | $if(strikeout)$ | ||
187 | \usepackage[normalem]{ulem} | ||
188 | % avoid problems with \sout in headers with hyperref: | ||
189 | \pdfstringdefDisableCommands{\renewcommand{\sout}{}} | ||
190 | $endif$ | ||
191 | \setlength{\parindent}{0pt} | ||
192 | \setlength{\parskip}{6pt plus 2pt minus 1pt} | ||
193 | \setlength{\emergencystretch}{3em} % prevent overfull lines | ||
194 | \providecommand{\tightlist}{% | ||
195 | \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} | ||
196 | $if(numbersections)$ | ||
197 | \setcounter{secnumdepth}{$if(secnumdepth)$$secnumdepth$$else$5$endif$} | ||
198 | $else$ | ||
199 | \setcounter{secnumdepth}{0} | ||
200 | $endif$ | ||
201 | $if(dir)$ | ||
202 | \ifxetex | ||
203 | % load bidi as late as possible as it modifies e.g. graphicx | ||
204 | $if(latex-dir-rtl)$ | ||
205 | \usepackage[RTLdocument]{bidi} | ||
206 | $else$ | ||
207 | \usepackage{bidi} | ||
208 | $endif$ | ||
209 | \fi | ||
210 | \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex | ||
211 | \TeXXeTstate=1 | ||
212 | \newcommand{\RL}[1]{\beginR #1\endR} | ||
213 | \newcommand{\LR}[1]{\beginL #1\endL} | ||
214 | \newenvironment{RTL}{\beginR}{\endR} | ||
215 | \newenvironment{LTR}{\beginL}{\endL} | ||
216 | \fi | ||
217 | $endif$ | ||
218 | $for(header-includes)$ | ||
219 | $header-includes$ | ||
220 | $endfor$ | ||
221 | |||
222 | $if(title)$ | ||
223 | \title{$title$} | ||
224 | $endif$ | ||
225 | $if(subtitle)$ | ||
226 | \subtitle{$subtitle$} | ||
227 | $endif$ | ||
228 | $if(author)$ | ||
229 | \author{$for(author)$$author$$sep$ \and $endfor$} | ||
230 | $endif$ | ||
231 | $if(institute)$ | ||
232 | \institute{$for(institute)$$institute$$sep$ \and $endfor$} | ||
233 | $endif$ | ||
234 | \date{$date$} | ||
235 | |||
236 | \begin{document} | ||
237 | $if(title)$ | ||
238 | \frame{\titlepage} | ||
239 | $endif$ | ||
240 | |||
241 | $for(include-before)$ | ||
242 | $include-before$ | ||
243 | |||
244 | $endfor$ | ||
245 | $if(toc)$ | ||
246 | \begin{frame} | ||
247 | \tableofcontents[hideallsubsections] | ||
248 | \end{frame} | ||
249 | |||
250 | $endif$ | ||
251 | $body$ | ||
252 | |||
253 | $if(natbib)$ | ||
254 | $if(bibliography)$ | ||
255 | $if(biblio-title)$ | ||
256 | $if(book-class)$ | ||
257 | \renewcommand\bibname{$biblio-title$} | ||
258 | $else$ | ||
259 | \renewcommand\refname{$biblio-title$} | ||
260 | $endif$ | ||
261 | $endif$ | ||
262 | \begin{frame}[allowframebreaks]{$biblio-title$} | ||
263 | \bibliographytrue | ||
264 | \bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$} | ||
265 | \end{frame} | ||
266 | |||
267 | $endif$ | ||
268 | $endif$ | ||
269 | $if(biblatex)$$if(bibliography)$ | ||
270 | \begin{frame}[allowframebreaks]{$biblio-title$} | ||
271 | \bibliographytrue | ||
272 | \printbibliography[heading=none] | ||
273 | \end{frame} | ||
274 | |||
275 | $endif$$endif$ | ||
276 | $for(include-after)$ | ||
277 | $include-after$ | ||
278 | |||
279 | $endfor$ | ||
280 | \end{document} | ||
diff --git a/gup/pdf.gup b/gup/pdf.gup index 96f46ca..103aadb 100755 --- a/gup/pdf.gup +++ b/gup/pdf.gup | |||
@@ -18,8 +18,17 @@ cleanup() { | |||
18 | } | 18 | } |
19 | trap cleanup EXIT | 19 | trap cleanup EXIT |
20 | 20 | ||
21 | base=(${2%.pdf}.(md|lhs|tex)([1])) | 21 | typeset -a beamerAspects |
22 | metadata=(${2%.pdf}.meta.yml([1]N)) | 22 | beamerAspects=(43 169) |
23 | beamerAspect=beamerAspects[1] | ||
24 | |||
25 | if [[ $beamerAspects[(i)${2:r:e}] -le $#beamerAspects ]]; then | ||
26 | beamerAspect=${2:r:e} | ||
27 | 2=${2:r:r}.${2:e} | ||
28 | fi | ||
29 | |||
30 | base=(${2:r}.(md|lhs|tex)([1])) | ||
31 | metadata=(${2:r}.meta.yml([1]N)) | ||
23 | 32 | ||
24 | gup -u ${base} ${metadata} preamble.tex | 33 | gup -u ${base} ${metadata} preamble.tex |
25 | 34 | ||
@@ -39,18 +48,25 @@ if [[ -n ${metadata} ]]; then | |||
39 | input=$(mktemp) | 48 | input=$(mktemp) |
40 | cleanupList+=("rm -v ${input}") | 49 | cleanupList+=("rm -v ${input}") |
41 | 50 | ||
51 | typeset -a class | ||
52 | class=() | ||
53 | [[ ${base:e} == "tex" ]] && class=(-f latex) | ||
54 | |||
42 | logged pandoc -f markdown -t native -s ${metadata} | head -n -1 >>${input} | 55 | logged pandoc -f markdown -t native -s ${metadata} | head -n -1 >>${input} |
43 | logged pandoc -R -t native ${base} >>${input} | 56 | logged pandoc -R ${class} -t native ${base} >>${input} |
44 | 57 | ||
45 | extraArgs+=(-f native) | 58 | extraArgs+=(-f native) |
46 | fi | 59 | fi |
47 | 60 | ||
48 | # logged pandoc ${extraArgs} -t latex ${base} | cat -n >&2 | ||
49 | |||
50 | compileDir=$(mktemp -d) | 61 | compileDir=$(mktemp -d) |
51 | cleanupList+=("cd /" "rm -rfv ${compileDir}") | 62 | cleanupList+=("cd /" "rm -rfv ${compileDir}") |
52 | 63 | ||
53 | logged pandoc ${extraArgs} -t latex -o ${compileDir}/${base:t:r}.tex ${input} >&2 | 64 | if [[ ${base:t:r} == "presentation" ]]; then |
65 | gup -u ${buildDir}/beamer-template.tex | ||
66 | extraArgs+=(--template=${buildDir}/beamer-template.tex -M "aspectratio=${beamerAspect}") | ||
67 | fi | ||
68 | |||
69 | logged pandoc ${extraArgs} -o ${compileDir}/${base:t:r}.tex ${input} >&2 | ||
54 | 70 | ||
55 | cd ${compileDir} | 71 | cd ${compileDir} |
56 | for f (bib); do | 72 | for f (bib); do |
@@ -59,6 +75,8 @@ for f (bib); do | |||
59 | logged rsync -av ${base:h}/${f} . | 75 | logged rsync -av ${base:h}/${f} . |
60 | done | 76 | done |
61 | 77 | ||
78 | # cat -n ${base:t:r}.tex >&2 | ||
79 | |||
62 | max=5 | 80 | max=5 |
63 | runs=0 | 81 | runs=0 |
64 | run=true | 82 | run=true |
diff --git a/preamble.tex b/preamble.tex index 183313b..369abf6 100644 --- a/preamble.tex +++ b/preamble.tex | |||
@@ -97,23 +97,25 @@ keywordstyle= | |||
97 | {}% header specification (empty for default) | 97 | {}% header specification (empty for default) |
98 | \makeatother | 98 | \makeatother |
99 | 99 | ||
100 | \theoremstyle{definition.indented} | 100 | \makeatletter |
101 | \@ifclassloaded{article}{\theoremstyle{definition.indented}}{\theoremstyle{definition}} | ||
101 | \newtheorem{defn}{\GetTranslation{thm-definition}} | 102 | \newtheorem{defn}{\GetTranslation{thm-definition}} |
102 | \newtheorem*{defn*}{\GetTranslation{thm-definition}} | 103 | \newtheorem*{defn*}{\GetTranslation{thm-definition}} |
103 | 104 | ||
104 | \theoremstyle{plain.indented} | 105 | \@ifclassloaded{article}{\theoremstyle{plain.indented}}{\theoremstyle{plain}} |
105 | \newtheorem{thm}{\GetTranslation{thm-theorem}} | 106 | \newtheorem{thm}{\GetTranslation{thm-theorem}} |
106 | \newtheorem*{thm*}{\GetTranslation{thm-theorem}} | 107 | \newtheorem*{thm*}{\GetTranslation{thm-theorem}} |
107 | \newtheorem{lem}[thm]{\GetTranslation{thm-lemma}} | 108 | \newtheorem{lem}[thm]{\GetTranslation{thm-lemma}} |
108 | \newtheorem*{lem*}{\GetTranslation{thm-lemma}} | 109 | \newtheorem*{lem*}{\GetTranslation{thm-lemma}} |
109 | 110 | ||
110 | \theoremstyle{remark.indented} | 111 | \@ifclassloaded{article}{\theoremstyle{remark.indented}}{\theoremstyle{remark}} |
111 | \newtheorem{rem}{\GetTranslation{thm-remark}} | 112 | \newtheorem{rem}{\GetTranslation{thm-remark}} |
112 | \newtheorem*{rem*}{\GetTranslation{thm-remark}} | 113 | \newtheorem*{rem*}{\GetTranslation{thm-remark}} |
113 | \newtheorem{eg}[rem]{\GetTranslation{thm-example}} | 114 | \newtheorem{eg}[rem]{\GetTranslation{thm-example}} |
114 | \newtheorem*{eg*}{\GetTranslation{thm-example}} | 115 | \newtheorem*{eg*}{\GetTranslation{thm-example}} |
115 | \newtheorem*{sketch}{\GetTranslation{thm-proofsketch}} | 116 | \newtheorem*{sketch}{\GetTranslation{thm-proofsketch}} |
116 | \newtheorem*{tshow}{\GetTranslation{thm-show}} | 117 | \newtheorem*{tshow}{\GetTranslation{thm-show}} |
118 | \makeatother | ||
117 | 119 | ||
118 | \newcommand\restr[2]{{% we make the whole thing an ordinary symbol | 120 | \newcommand\restr[2]{{% we make the whole thing an ordinary symbol |
119 | \left.\kern-\nulldelimiterspace % automatically resize the bar with \right | 121 | \left.\kern-\nulldelimiterspace % automatically resize the bar with \right |
@@ -121,3 +123,10 @@ keywordstyle= | |||
121 | \vphantom{\big|} % pretend it's a little taller at normal size | 123 | \vphantom{\big|} % pretend it's a little taller at normal size |
122 | \right|_{#2} % this is the delimiter | 124 | \right|_{#2} % this is the delimiter |
123 | }} | 125 | }} |
126 | |||
127 | \makeatletter | ||
128 | \@ifclassloaded{article}{ | ||
129 | \usepackage{abstract} | ||
130 | \AtBeginDocument{\setlength{\absparindent}{0em}} | ||
131 | }{} | ||
132 | \makeatother | ||