Skip to content
This repository has been archived by the owner on Jun 6, 2018. It is now read-only.

Commit

Permalink
add pdf version
Browse files Browse the repository at this point in the history
  • Loading branch information
rnhmjoj committed Sep 7, 2017
1 parent 489b0b1 commit d3e2dc7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
20 changes: 17 additions & 3 deletions makefile
Original file line number Diff line number Diff line change
@@ -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) \
Expand Down
15 changes: 15 additions & 0 deletions pandoc/options.tex
Original file line number Diff line number Diff line change
@@ -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}{}{}

0 comments on commit d3e2dc7

Please sign in to comment.