-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_latex.py
55 lines (42 loc) · 963 Bytes
/
create_latex.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python3
import sys
names = sys.argv[1:]
if len(sys.argv) == 1:
# Print usage
print("Usage: create_latex.py [<size>] <name> [<name> ...] > <output.tex>")
exit(1)
# Hacky way of providing a size input
try:
size = int(names[0])
names = names[1:]
except:
size = 38
test_names = [
"Alice",
"Bob",
"Charlie",
"Dave",
"Ellen",
"Frank"]
header = r"""
\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{multicol}
\begin{document}
%\begin{multicols}{2}
\begin{center}
"""
footer = r"""
\end{center}
%\end{multicols}
\end{document}
"""
def badge_entry(name: str):
pic = r"\includegraphics[width=%imm, height=%imm]{logo.pdf}"%(size, size)
label = r"\vspace{%gmm}\textbf{\textsf{\Huge %s}}"%(-size/2-3.5, name)
space = r"\vspace{%imm}"%size
return "\n".join(["", pic, "", label, "", space, ""])
print(header)
for name in names:
print(badge_entry(name))
print(footer)