add makefile

This commit is contained in:
Sebastian Hugentobler 2018-08-09 15:00:13 +02:00
parent b10deb5001
commit d3e3fd02c7
23 changed files with 102 additions and 69 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
.DS_Store
*~
*.swp
out/
build
.tmp

View File

@ -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

31
Makefile Normal file
View File

@ -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 ;

View File

@ -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)

5
build
View File

@ -1,5 +0,0 @@
#!/bin/sh
mkdir -p ./out
lualatex --output-directory=out calendar.tex

View File

@ -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}

View File

Before

Width:  |  Height:  |  Size: 2.8 MiB

After

Width:  |  Height:  |  Size: 2.8 MiB

View File

Before

Width:  |  Height:  |  Size: 5.2 MiB

After

Width:  |  Height:  |  Size: 5.2 MiB

View File

Before

Width:  |  Height:  |  Size: 652 KiB

After

Width:  |  Height:  |  Size: 652 KiB

View File

Before

Width:  |  Height:  |  Size: 636 KiB

After

Width:  |  Height:  |  Size: 636 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

Before

Width:  |  Height:  |  Size: 868 KiB

After

Width:  |  Height:  |  Size: 868 KiB

View File

Before

Width:  |  Height:  |  Size: 5.9 MiB

After

Width:  |  Height:  |  Size: 5.9 MiB

View File

Before

Width:  |  Height:  |  Size: 2.7 MiB

After

Width:  |  Height:  |  Size: 2.7 MiB

View File

Before

Width:  |  Height:  |  Size: 4.4 MiB

After

Width:  |  Height:  |  Size: 4.4 MiB

View File

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 1.7 MiB

View File

Before

Width:  |  Height:  |  Size: 2.7 MiB

After

Width:  |  Height:  |  Size: 2.7 MiB

View File

Before

Width:  |  Height:  |  Size: 3.5 MiB

After

Width:  |  Height:  |  Size: 3.5 MiB

View File

Before

Width:  |  Height:  |  Size: 813 KiB

After

Width:  |  Height:  |  Size: 813 KiB

1
calendars/2015/title Normal file
View File

@ -0,0 +1 @@
Traumlicht

43
src/calendar.tex Normal file
View File

@ -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}

View File

@ -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}