Add generating declarations for contributions

This commit is contained in:
Filip Gralinski 2021-09-21 21:34:55 +02:00
parent 8e620bc9bc
commit 34c067e34c
6 changed files with 156 additions and 4 deletions

View File

@ -147,6 +147,8 @@ vcs.xml
*.ft
*.tdo
*.bcf
*.vrb
*.snm
*.lol
*.run.xml
/auto
@ -160,3 +162,5 @@ the-appendix.pdf
sentences.txt
arxiv-{{cookiecutter.paper_id}}.pdf
arxiv-{{cookiecutter.paper_id}}.tar.gz
helpers/*-contribution-declaration.tex
helpers/*-contribution-declaration.pdf

View File

@ -35,12 +35,12 @@ endif
CONTENT_TEX_SOURCES_WITH_DIR := $(addprefix $(CURRENT_DIR)/, $(CONTENT_TEX_SOURCES))
SCOREFILES=$(shell perl extract-score-files.pl $(CONTENT_TEX_SOURCES))
clean_latex_stuff=rm -rf *.aux *.nav *.toc *.log *.out *.blg *.bbl autozoil-log.txt autozoil.xml the-appendix.pdf supplement.zip $(PAPER_ID).pdf $(PAPER_ID).zip arxiv-$(PAPER_ID).pdf arxiv-$(PAPER_ID).tar.gz abstract.txt sentences.txt stats.txt $(EXTRA_PDFS)
clean_latex_stuff=rm -rf *.aux *.nav *.toc *.log *.out *.blg *.bbl autozoil-log.txt autozoil.xml the-appendix.pdf supplement.zip $(PAPER_ID).pdf $(PAPER_ID).zip arxiv-$(PAPER_ID).pdf arxiv-$(PAPER_ID).tar.gz abstract.txt sentences.txt stats.txt $(EXTRA_PDFS) helpers/$(PAPER_ID)-contribution-declaration.tex helpers/$(PAPER_ID)-contribution-declaration.pdf helpers/*.aux helpers/*.bbl helpers/*.bcf helpers/*.blg helpers/*.log helpers/*.run.xml
ifeq ($(HAS_SUPPLEMENT),yes)
all: $(PAPER_ID).pdf abstract.txt supplement.zip stats.txt sentences.txt
all: $(PAPER_ID).pdf abstract.txt supplement.zip stats.txt sentences.txt helpers/$(PAPER_ID)-contribution-declaration.pdf
else
all: $(PAPER_ID).pdf abstract.txt stats.txt sentences.txt
all: $(PAPER_ID).pdf abstract.txt stats.txt sentences.txt helpers/$(PAPER_ID)-contribution-declaration.pdf
endif
source-pack: $(PAPER_ID).zip
@ -104,5 +104,15 @@ titlepage.pdf: titlepage.tex
xelatex $<
endif
helpers/$(PAPER_ID)-contribution-declaration.pdf: helpers/$(PAPER_ID)-contribution-declaration.tex
(cd helpers && pdflatex $(PAPER_ID)-contribution-declaration.tex)
(cd helpers && biber $(PAPER_ID)-contribution-declaration)
(cd helpers && pdflatex $(PAPER_ID)-contribution-declaration.tex)
helpers/$(PAPER_ID)-contribution-declaration.tex: contributions.yaml helpers/contribution-declaration.tex.tmpl helpers/generate-contribution-declaration.py
(cd helpers && ./generate-contribution-declaration.py) < $< > $@
clean:
$(clean_latex_stuff)

View File

@ -1,3 +1,13 @@
% here the bibliographic entry for the paper itself should be given,
% used for generating declarations
@InProceedings{this-paper,
author="{{cookiecutter.paper_title}}",
title="{{cookiecutter.main_contributor_name}}",
year=2021
}
{% raw %}
@inproceedings{gralinski-etal-2019-geval,

View File

@ -3,10 +3,15 @@
title: {{cookiecutter.paper_title}}
authors:
- author: Jan Iksinski
- author: {{cookiecutter.main_contributor_name}}
level: 1
contributions:
- did this
- did that
- author: Józef Igrekowski
level: 1
contributions:
- did something else
- author: Adam Abacki
contributions:
- did something else

View File

@ -0,0 +1,88 @@
{% raw %}
\documentclass[a4paper]{article}
\usepackage{booktabs}
\usepackage{bibentry}
%\usepackage[style=verbose]{biblatex}
\usepackage[total={170mm,277mm}, left=20mm, top=10mm]{geometry}
\thispagestyle{empty}
\renewcommand{\labelitemi}{--}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage[backend=biber,maxnames=12]{biblatex}
\bibliography{../bibliography.bib}
\begin{document}
\begin{flushright}
{{tday}}
\end{flushright}
\medskip
\begin{center}
{\bf Declaration}
\end{center}
\bigskip
I hereby declare that the contribution to the following paper:
\smallskip
\fullcite{this-paper}
\smallskip
\noindent is correctly characterized in the table below{% if nb_of_levels == 0 %}.{% elif nb_of_levels == 1 %} ({{ level_symbols[0] }} denotes equal contributions).{% else %} ({% for lix in range(nb_of_levels) %}{% if lix == nb_of_levels - 1 %}{} and {{ level_symbols[lix] }}{} denote groups of equal contributions).{% elif lix == 0 %}{{ level_symbols[lix] }}{% else %}, {{ level_symbols[lix] }}{% endif %}{% endfor %}{% endif %}
\medskip
\begin{center}
\begin{longtable}{lc}
\toprule
\addlinespace[0.05cm]
Contributor & Description of main tasks \\
\addlinespace[0.05cm]
\midrule
\addlinespace[0.1cm]
{% for author in data['authors'] %}
{{ author['author'] }}{% if 'level' in author %}{{level_symbols[author['level']-1]}}{% endif %}
&
\begin{minipage} [t] {0.6\textwidth}
\begin{itemize}
\itemsep=0em
{% for citem in author['contributions'] %}
\item {{citem}}
{% endfor %}
\end{itemize}
\end{minipage} \\
{% if loop.index == loop.length %}
\addlinespace[0.25cm]
{% else %}
\addlinespace[0.5cm]
{% endif %}
{% endfor %}
\bottomrule
\end{longtable}
\end{center}
\vskip 0.8cm
\begin{tabularx}{\textwidth}{XXXX}
{% for author in data['authors'] %}
{{ author['author'] }}
{% if loop.index == loop.length %}
\\
{% elif loop.index % 4 == 0 %}
\\ \addlinespace[0.5cm]
{% else %}
&
{% endif %}
{% endfor %}
\end{tabularx}
\end{document}
{% endraw %}

View File

@ -0,0 +1,35 @@
#!/usr/bin/env python3
import yaml
import sys
import os
import datetime
from jinja2 import FileSystemLoader, Environment, PackageLoader, select_autoescape
env = Environment(
loader=FileSystemLoader(os.path.abspath('.')),
autoescape=select_autoescape()
)
contributions = yaml.safe_load(sys.stdin)
tday = datetime.date.today()
ftday = tday.strftime('%B %d, %Y')
level_symbols = [
'*',
'\\dag',
'\\ddag',
'\\S',
'\\P',
'\\#']
nb_of_levels = len(set((c['level'] for c in contributions['authors'] if 'level' in c)))
template = env.get_template("contribution-declaration.tex.tmpl")
print(template.render(tday=ftday, data=contributions, level_symbols=level_symbols, nb_of_levels=nb_of_levels))