From d3e3fd02c7be3eacde3540b867e74ac9ba098da0 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Thu, 9 Aug 2018 15:00:13 +0200 Subject: [PATCH] add makefile --- .gitignore | 3 +- .gitlab-ci.yml | 8 ---- Makefile | 31 +++++++++++++ README.md | 33 +++++++++----- build | 5 -- calendar.tex | 41 ----------------- {images => calendars/2015/images}/april.jpg | Bin {images => calendars/2015/images}/august.jpg | Bin .../2015/images}/december.jpg | Bin .../2015/images}/february.jpg | Bin {images => calendars/2015/images}/january.jpg | Bin {images => calendars/2015/images}/july.jpg | Bin {images => calendars/2015/images}/june.jpg | Bin {images => calendars/2015/images}/march.jpg | Bin {images => calendars/2015/images}/may.jpg | Bin .../2015/images}/november.jpg | Bin {images => calendars/2015/images}/october.jpg | Bin .../2015/images}/september.jpg | Bin {images => calendars/2015/images}/title.jpg | Bin calendars/2015/title | 1 + src/calendar.tex | 43 ++++++++++++++++++ calpage.sty => src/calpage.sty | 0 title.tex => src/title.tex | 6 +-- 23 files changed, 102 insertions(+), 69 deletions(-) delete mode 100644 .gitlab-ci.yml create mode 100644 Makefile delete mode 100755 build delete mode 100644 calendar.tex rename {images => calendars/2015/images}/april.jpg (100%) rename {images => calendars/2015/images}/august.jpg (100%) rename {images => calendars/2015/images}/december.jpg (100%) rename {images => calendars/2015/images}/february.jpg (100%) rename {images => calendars/2015/images}/january.jpg (100%) rename {images => calendars/2015/images}/july.jpg (100%) rename {images => calendars/2015/images}/june.jpg (100%) rename {images => calendars/2015/images}/march.jpg (100%) rename {images => calendars/2015/images}/may.jpg (100%) rename {images => calendars/2015/images}/november.jpg (100%) rename {images => calendars/2015/images}/october.jpg (100%) rename {images => calendars/2015/images}/september.jpg (100%) rename {images => calendars/2015/images}/title.jpg (100%) create mode 100644 calendars/2015/title create mode 100644 src/calendar.tex rename calpage.sty => src/calpage.sty (100%) rename title.tex => src/title.tex (55%) diff --git a/.gitignore b/.gitignore index 45018d9..bb02ff6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store *~ *.swp -out/ +build +.tmp diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 138c642..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,8 +0,0 @@ -image: quay.io/thallian/calendar-builder:latest - -build: - script: - - su -c "lualatex --output-directory=. ./calendar.tex" builder - artifacts: - paths: - - calendar.pdf diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e9786de --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +BUILD_DIR=build +TMP_DIR=.tmp +SRC_DIR=src +CALENDAR_DIR=calendars + +CALENDAR_YEARS=$(wildcard ${CALENDAR_DIR}/*) +CALENDARS=$(patsubst %,${BUILD_DIR}/calendar-%.pdf,$(notdir ${CALENDAR_YEARS})) + +.PHONY: directories calendars all +.DEFAULT_GOAL := all + +directories: ${BUILD_DIR} ${TMP_DIR} + +${BUILD_DIR}: + mkdir -p ${BUILD_DIR} + +${TMP_DIR}: + mkdir -p ${TMP_DIR} + +${BUILD_DIR}/calendar-%.pdf: directories ${CALENDAR_DIR}/%/images/* ${SRC_DIR}/*.tex ${SRC_DIR}/*.sty + cd ${SRC_DIR} && lualatex --jobname="calendar-$*" --output-directory="../${TMP_DIR}" "\def\calyear{$*} \def\caltitle{"$(file < ${CALENDAR_DIR}/$*/title)"} \input{calendar.tex}" + cp "${TMP_DIR}/calendar-$*.pdf" "${BUILD_DIR}/calendar-$*.pdf" + +calendars: directories ${CALENDARS} +all: calendars + +clean: + rm -rf ${BUILD_DIR} + rm -rf ${TMP_DIR} + +%: ${BUILD_DIR}/calendar-%.pdf ; diff --git a/README.md b/README.md index cc2a8dd..c6076cf 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,33 @@ -# Calendar 2015 -A calendar for the year 2015, built in LaTeX. The main work is done by the `calpage` command which is based on the [birthday calendar example](www.texample.net/tikz/examples/birthday-calendar/) by Hakon Malmedal. +# Calendar Generator +A calendar generator, built in LaTeX. The main work is done by the `calpage` +command which is based on the [birthday calendar example](www.texample.net/tikz/examples/birthday-calendar/) +by Hakon Malmedal. -Of course the command is usable for years to come, not only 2015 ;) - -The images are licensed as [cc-by 4.0](ihttp://creativecommons.org/licenses/by/4.0/) as is calpage.sty. +The images are licensed as [cc-by 4.0](ihttp://creativecommons.org/licenses/by/4.0/) +as is calpage.sty. # Prerequisites - [LuaTeX](http://www.luatex.org/) -- some kind of shell if you want to use the build script (which does nothing fancy, it is mainly a memory hook) +- make # Usage -``` -./build -``` +Generate the following folder structure: `calendars/{year}/images`. -Months and weekdays are in german, if you want to change that take a look at the `pgfcalendarmonthname` definition in `calendar.tex` and the `day letter headings` in `calpage.sty`. For holiday definitions, take a look at the end of `calpage.sty`. +It is assumed that the images are named after the months of the year (in English) +and that there is one image called `title`. + +Make a file `calendars/{year}/title` and write the calendar title into. + +To build all run `make`. + +To build only a specific year run for example `make 2015`. + +# Configuration +Months and weekdays are in german, if you want to change that take a look at the +`pgfcalendarmonthname` definition in `calendar.tex` and the `day letter headings` +in `calpage.sty`. For holiday definitions, take a look at the end of `calpage.sty`. I will make that easier to configure in a future version. -You'll find the generated pdf in a folder called `out` +You'll find the generated pdfs in the `build` folder. ![a screenshot of december](screenshot.png) diff --git a/build b/build deleted file mode 100755 index c36d275..0000000 --- a/build +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -mkdir -p ./out - -lualatex --output-directory=out calendar.tex diff --git a/calendar.tex b/calendar.tex deleted file mode 100644 index 91bd0df..0000000 --- a/calendar.tex +++ /dev/null @@ -1,41 +0,0 @@ -% !Mode:: "TeX:UTF-8" - -\documentclass[fontsize=15pt]{scrartcl} -\usepackage{lmodern} -%\usepackage{fontspec} -\usepackage[unicode]{hyperref} -\usepackage[margin=5mm,a4paper,portrait]{geometry} -\PassOptionsToPackage{cmyk}{xcolor} -\usepackage[cmyk]{xcolor} -\usepackage{calpage} - -\pagestyle{empty} - -\definecolor{backcolour}{cmyk}{0.012, 0.012, 0.000, 0.020} -\pagecolor{backcolour} - -\renewcommand\familydefault{\ttdefault} - -\def\pgfcalendarmonthname#1{ - \translate{\ifcase#1\or Januar\or Februar\or März\or April\or - Mai\or Juni\or Juli\or August\or September\or Oktober\or - November\or Dezember\fi} -} - -\begin{document} - \input{title} - - \calpage{images/january}{2015-01-01}{2015-01-last} - \calpage{images/february}{2015-02-01}{2015-02-last} - \calpage{images/march}{2015-03-01}{2015-03-last} - \calpage{images/april}{2015-04-01}{2015-04-last} - \calpage{images/may}{2015-05-01}{2015-05-last} - \calpage{images/june}{2015-06-01}{2015-06-last} - \calpage{images/july}{2015-07-01}{2015-07-last} - \calpage{images/august}{2015-08-01}{2015-08-last} - \calpage{images/september}{2015-09-01}{2015-09-last} - \calpage{images/october}{2015-10-01}{2015-10-last} - \calpage{images/november}{2015-11-01}{2015-11-last} - \calpage{images/december}{2015-12-01}{2015-12-last} - -\end{document} diff --git a/images/april.jpg b/calendars/2015/images/april.jpg similarity index 100% rename from images/april.jpg rename to calendars/2015/images/april.jpg diff --git a/images/august.jpg b/calendars/2015/images/august.jpg similarity index 100% rename from images/august.jpg rename to calendars/2015/images/august.jpg diff --git a/images/december.jpg b/calendars/2015/images/december.jpg similarity index 100% rename from images/december.jpg rename to calendars/2015/images/december.jpg diff --git a/images/february.jpg b/calendars/2015/images/february.jpg similarity index 100% rename from images/february.jpg rename to calendars/2015/images/february.jpg diff --git a/images/january.jpg b/calendars/2015/images/january.jpg similarity index 100% rename from images/january.jpg rename to calendars/2015/images/january.jpg diff --git a/images/july.jpg b/calendars/2015/images/july.jpg similarity index 100% rename from images/july.jpg rename to calendars/2015/images/july.jpg diff --git a/images/june.jpg b/calendars/2015/images/june.jpg similarity index 100% rename from images/june.jpg rename to calendars/2015/images/june.jpg diff --git a/images/march.jpg b/calendars/2015/images/march.jpg similarity index 100% rename from images/march.jpg rename to calendars/2015/images/march.jpg diff --git a/images/may.jpg b/calendars/2015/images/may.jpg similarity index 100% rename from images/may.jpg rename to calendars/2015/images/may.jpg diff --git a/images/november.jpg b/calendars/2015/images/november.jpg similarity index 100% rename from images/november.jpg rename to calendars/2015/images/november.jpg diff --git a/images/october.jpg b/calendars/2015/images/october.jpg similarity index 100% rename from images/october.jpg rename to calendars/2015/images/october.jpg diff --git a/images/september.jpg b/calendars/2015/images/september.jpg similarity index 100% rename from images/september.jpg rename to calendars/2015/images/september.jpg diff --git a/images/title.jpg b/calendars/2015/images/title.jpg similarity index 100% rename from images/title.jpg rename to calendars/2015/images/title.jpg diff --git a/calendars/2015/title b/calendars/2015/title new file mode 100644 index 0000000..e672052 --- /dev/null +++ b/calendars/2015/title @@ -0,0 +1 @@ +Traumlicht \ No newline at end of file diff --git a/src/calendar.tex b/src/calendar.tex new file mode 100644 index 0000000..ed46e6d --- /dev/null +++ b/src/calendar.tex @@ -0,0 +1,43 @@ +% !Mode:: "TeX:UTF-8" + +\documentclass[fontsize=15pt]{scrartcl} +\usepackage{lmodern} +%\usepackage{fontspec} +\usepackage[unicode]{hyperref} +\usepackage[margin=5mm,a4paper,portrait]{geometry} +\PassOptionsToPackage{cmyk}{xcolor} +\usepackage[cmyk]{xcolor} +\usepackage{luatex85} +\def\pgfsysdriver{pgfsys-pdftex.def} +\usepackage{calpage} + +\pagestyle{empty} + +\definecolor{backcolour}{cmyk}{0.012, 0.012, 0.000, 0.020} +\pagecolor{backcolour} + +\renewcommand\familydefault{\ttdefault} + +\def\pgfcalendarmonthname#1{ + \translate{\ifcase#1\or Januar\or Februar\or März\or April\or + Mai\or Juni\or Juli\or August\or September\or Oktober\or + November\or Dezember\fi} +} + +\begin{document} + \input{title} + + \calpage{../calendars/\calyear/images/january}{\calyear-01-01}{\calyear-01-last} + \calpage{../calendars/\calyear/images/february}{\calyear-02-01}{\calyear-02-last} + \calpage{../calendars/\calyear/images/march}{\calyear-03-01}{\calyear-03-last} + \calpage{../calendars/\calyear/images/april}{\calyear-04-01}{\calyear-04-last} + \calpage{../calendars/\calyear/images/may}{\calyear-05-01}{\calyear-05-last} + \calpage{../calendars/\calyear/images/june}{\calyear-06-01}{\calyear-06-last} + \calpage{../calendars/\calyear/images/july}{\calyear-07-01}{\calyear-07-last} + \calpage{../calendars/\calyear/images/august}{\calyear-08-01}{\calyear-08-last} + \calpage{../calendars/\calyear/images/september}{\calyear-09-01}{\calyear-09-last} + \calpage{../calendars/\calyear/images/october}{\calyear-10-01}{\calyear-10-last} + \calpage{../calendars/\calyear/images/november}{\calyear-11-01}{\calyear-11-last} + \calpage{../calendars/\calyear/images/december}{\calyear-12-01}{\calyear-12-last} + +\end{document} diff --git a/calpage.sty b/src/calpage.sty similarity index 100% rename from calpage.sty rename to src/calpage.sty diff --git a/title.tex b/src/title.tex similarity index 55% rename from title.tex rename to src/title.tex index a947ba9..ed6fc38 100644 --- a/title.tex +++ b/src/title.tex @@ -1,15 +1,15 @@ \begin{titlepage} \begin{center} - \boxincludegraphics{width=\textwidth,height=1.1\textwidth}{images/title.jpg} + \boxincludegraphics{width=\textwidth,height=1.1\textwidth}{../calendars/\calyear/images/title.jpg} \vspace{4mm} \rule{\linewidth}{0.5mm} \\[0.4cm] - { \Huge \bfseries 2015}\\ + { \Huge \bfseries \calyear}\\ \vspace{4mm} \rule{\linewidth}{0.5mm} \\[1.5cm] \vspace{2mm} - { \large Traumlicht } + { \large \caltitle } \end{center} \end{titlepage}