Export figures feature (#70)

This adds a `make export_figures` command which exports all the flow
charts into nicely looking pngs. The command requires that you have
docker running locally.
This commit is contained in:
Hendrik Kleinwaechter
2023-03-30 15:09:56 +02:00
committed by GitHub
parent 36b9c4c7a9
commit e0d5422041
3 changed files with 28 additions and 11 deletions

View File

@@ -78,7 +78,7 @@ that it will reach more people all over the world without
budget constraints. budget constraints.
If you would like to contribute with a small donation you can do so If you would like to contribute with a small donation you can do so
via my [ko-fi page.](https://breadco.de/book). This will help me via my [ko-fi page.](https://breadco.de/book) This will help me
to cover costs related to running the-bread-code and allow me to cover costs related to running the-bread-code and allow me
to work more updates for this book. to work more updates for this book.

8
book/figures/export_figures.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
for i in *.pdf
do
docker run -v $(pwd):/imgs dpokidov/imagemagick -density 900 -trim /imgs/$i -quality 100 /imgs/$i.png
rename 's/pdf.png/png/' *.png
rename 's/fig-/figure-/' *.png
done

View File

@@ -4,16 +4,31 @@ build_pdf: clean figures tables
biber book biber book
pdflatex book.tex pdflatex book.tex
.PHONY: clean_figures
clean_figures:
cd figures
rm -rf figures/*.aux
rm -rf figures/*.fdb_latexmk
rm -rf figures/*.fls
rm -rf figures/*.log
rm -rf figures/*.pdf
rm -rf figures/*.png
.PHONY: export_figures
# Requires that you have docker running on your computer.
export_figures:
cd figures/ && bash export_figures.sh
.PHONY: figures .PHONY: figures
figures: figures: clean_figures
cd figures && find . -name "fig-*.tex" -exec pdflatex '{}' \; && cd ../ cd figures && find . -name "fig-*.tex" -exec pdflatex '{}' \;
.PHONY: tables .PHONY: tables
tables: tables:
cd tables && find . -name "table-*.tex" -exec pdflatex '{}' \; && cd ../ cd tables && find . -name "table-*.tex" -exec pdflatex '{}' \;
.PHONY: clean .PHONY: clean
clean: clean: clean_figures
rm -f book.blg rm -f book.blg
rm -f book.bbl rm -f book.bbl
rm -f book.aux rm -f book.aux
@@ -47,12 +62,6 @@ clean:
rm -f *.pdf rm -f *.pdf
rm -f output.log rm -f output.log
rm -f content.opf rm -f content.opf
rm -rf figures/*.aux
rm -rf figures/*.fdb_latexmk
rm -rf figures/*.fls
rm -rf figures/*.log
rm -rf figures/*.pdf
rm -rf figures/*.png
find . -name "*.xbb" | xargs rm -f find . -name "*.xbb" | xargs rm -f
rm -rf release/ rm -rf release/