## 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'\^{}'),
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')
will_attend = True
else:
will_attend = False
+
comment = comment.decode('utf8')
teilnehmer.append({'vorname': vor, 'nachname': nach,
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'))
--- /dev/null
+\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}
\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}