add pdf version

This commit is contained in:
Michele Guerini Rocco 2017-09-07 19:44:59 +02:00
parent 489b0b1a7a
commit d3e2dc749f
Signed by: rnhmjoj
GPG Key ID: 91BE884FBA4B591A
2 changed files with 32 additions and 3 deletions

View File

@ -1,12 +1,26 @@
title = 'category-theory-for-programmers'
title = category-theory-for-programmers
root = $(shell pwd)
src = $(root)/src
chapters = $(shell find $(src)/part-* -name '*.html' | sort -V)
book:
cd $(src)/init; \
all: $(title).epub $(title).pdf
$(title).pdf:
@ cd $(src)/init; \
pandoc \
$(src)/init/preface.html \
$(chapters) \
--smart \
--toc \
--number-section \
--latex-engine=xelatex \
-H $(root)/pandoc/options.tex \
-o $(root)/$(title).pdf
$(title).epub:
@ cd $(src)/init; \
pandoc \
$(src)/init/preface.html \
$(chapters) \

15
pandoc/options.tex Normal file
View File

@ -0,0 +1,15 @@
% center images
\usepackage[export]{adjustbox}
\LetLtxMacro{\OldIncludegraphics}{\includegraphics}
\renewcommand{\includegraphics}[2][]{
\begin{center}
\OldIncludegraphics[max width=8cm,max height=4cm,#1]{#2}
\end{center}
}
% avoid that figures get a whole page
\renewcommand{\floatpagefraction}{.8}%
% start new page with each section
\usepackage{etoolbox}
\pretocmd{\section}{\clearpage}{}{}