jimbeamer 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jimbeamer/__init__.py +22 -0
- jimbeamer/__main__.py +5 -0
- jimbeamer/_version.py +4 -0
- jimbeamer/beamer.tex.tpl +215 -0
- jimbeamer/jimbeamer.py +2455 -0
- jimbeamer-0.1.0.dist-info/METADATA +971 -0
- jimbeamer-0.1.0.dist-info/RECORD +11 -0
- jimbeamer-0.1.0.dist-info/WHEEL +5 -0
- jimbeamer-0.1.0.dist-info/entry_points.txt +2 -0
- jimbeamer-0.1.0.dist-info/licenses/LICENSE +21 -0
- jimbeamer-0.1.0.dist-info/top_level.txt +1 -0
jimbeamer/__init__.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""Convert Markdown into LaTeX Beamer slides.
|
|
2
|
+
|
|
3
|
+
A lightweight alternative to `pandoc -t beamer', built on marko. The guiding
|
|
4
|
+
principle is LaTeX passthrough: whatever the Markdown parser does not
|
|
5
|
+
recognize is handed over to LaTeX untouched, so a slide can always fall back
|
|
6
|
+
to raw LaTeX.
|
|
7
|
+
|
|
8
|
+
The converter itself is jimbeamer.jimbeamer; this exposes only what a caller
|
|
9
|
+
needs, so that importing the package does not drag in marko until it is
|
|
10
|
+
wanted.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from jimbeamer._version import VERSION
|
|
14
|
+
|
|
15
|
+
__version__ = VERSION
|
|
16
|
+
__all__ = ['VERSION', '__version__', 'main']
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def main():
|
|
20
|
+
"""main() -> None: the command, as installed by pip."""
|
|
21
|
+
from jimbeamer.jimbeamer import main as run
|
|
22
|
+
run()
|
jimbeamer/__main__.py
ADDED
jimbeamer/_version.py
ADDED
jimbeamer/beamer.tex.tpl
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
%% Beamer template for jimbeamer.
|
|
2
|
+
%%
|
|
3
|
+
%% The variables below are filled in from the YAML metadata block at the top
|
|
4
|
+
%% of the Markdown source, or from -V. string.Template has no
|
|
5
|
+
%% conditionals, so build_variables() guarantees every variable below has a
|
|
6
|
+
%% value, falling back to a sane default when the metadata is silent.
|
|
7
|
+
|
|
8
|
+
\documentclass[$classoptions]{beamer}
|
|
9
|
+
|
|
10
|
+
\mode<presentation>
|
|
11
|
+
{
|
|
12
|
+
% metadata: theme, colortheme, fonttheme
|
|
13
|
+
% themes worth a try: Boadilla, CambridgeUS, Madrid
|
|
14
|
+
% colour themes: dolphin, seahorse
|
|
15
|
+
\usetheme{$theme}
|
|
16
|
+
\usecolortheme{$colortheme}
|
|
17
|
+
\usefonttheme{$fonttheme}
|
|
18
|
+
%\setbeamercovered{transparent}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
\setbeamertemplate{itemize item}[square]
|
|
22
|
+
\setbeamertemplate{itemize subitem}[triangle]
|
|
23
|
+
\setbeamertemplate{itemize subsubitem}[circle]
|
|
24
|
+
\setbeamertemplate{section in toc}[square]
|
|
25
|
+
\setbeamertemplate{navigation symbols}{}
|
|
26
|
+
|
|
27
|
+
%% An enumerate's label, in the square the themes call "projected": the
|
|
28
|
+
%% name is the beamer font and colour to set it in, which is what tells the
|
|
29
|
+
%% levels apart.
|
|
30
|
+
%%
|
|
31
|
+
%% This is beamer's own [square] template with the width measured from the
|
|
32
|
+
%% label rather than fixed at 2.25ex. Fixed, it has room for one character:
|
|
33
|
+
%% a list ten items long printed "10" across the edges of its square, and a
|
|
34
|
+
%% lettered one set "(iv)" the same way. A single character still gets the
|
|
35
|
+
%% same square it always did.
|
|
36
|
+
%% The square is beamer's, and so is this: [square] carries an [action]
|
|
37
|
+
%% setting 'item projected' to \scriptsize, which fired as a side effect of
|
|
38
|
+
%% asking for the option. Setting the templates below by hand loses the
|
|
39
|
+
%% action with it, and the labels fall back to the \tiny the font theme
|
|
40
|
+
%% gives them -- and since the box is measured in ex of that same font, the
|
|
41
|
+
%% square shrinks with the digit. This is that action, said out loud.
|
|
42
|
+
%% 'subitem projected' and 'subsubitem projected' inherit from it.
|
|
43
|
+
\setbeamerfont{item projected}{size=\scriptsize}
|
|
44
|
+
|
|
45
|
+
\newlength{\jbenumwidth}
|
|
46
|
+
\newcommand{\jbprojected}[2]{%
|
|
47
|
+
\hbox{%
|
|
48
|
+
\usebeamerfont*{#1}%
|
|
49
|
+
\usebeamercolor[bg]{#1}%
|
|
50
|
+
\settowidth{\jbenumwidth}{#2}%
|
|
51
|
+
\addtolength{\jbenumwidth}{.9ex}%
|
|
52
|
+
\ifdim\jbenumwidth<2.25ex\setlength{\jbenumwidth}{2.25ex}\fi%
|
|
53
|
+
\vrule width\jbenumwidth height1.85ex depth.4ex%
|
|
54
|
+
\hskip-\jbenumwidth%
|
|
55
|
+
\hbox to\jbenumwidth{\hfil\color{fg}#2\hfil}%
|
|
56
|
+
}%
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
\setbeamertemplate{enumerate item}{%
|
|
60
|
+
\jbprojected{item projected}{\insertenumlabel}}
|
|
61
|
+
\setbeamertemplate{enumerate subitem}{%
|
|
62
|
+
\jbprojected{subitem projected}{\insertsubenumlabel}}
|
|
63
|
+
\setbeamertemplate{enumerate subsubitem}{%
|
|
64
|
+
\jbprojected{subsubitem projected}{\insertsubsubenumlabel}}
|
|
65
|
+
|
|
66
|
+
%% A list that says how to count -- '(a)', 'a)', '(iv)' -- reaches beamer as
|
|
67
|
+
%% the optional argument of enumerate, and beamer sets those labels with the
|
|
68
|
+
%% "mini template" instead of the three above, whatever they are. The
|
|
69
|
+
%% themes make it a ball, so a lettered list came out in balls while the
|
|
70
|
+
%% numbered list beside it was in squares.
|
|
71
|
+
%%
|
|
72
|
+
%% One template serves all three levels, so it has to say which it is at.
|
|
73
|
+
%% \beameritemnestingprefix is the obvious answer and the wrong one: beamer
|
|
74
|
+
%% leaves it counting *every* list rather than the enumerates among
|
|
75
|
+
%% themselves, so a lettered list inside a bullet would take the second
|
|
76
|
+
%% level's colours while the same list written '1.' took the first -- two
|
|
77
|
+
%% lists at one level set differently by how the marker was written, which
|
|
78
|
+
%% is the mismatch this is all here to remove. \@enumdepth is the number
|
|
79
|
+
%% the three templates above are chosen by.
|
|
80
|
+
\makeatletter
|
|
81
|
+
\setbeamertemplate{enumerate mini template}{%
|
|
82
|
+
\ifnum\@enumdepth>2\relax
|
|
83
|
+
\jbprojected{subsubitem projected}{\insertenumlabel}%
|
|
84
|
+
\else\ifnum\@enumdepth>1\relax
|
|
85
|
+
\jbprojected{subitem projected}{\insertenumlabel}%
|
|
86
|
+
\else
|
|
87
|
+
\jbprojected{item projected}{\insertenumlabel}%
|
|
88
|
+
\fi\fi}
|
|
89
|
+
\makeatother
|
|
90
|
+
|
|
91
|
+
%% Separator slides carry the name alone. Beamer's own templates print
|
|
92
|
+
%% "Section 1" above it (\sectionname~\insertsectionnumber, then \vskip1em);
|
|
93
|
+
%% these are those templates with that line dropped, so the colours, fonts
|
|
94
|
+
%% and box of whatever theme is in use still apply.
|
|
95
|
+
\setbeamertemplate{part page}{%
|
|
96
|
+
\begingroup
|
|
97
|
+
\centering
|
|
98
|
+
\begin{beamercolorbox}[sep=16pt,center]{part title}
|
|
99
|
+
\usebeamerfont{part title}\insertpart\par
|
|
100
|
+
\end{beamercolorbox}
|
|
101
|
+
\endgroup
|
|
102
|
+
}
|
|
103
|
+
\setbeamertemplate{section page}{%
|
|
104
|
+
\begingroup
|
|
105
|
+
\centering
|
|
106
|
+
\begin{beamercolorbox}[sep=12pt,center]{section title}
|
|
107
|
+
\usebeamerfont{section title}\insertsection\par
|
|
108
|
+
\end{beamercolorbox}
|
|
109
|
+
\endgroup
|
|
110
|
+
}
|
|
111
|
+
\setbeamertemplate{subsection page}{%
|
|
112
|
+
\begingroup
|
|
113
|
+
\centering
|
|
114
|
+
\begin{beamercolorbox}[sep=8pt,center]{subsection title}
|
|
115
|
+
\usebeamerfont{subsection title}\insertsubsection\par
|
|
116
|
+
\end{beamercolorbox}
|
|
117
|
+
\endgroup
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
\usepackage{$fontfamily} % metadata: fontfamily
|
|
121
|
+
\usepackage{color}
|
|
122
|
+
\usepackage{graphicx}
|
|
123
|
+
\usepackage{xspace}
|
|
124
|
+
|
|
125
|
+
%% Fenced code blocks become lstlisting, so the package is not optional.
|
|
126
|
+
%% Settings come before header-includes, so that a \lstset of your own wins.
|
|
127
|
+
\usepackage{listings}
|
|
128
|
+
%% Straight quotes in code: without this, 'B' in a listing comes out as
|
|
129
|
+
%% typographic quotes, which is wrong for a character literal.
|
|
130
|
+
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
|
|
131
|
+
\lstset{
|
|
132
|
+
basicstyle=\ttfamily\small,
|
|
133
|
+
columns=fullflexible,
|
|
134
|
+
keepspaces=true,
|
|
135
|
+
showstringspaces=false,
|
|
136
|
+
upquote=true,
|
|
137
|
+
breaklines=true, % long lines wrap instead of running off the slide
|
|
138
|
+
breakatwhitespace=false,
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
\newcommand{\ol}[1]{\textcolor{blue}{\ifmmode \text{[OL: #1]}\else [OL: #1] \fi}}
|
|
142
|
+
|
|
143
|
+
%% Emitted at the top of every tight list, i.e. one whose items are single
|
|
144
|
+
%% paragraphs. \providecommand so that a header-includes of your own wins.
|
|
145
|
+
\providecommand{\tightlist}{%
|
|
146
|
+
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
|
|
147
|
+
|
|
148
|
+
\newcommand{\hlbl}[1]{\textcolor{blue}{#1}}
|
|
149
|
+
\newcommand{\hlgr}[1]{\textcolor{olive!50!green}{#1}}
|
|
150
|
+
\newcommand{\hlrd}[1]{\textcolor{red}{#1}}
|
|
151
|
+
\newcommand{\hlorg}[1]{\textcolor{Orange}{#1}}
|
|
152
|
+
\newcommand{\hlgrey}[1]{\textcolor{black!50}{#1}}
|
|
153
|
+
\newcommand{\hldgr}[1]{\textcolor{olive!20!green}{#1}}
|
|
154
|
+
\newcommand{\hlvio}[1]{\textcolor[rgb]{0.7,0,0.35}{#1}}
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
160
|
+
\newcommand{\backupbegin}{
|
|
161
|
+
\newcounter{finalframe}
|
|
162
|
+
\setcounter{finalframe}{\value{framenumber}}
|
|
163
|
+
}
|
|
164
|
+
\newcommand{\backupend}{
|
|
165
|
+
\setcounter{framenumber}{\value{finalframe}}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
\newcommand{\xpause}[0]{\pause}
|
|
169
|
+
\newcommand{\pausex}[0]{\xpause}
|
|
170
|
+
|
|
171
|
+
%% metadata: handout. Empties \xpause, and with it \pausex, so that every
|
|
172
|
+
%% frame is one page. After the definitions above, since it redefines them.
|
|
173
|
+
$handout
|
|
174
|
+
|
|
175
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
176
|
+
%% metadata: section-titles. A separator slide for each sectioning level,
|
|
177
|
+
%% empty when switched off. Before header-includes, so that a deck defining
|
|
178
|
+
%% its own \AtBeginSection wins.
|
|
179
|
+
$sectionpages
|
|
180
|
+
|
|
181
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
182
|
+
%% metadata: header-includes. Last in the preamble, so that whatever it
|
|
183
|
+
%% pulls in (\input{macros.tex}, \input{stylesheet.tex}, ...) can override
|
|
184
|
+
%% what is set above.
|
|
185
|
+
$headerincludes
|
|
186
|
+
|
|
187
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
188
|
+
%% The bracketed forms are the short versions beamer puts in the footline.
|
|
189
|
+
%% metadata: title, short-title, author, short-author, institute,
|
|
190
|
+
%% short-institute, date, short-date
|
|
191
|
+
\title[$shorttitle]{$title}
|
|
192
|
+
%% Beamer skips the subtitle when it is empty, so this needs no condition.
|
|
193
|
+
\subtitle{$subtitle}
|
|
194
|
+
\author[$shortauthor]{$author}
|
|
195
|
+
\institute[$shortinstitute]{$institute}
|
|
196
|
+
\date[$shortdate]{$date}
|
|
197
|
+
|
|
198
|
+
\begin{document}
|
|
199
|
+
|
|
200
|
+
% Translation of some slides only: [label=current] in the frame header.
|
|
201
|
+
% \includeonlyframes{current}
|
|
202
|
+
|
|
203
|
+
%% Empty when the deck has no title, or sets 'titlepage: false'.
|
|
204
|
+
$titlepage
|
|
205
|
+
|
|
206
|
+
%% metadata: toc. Empty unless asked for.
|
|
207
|
+
$toc
|
|
208
|
+
|
|
209
|
+
$slides
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
\backupbegin
|
|
213
|
+
\backupend
|
|
214
|
+
|
|
215
|
+
\end{document}
|