-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgen_watermark.py
More file actions
27 lines (23 loc) · 847 Bytes
/
gen_watermark.py
File metadata and controls
27 lines (23 loc) · 847 Bytes
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
# Generates a "draft" watermark for LaTeX
#
# @author Connor Henley, @thatging3rkid
import datetime
import subprocess
def main():
# first, print some debugging infro
print("%%% watermark.tex\n%%%\n%%% Generated by gen_watermark.py on " + str(datetime.datetime.now()) + "\n")
# next, get the git branch
git_branch = "*branch\\_error*"
try:
git_branch = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]).strip().decode("utf-8")
except:
pass
# finally, print the watermark text
if git_branch != "master":
print("\\usepackage{draftwatermark}")
print("\\SetWatermarkText{\\texttt{DRAFT}}")
print("\\SetWatermarkLightness{0.85}")
print("\\SetWatermarkScale{1.58}") # note: scale depends on font choice
pass
if __name__ == "__main__":
main()