This commit is contained in:
Dominic Grimm 2024-09-30 11:40:32 +02:00
commit f14440fec0
10 changed files with 497 additions and 0 deletions

309
.gitignore vendored Normal file
View file

@ -0,0 +1,309 @@
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
*.cb
*.cb2
.*.lb
## Intermediate documents:
*.dvi
*.xdv
*-converted-to.*
# these rules might exclude image files for figures etc.
# *.ps
# *.eps
# *.pdf
## Generated if empty string is given at "Please type another file name for output:"
.pdf
## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
*-blx.aux
*-blx.bib
*.run.xml
## Build tool auxiliary files:
*.fdb_latexmk
*.synctex
*.synctex(busy)
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync
*.rubbercache
rubber.cache
## Build tool directories for auxiliary files
# latexrun
latex.out/
## Auxiliary and intermediate files from other packages:
# algorithms
*.alg
*.loa
# achemso
acs-*.bib
# amsthm
*.thm
# beamer
*.nav
*.pre
*.snm
*.vrb
# changes
*.soc
# comment
*.cut
# cprotect
*.cpt
# elsarticle (documentclass of Elsevier journals)
*.spl
# endnotes
*.ent
# fixme
*.lox
# feynmf/feynmp
*.mf
*.mp
*.t[1-9]
*.t[1-9][0-9]
*.tfm
#(r)(e)ledmac/(r)(e)ledpar
*.end
*.?end
*.[1-9]
*.[1-9][0-9]
*.[1-9][0-9][0-9]
*.[1-9]R
*.[1-9][0-9]R
*.[1-9][0-9][0-9]R
*.eledsec[1-9]
*.eledsec[1-9]R
*.eledsec[1-9][0-9]
*.eledsec[1-9][0-9]R
*.eledsec[1-9][0-9][0-9]
*.eledsec[1-9][0-9][0-9]R
# glossaries
*.acn
*.acr
*.glg
*.glo
*.gls
*.glsdefs
*.lzo
*.lzs
*.slg
*.slo
*.sls
# uncomment this for glossaries-extra (will ignore makeindex's style files!)
# *.ist
# gnuplot
*.gnuplot
*.table
# gnuplottex
*-gnuplottex-*
# gregoriotex
*.gaux
*.glog
*.gtex
# htlatex
*.4ct
*.4tc
*.idv
*.lg
*.trc
*.xref
# hypdoc
*.hd
# hyperref
*.brf
# knitr
*-concordance.tex
# TODO Uncomment the next line if you use knitr and want to ignore its generated tikz files
# *.tikz
*-tikzDictionary
# listings
*.lol
# luatexja-ruby
*.ltjruby
# makeidx
*.idx
*.ilg
*.ind
# minitoc
*.maf
*.mlf
*.mlt
*.mtc[0-9]*
*.slf[0-9]*
*.slt[0-9]*
*.stc[0-9]*
# minted
_minted*
*.pyg
# morewrites
*.mw
# newpax
*.newpax
# nomencl
*.nlg
*.nlo
*.nls
# pax
*.pax
# pdfpcnotes
*.pdfpc
# sagetex
*.sagetex.sage
*.sagetex.py
*.sagetex.scmd
# scrwfile
*.wrt
# svg
svg-inkscape/
# sympy
*.sout
*.sympy
sympy-plots-for-*.tex/
# pdfcomment
*.upa
*.upb
# pythontex
*.pytxcode
pythontex-files-*/
# tcolorbox
*.listing
# thmtools
*.loe
# TikZ & PGF
*.dpth
*.md5
*.auxlock
# titletoc
*.ptc
# todonotes
*.tdo
# vhistory
*.hst
*.ver
# easy-todo
*.lod
# xcolor
*.xcp
# xmpincl
*.xmpi
# xindy
*.xdy
# xypic precompiled matrices and outlines
*.xyc
*.xyd
# endfloat
*.ttt
*.fff
# Latexian
TSWLatexianTemp*
## Editors:
# WinEdt
*.bak
*.sav
# Texpad
.texpadtmp
# LyX
*.lyx~
# Kile
*.backup
# gummi
.*.swp
# KBibTeX
*~[0-9]*
# TeXnicCenter
*.tps
# auto folder when using emacs and auctex
./auto/*
*.el
# expex forward references with \gathertags
*-tags.tex
# standalone packages
*.sta
# Makeindex log files
*.lpz
# xwatermark package
*.xwm
# REVTeX puts footnotes in the bibliography by default, unless the nofootinbib
# option is specified. Footnotes are the stored in a file with suffix Notes.bib.
# Uncomment the next line to have this generated file ignored.
#*Notes.bib
stimmzettel.pdf
data/*

9
LICENSE Normal file
View file

@ -0,0 +1,9 @@
MIT License
Copyright (c) 2024 Dominic Grimm
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1
README.md Normal file
View file

@ -0,0 +1 @@
# smv-stimmzettel

3
data.csv Normal file
View file

@ -0,0 +1,3 @@
name,givenname,year,class
Mustermann, Max, 10, a
Musterfrau, Erika, KS 2
1 name,givenname,year,class
2 Mustermann, Max, 10, a
3 Musterfrau, Erika, KS 2

BIN
img/ohg.pdf Normal file

Binary file not shown.

1
img/ohg.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 24 KiB

BIN
img/smv_neu.pdf Normal file

Binary file not shown.

BIN
img/smv_neu_bw.pdf Normal file

Binary file not shown.

4
sort.sh Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
cat "$1" | (read -r; printf "%s\n" "$REPLY"; sort -t"," -k3,3r -k4,4 -k1,1 -k2,2) > "$1.sorted" && mv "$1.sorted" "$1"

170
stimmzettel.tex Normal file
View file

@ -0,0 +1,170 @@
\documentclass[a5paper]{article}
\usepackage[ngerman]{babel}
\usepackage{hyphenat}
\hyphenation{Mathe-matik wieder-gewinnen}
\usepackage{fontspec}
\setmainfont{Liberation Sans}
\usepackage[table]{xcolor}
\usepackage[portrait,margin=0cm]{geometry} % ,showframe
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{array}
\usepackage{tabularx}
\usepackage{csvsimple}
\usepackage{adjustbox}
\usepackage{booktabs}
\usepackage{intcalc}
\usepackage{pgffor}
\usepackage{hyperref}
%\usepackage{fancyhdr}
\usepackage{pgfpages}
\pgfpagesuselayout{2 on 1}[a4paper,landscape,border shrink=1cm]
\usepackage{atbegshi}
\AtBeginShipout{
\pgfpagesshipoutlogicalpage{1}\copy\AtBeginShipoutBox
\pgfpagesshipoutlogicalpage{2}\box\AtBeginShipoutBox
\pgfshipoutphysicalpage
}
\pagestyle{empty}
%\pagestyle{fancy}
%\fancyhf{}
%\renewcommand{\headrulewidth}{0pt}
%\fancyfoot[C]{Powered by \LaTeX}
\setlength{\parindent}{0pt}
\def\persiderowcount{22}
\newcommand{\stimmzettel}[2]{
\noindent
\begin{minipage}[t]{0.49\textwidth}
\vspace{-\fboxsep}
\includegraphics[width=\textwidth]{img/ohg.pdf}
\end{minipage}
\begin{minipage}[t]{0.49\textwidth}
\vspace{-\fboxsep}
\hspace*{0pt}\hfill
\includegraphics[width=0.3\textwidth]{img/smv_neu.pdf}
\end{minipage}
\medskip\medskip\medskip
\begin{center}
\textbf{\LARGE Stimmzettel} \\
{\large für die \underline{\textbf{#1:in}}-Wahl des Otto-Hahn-Gymnasiums} \\
\medskip\medskip
{\large Sie haben \textbf{\LARGE 1} Stimme}
\end{center}
\medskip
\csvreader{#2}{}{}
\edef\totalrows{\thecsvrow}
\edef\colcount{\intcalcDiv{\totalrows}{\persiderowcount}}
\edef\colcount{\intcalcAdd{\colcount}{\ifnum\intcalcMod{\totalrows}{\persiderowcount}>0 1 \else 0 \fi}}
\edef\colwidth{
\ifnum\colcount=0
0
\else\ifnum\colcount=1
1
\else\ifnum\colcount=2
0.49
\else
0
\fi\fi\fi
}
\ifnum\colcount>0
\foreach \n in {0,...,\intcalcSub{\colcount}{1}}{
\noindent
\begin{minipage}[t]{\colwidth\textwidth}
\vspace{-\fboxsep}
\def\arraystretch{2}
\ifnum\totalrows>2
\rowcolors{2}{gray!10}{white}
\fi
\edef\rowcountstart{\intcalcMul{\n}{\persiderowcount}}
\begin{tabularx}{\linewidth}{|r|X|l|>{\centering\arraybackslash}c|}
\rowcolor{white}
\toprule
\multicolumn{1}{r}{\large\textbf{\#}} &
\multicolumn{1}{l}{\large\textbf{Kandidaten}} &
\multicolumn{1}{l}{\large\textbf{Klasse}} &
\multicolumn{1}{c}{
\adjustbox{valign=t}{
\begin{tikzpicture}
\draw (0,0.4) circle(2mm);
\draw (-0.1,0.5) -- (0.1,0.3);
\draw (-0.1,0.3) -- (0.1,0.5);
\end{tikzpicture}}
}
\\
\rowcolor{white}
\bottomrule
\multicolumn{1}{r}{} &
\multicolumn{1}{l}{} &
\multicolumn{1}{l}{} &
\multicolumn{1}{l}{}
\\
\hline
\csvreader[
head to column names,
late after line={\\ \hline},
filter expr={
test{\ifnumgreater{\thecsvinputline-1}{\rowcountstart}}
and test{\ifnumless{\thecsvinputline-1}{\rowcountstart+\persiderowcount+1}}
}
]{#2}{}
{
\large\textbf{\the\numexpr\rowcountstart+\thecsvrow-\n\relax.} &
\large\ifthenelse{\equal{\name}{}}{\givenname}{\givenname~\name} &
\large\year~\class &
\adjustbox{valign=c}{
\begin{tikzpicture}[inner sep=0pt, outer sep=0pt]
\draw[black, fill=white] (0,0) circle(2mm);
\end{tikzpicture}
}
}
\end{tabularx}
\end{minipage}
\hfill
}
\fi
}
\begin{document}
\stimmzettel{Unterstufensprecher}{data/unterstufensprecher.csv}
\newpage
\stimmzettel{Mittelstufensprecher}{data/mittelstufensprecher.csv}
\newpage
\stimmzettel{Realschulsprecher}{data/realschulsprecher.csv}
\newpage
\stimmzettel{Schulsprecher}{data/schulsprecher.csv}
\newpage
\begin{center}
\topskip0pt
\vspace*{\fill}
\textbf{\Large\href{https://git.dergrimm.net/dergrimm/smv-stimmzettel.git}{https://git.dergrimm.net/dergrimm/smv-stimmzettel.git}}
\vspace*{\fill}
\end{center}
\end{document}