You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
1.9 KiB
72 lines
1.9 KiB
from datetime import timedelta
|
|
from datetime import date
|
|
import locale
|
|
|
|
def tex_write_year_overview(fd,year):
|
|
fd.write('''
|
|
|
|
\\thispagestyle{empty}
|
|
\\vspace*{-4em}
|
|
\\begin{center}
|
|
\\Huge\\textbf{Jahres\\"ubersicht\\ ''')
|
|
fd.write(str(year))
|
|
fd.write('''}
|
|
\\end{center}
|
|
\\vspace*{-8pt}
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
% begin overview calender''')
|
|
for month in range(1, 12 + 1):
|
|
m = date(year, month, 1)
|
|
|
|
if (month - 1) % 2 == 0 and month != 1:
|
|
fd.write('\\newline')
|
|
|
|
fd.write('''
|
|
\\begin{minipage}[t]{0.5\\textwidth}
|
|
''')
|
|
fd.write('''
|
|
\\begin{tabular}{ccccc|cc||}
|
|
''')
|
|
fd.write('\\multicolumn{6}{c}{\\textbf{ ' + m.strftime('%B') + '}}\\\\\n ')
|
|
|
|
# print weeknames
|
|
for i in range(0, 6 + 1):
|
|
curr_date = date(year, month, 1)
|
|
curr_date = curr_date + timedelta(days=i - curr_date.weekday())
|
|
|
|
fd.write('\\textbf{' + curr_date.strftime('%a') + '} ')
|
|
if i == 6:
|
|
fd.write('\\\\\n\r')
|
|
fd.write(' \\hline\n\r')
|
|
else:
|
|
fd.write(' & ')
|
|
|
|
|
|
# monthly numbers
|
|
curr_date = date(year, month, 1)
|
|
weekline = " " + " &" * curr_date.weekday()
|
|
next_date = curr_date
|
|
while curr_date.month == next_date.month:
|
|
curr_date = next_date
|
|
next_date = curr_date + timedelta(days=1)
|
|
|
|
weekline = weekline + " " + str(curr_date.day)
|
|
if (curr_date.weekday() == 6): # sunday
|
|
weekline = weekline + "\\\\\n "
|
|
else:
|
|
weekline = weekline + "&"
|
|
|
|
weekline = weekline + (" &" * (5 - curr_date.weekday())) + "\\\\\n\r"
|
|
|
|
fd.write(weekline)
|
|
|
|
fd.write('''
|
|
\\end{tabular}
|
|
\\end{minipage}''')
|
|
# if (month == 6):
|
|
# fd.write('\\newpage\n\r')
|
|
|
|
fd.write('''
|
|
% end overview calender
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
''')
|