From 8947d74f9519656804f0f34c8d2cf80afd3f0688 Mon Sep 17 00:00:00 2001 From: Johannes Schilling Date: Sun, 27 Oct 2013 22:43:22 +0100 Subject: [PATCH] extra packliste := verkleinerte teilnehmerliste --- teilnehmertool.py | 13 +++++--- templates/packliste.tex | 61 +++++++++++++++++++++++++++++++++++ templates/teilnehmerliste.tex | 4 +-- 3 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 templates/packliste.tex diff --git a/teilnehmertool.py b/teilnehmertool.py index 24e9921..74f0161 100755 --- a/teilnehmertool.py +++ b/teilnehmertool.py @@ -22,7 +22,7 @@ env = jinja2.Environment(loader=jinja2.FileSystemLoader('templates', encoding='u ## jinja2 TeX espaping from http://flask.pocoo.org/snippets/55/ LATEX_SUBS = [ - (re.compile(r'\\'), r'\\textbackslash'), + (re.compile(r'\\'), r'\\textbackslash{}'), (re.compile(r'([{}_#%&$])'), r'\\\1'), (re.compile(r'~'), r'\~{}'), (re.compile(r'\^'), r'\^{}'), @@ -200,11 +200,12 @@ def create_nametag(outdir='output'): def create_teilnehmer_list(outdir = 'output'): - template = env.get_template('teilnehmerliste.tex') + template_full = env.get_template('teilnehmerliste.tex') + template_pack = env.get_template('packliste.tex') teilnehmer = [] for vor, nach, nick, hochschule, betrag, bezahlt, shirtsize, zippersize, dochned, comment in \ - conn.execute("SELECT vorname, nachname, namensschild, hochschule, betrag, bezahlt, tshirt, zipper, dochned, orga_comment FROM teilnehmer ORDER BY UPPER(nachname) ASC"): + conn.execute("SELECT vorname, nachname, namensschild, hochschule, betrag, bezahlt, tshirt, zipper, dochned, orga_comment FROM teilnehmer ORDER BY UPPER(hochschule) ASC, UPPER(nachname) ASC"): vor = vor.decode('utf8') nach = nach.decode('utf8') @@ -225,6 +226,7 @@ def create_teilnehmer_list(outdir = 'output'): will_attend = True else: will_attend = False + comment = comment.decode('utf8') teilnehmer.append({'vorname': vor, 'nachname': nach, @@ -234,7 +236,10 @@ def create_teilnehmer_list(outdir = 'output'): with open(os.path.join(outdir, "teilnehmerliste.tex"), 'w') as out: - out.write(template.render(teilnehmer=teilnehmer).encode('utf-8')) + out.write(template_full.render(teilnehmer=teilnehmer).encode('utf-8')) + + with open(os.path.join(outdir, "packliste.tex"), 'w') as out: + out.write(template_pack.render(teilnehmer=teilnehmer).encode('utf-8')) diff --git a/templates/packliste.tex b/templates/packliste.tex new file mode 100644 index 0000000..afef56c --- /dev/null +++ b/templates/packliste.tex @@ -0,0 +1,61 @@ +\documentclass[a4paper,landscape]{scrartcl} + +\usepackage[left=1.2cm,right=2cm,top=1.5cm,bottom=2cm]{geometry} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[ngerman]{babel} + +\usepackage{color} + +\usepackage{amsmath,amsthm,amssymb} +\usepackage{mathtools} + +\usepackage{array} + +\usepackage{ytableau} + +\usepackage{enumerate} + +\usepackage{fancyhdr} +\pagestyle{fancy} + +\usepackage{booktabs} +\usepackage{multirow} + +\fancyhf{} +\chead{Teilnehmerliste KIF 41,5 Erlangen} +\cfoot{\thepage{}/\pageref{lastpage}} + +\usepackage{longtable} + +\setlength{\headheight}{28pt} +\addtolength{\textheight}{-28pt} + +\setlength{\parskip}{7pt} +\setlength{\parindent}{0pt} + +%% this took me an hour or so. hope it's worth it +\DeclareUnicodeCharacter{1ED1}{\resizebox{.80em}{!}{\resizebox{.4em}{!}{\^{o}}\hspace{-1mm}\'{}}\hspace{-1mm}{}} +%% easier unicode characters +\DeclareUnicodeCharacter{03B2}{$\beta$} + +\begin{document} + +\begin{center} + \begin{longtable}{|m{.2\textwidth}|m{.2\textwidth}|m{.07\textwidth}|m{.08\textwidth}|m{.5\textwidth}|} + \textbf{Uni} & \textbf{Nickname} & \textbf{Tshirt} & \textbf{Zipper} & \textbf{Bemerkungen} \\ + \hline + \hline + \endhead +{% for t in teilnehmer %}% +{% if t['will_attend'] %}% + {{ t['hochschule'] | escape_tex }} & {{ t['nick'] | escape_tex }} & {{ t['shirtsize'] | escape_tex }} & {{ t['zippersize'] | escape_tex }} & {{ t['comment'] | escape_tex }} \\ +{% endif %}% + \hline{% endfor %} + \end{longtable} +\end{center} + + +\label{lastpage} +\end{document} diff --git a/templates/teilnehmerliste.tex b/templates/teilnehmerliste.tex index c5337a6..cda00d3 100644 --- a/templates/teilnehmerliste.tex +++ b/templates/teilnehmerliste.tex @@ -52,9 +52,7 @@ \endhead {% for t in teilnehmer %}% {% if t['will_attend'] %}% - {{ t['vorname'] | escape_tex }} & {{ t['nachname'] | escape_tex }} & {{ t['nick'] | escape_tex }} & {{ - t['hochschule'] | escape_tex }} & {{ t['betrag'] }} & {{ t['bezahlt'] }} & \vspace{1em} & {{ - t['shirtsize'] | escape_tex }} & {{ t['zippersize'] | escape_tex }} & {{ t['comment'] }} \\ + {{ t['vorname'] | escape_tex }} & {{ t['nachname'] | escape_tex }} & {{ t['nick'] | escape_tex }} & {{ t['hochschule'] | escape_tex }} & {{ t['betrag'] }} & {{ t['bezahlt'] }} & \vspace{1em} & {{ t['shirtsize'] | escape_tex }} & {{ t['zippersize'] | escape_tex }} & {{ t['comment'] | escape_tex}} \\ {% endif %}% \hline{% endfor %} \end{longtable} -- 2.39.2