6 Commits

Author SHA1 Message Date
Cedric
f01f33953b Use a sans-serif math font
Some checks failed
Test book and website for given image / test-book-website (push) Has been cancelled
pgfplots uses math fonts for graphs ticks... and it looks weird when
building sans serif.

Not sure Fira is necessarily a great choice with open-sans but we have
very little math so that should do...
2025-01-12 15:17:27 +00:00
Ced
92ff917d4d Merge remote-tracking branch 'upstream/main' into sans_serif_pics_website 2025-01-12 12:22:39 +00:00
Hendrik Kleinwaechter
3792dcc20a Fix website build 2025-01-12 12:36:27 +01:00
Ced
8ea8256e2d Try to fix ruby script
This is really a shoot in the dark... I have not tested it in any way.
2025-01-11 15:29:21 +00:00
Ced
7aec1160e1 Use sans-serif fonts for TikZ figures in website
Flowcharts were already sans-serif but the new one look weird with a
serif font on the website => let's make it sans by default.

For epub this a tough call but let's assume most people use sans there
as well, it's less weird anyway to have sans-serif pictures in a serif
text than the other way around.
2025-01-11 15:05:20 +00:00
Ced
558f86b1cc Workaround for Tex4ht and file called book
45e9d739f5
2025-01-11 15:01:03 +00:00
15 changed files with 259 additions and 449 deletions

View File

@@ -40,7 +40,7 @@ jobs:
options: -v ${{ github.workspace }}:/app
run: |
cd /app/book
make -j -O serif ebook website
make -j -O build_serif_pdf build_ebook website
- name: Upload book Artifacts
uses: actions/upload-artifact@v4
with:

View File

@@ -12,6 +12,7 @@
\input{cover/cover.tex}
\titlepage
\frontmatter
{%
\hypersetup{hidelinks}
\ifdefined\HCode\else\tableofcontents\fi
@@ -20,89 +21,43 @@
\input{intro/preface}
\input{intro/acknowledgments}
\begin{flowchart}[!htb]
\begin{center}
\input{figures/fig-dutch-oven-process.tex}
\caption[Baking process with a dutch oven]{A visualization of the baking
process using a dutch oven (DO). The dough is steamed for the first half
of the bake and then baked without cover for the second half of the
bake. The desired darkness and thickness of the crust depends on your
personal preference. Some bakers prefer a lighter crust and others a
darker.}%
\label{fig:dutch-oven-process}
\end{center}
\end{flowchart}
\mainmatter
At around \qty{60}{\degreeCelsius} (\qty{140}{\degF}) the microbes in your
dough start to die. There are rumors that until this happens the microbes
produce a lot of \ch{CO2}.
\input{history/sourdough-history}
% Does not work
\begin{figure}[!htb]
\begin{center}
\input{figures/fig-ethanol-oxidation.tex}
\caption[Acetic acid creation]{Oxygen is required to create acetic
acid~\cite{acetic+acid+production}.}%
\label{fig:ethanol-oxidation}
\end{center}
\end{figure}
\input{basics/how-sourdough-works}
%% Works
%% Generate first with: cd figures && pdflatex fig-ethanol-oxidation-external.tex
%\begin{figure}[!htb]
% \begin{center}
% \includegraphics{figures/fig-ethanol-oxidation-external.png}
% \caption[Acetic acid creation]{Oxygen is required to create acetic
% acid~\cite{acetic+acid+production}.}%
% \end{center}
%\end{figure}
%
%% Does not work
%\begin{figure}[!htb]
%\begin{center}
% \input{figures/fig-life-planet-sourdough-timeline.tex}
% \caption[Sourdough microbiology timeline]{Timeline giberrish on website}%
%\end{center}
%\end{figure}
%
%% Works
%% Generate first with: cd figures && pdflatex fig-life-planet-sourdough-timeline-external.pdf
%\begin{figure}[!htb]
% \includegraphics{figures/fig-life-planet-sourdough-timeline-external.png}
% \caption[Sourdough microbiology timeline]{Timeline works embedded as png}%
%\end{figure}
%
%\begin{figure}[!htb]
% \includegraphics[width=\textwidth]{baking-experiment-temperatures.png}
% \caption[Surface temperature for different steaming methods]{png file}
%\end{figure}
\input{sourdough-starter/sourdough-starter}
\begin{figure}[!htb]
\includegraphics[width=\textwidth]{baking-process-steam.jpg}
\caption[Steam building with inverted tray]{jpg file}%
\label{flc:inverted-tray}
\end{figure}
If you're a hobby brewer, you'll know that it's important to keep your beer at
certain temperatures to allow the different amylases to convert the contained
starches into sugar~\cite{beer+amylase}.
This test, called the \emph{Iodine Starch Test}, involves mixing iodine into
a sample of your brew and checking the color.
\input{sourdough-starter/sourdough-starter-types}
% https://github.com/hendricius/the-sourdough-framework/issues/358
\begin{table}[!htb]
\begin{center}
\input{tables/table-starter-usage-activity.tex}
\caption[Different oven types]{An overview of different oven types and
eheir different baking methods.}
\end{center}
\end{table}
\input{flour-types/flour-types}
\begin{table}[!htb]
\begin{center}
\input{tables/table-oven-baking-overview.tex}
\caption[Different oven types]{An overview of different oven types and their
different baking methods.}
\end{center}
\end{table}
\input{bread-types/bread-types}
\chapter{Wheat sourdough}%
\label{chapter:wheat-sourdough}
\input{wheat-sourdough/wheat-sourdough}
\input{non-wheat-sourdough/non-wheat-sourdough}
\input{mix-ins/mix-ins.tex}
\input{baking/baking}
\input{storing-bread/storing-bread}
\chapter{Troubleshooting}
\input{troubleshooting/misc}
\backmatter
\input{glossary/glossary}
{%
\hypersetup{hidelinks}
\listofflowcharts
\listoftables
\listoffigures
}
\printbibliography
\end{document}

View File

@@ -1,2 +1,4 @@
\def\isaccessible{1}
\input{book.tex}
% We have to use a symlink to book.tex to prevent tex4ebook to load book.ht4
% before loading any other package and create conflicts
\input{sourdough_book.tex}

View File

@@ -10,7 +10,6 @@ if [ "$#" -ne 1 ]; then
done
else
target=figures/`basename $1 .png.pdf`.png
echo ${target}
echo "Converting: " $1 " to: " ${target}
convert -density 900 -trim $1 -quality 100 ${target}
fi

View File

@@ -1,8 +1,32 @@
\begin{tikzpicture}[node distance = 3cm, auto]
\node [start] (heat_oven) {Preheat DO to \qty{230}{\degreeCelsius} (\qty{446}{\degF}) for 30~minutes};
\node [block, right of=heat_oven] (remove_oven) {Remove DO from oven ° \text{°} \textup{°}};
\node [decision, below of=heat_oven, node distance=4cm] (is_ready_check) {Core temperature \qty{92}{\degreeCelsius} (\qty{197}{\degF})?};
\node [block, right of=is_ready_check, node distance=4cm] (remove_do_lid) {%
Jörg bäckt quasi zwei Haxenfüße vom Wildpony .Dès Noël, où un zéphyr haï me
vêt};
\node [block, right of=heat_oven] (remove_oven) {Remove DO from oven };
\node [block, right of=remove_oven] (open_load_dough) {Open DO \& load your dough};
\node [block, right of=open_load_dough] (score) {Score your dough};
\node [block, right of=score] (spritz) {Spritz dough with water};
\node [block, below of=spritz] (close) {Close DO};
\node [block, left of=close] (back_oven) {Place DO back in oven};
\node [block, left of=back_oven] (bake) {Bake 30~minutes at \qty{230}{\degreeCelsius} (\qty{446}{\degF})};
\node [decision, below right= 5cm and -1 cm of heat_oven] (is_ready_check)
{Core temperature \qty{92}{\degreeCelsius} (\qty{197}{\degF})?};
\node [block, below of=is_ready_check, node distance=4cm] (wait_5_minutes) {Wait\\ 5 minutes};
\node [block, right of=is_ready_check, node distance=4cm] (remove_do_lid) {Remove DO lid};
\node [decision, right of=remove_do_lid, node distance=3.5cm] (dark_enough_decision) {Crust color dark enough?};
\node [success, below of=dark_enough_decision, node distance=4cm] (finish_baking) {Bread is finished};
\node [block, right of=dark_enough_decision, node distance=3.5cm] (bake_5_more_minutes) {Bake another 5~minutes};
\path [line] (heat_oven) -- (remove_oven);
\path [line] (remove_oven) -- (open_load_dough);
\path [line] (open_load_dough) -- (score);
\path [line] (score) -- (spritz);
\path [line] (spritz) -- (close);
\path [line] (close) -- (back_oven);
\path [line] (back_oven) -- (bake);
\path [line] (bake.west) -- node{} ++(-2, 0) -| (is_ready_check.north);
\path [line] (is_ready_check) -- node{Yes} (remove_do_lid);
\path [line] (is_ready_check) -- node{No} (wait_5_minutes);
\path [line] (wait_5_minutes.west) -- node{} ++(-1.5, 0) |- (is_ready_check.west);
\path [line] (remove_do_lid) -- (dark_enough_decision);
\path [line] (dark_enough_decision) -- node{Yes} (finish_baking);
\path [line] (dark_enough_decision) -- node{No} (bake_5_more_minutes);
\path [line] (bake_5_more_minutes.east) -- node{} ++(1, 0) -- node{} ++(0, 2.3) -| (dark_enough_decision.north);
\end{tikzpicture}

View File

@@ -11,7 +11,7 @@
\path [line] (ready_signs) -- node{No} (feed_again);
\path [line] (ready_signs) -- node[above=2pt]{~Yes} (last_feed);
\path [line] (last_feed) -- node{after \qtyrange{6}{12}{\hour}} (bread_dough);
\node [above of=feed_again, text width=5em, align=center, node distance=3cm] (repeat_text) {Repeat 3~times};
\draw [line] ($(repeat_text) +(0, 1 cm)$) arc (90:420:1cm);
% TODO: find a better way to position the Repeat 3 times text and arrow. Hard-coded values are finicky and don't work well across media.
\draw [line] ($ (feed_again.north) +(0.7cm, 1cm)$) arc (-45:220:1cm);
\node [anchor=north, text width=5em] at ($(feed_again.north west)+(1.55cm, 2.2cm)$) {Repeat 3~times};
\end{tikzpicture}

View File

@@ -19,7 +19,7 @@
\path [line] (too_dry) -- node{No} (next_day);
\path [line] (too_dry) -- node{Yes} (add_water);
\path [line] (ready_signs) -- node{Yes} (last_feed);
\node [text width=5em, align=center] (repeat_text) at ($(feed_new_ratio)!0.5!(next_day)$) {Repeat 3~times};
\draw [line] ($(repeat_text) +(0, 1 cm)$) arc (90:-210:1cm);
% TODO: find a better way to position the Repeat 3 times text and arrow. Hard-coded values are finicky and don't work well across media.
\draw [line] ($ (feed_again.east) +(0.7cm, 0.9cm)$) arc (220:-45:1cm);
\node [anchor=north, text width=5em] at ($(feed_again.east)+(1.9cm, 2cm)$) {Repeat 3~times};
\end{tikzpicture}

View File

@@ -1,7 +1,7 @@
# Macros for commands {{{
# Macros for commands
LATEX := latexmk -cd -pdflua -lualatex="lualatex -interaction=nonstopmode" -synctex=1 -use-make
EBOOK := tex4ebook --lua -d epub -f epub -c tex4ebook.cfg -B epub_build
WEBSITE := make4ht --lua -c website.cfg -uf html5+tidy+common_domfilters -B website_build
WEBSITE := make4ht --lua -c website.cfg -a debug -uf html5+tidy+common_domfilters -B website_build
CLEAN := latexmk -cd -lualatex -c -use-make
CHECK_1 := lacheck
CHECK_2 := chktex
@@ -10,9 +10,10 @@ REDUCE_PIC := -resize '800x800>' \
-strip -interlace Plane -gaussian-blur 0.05 -quality 85\% \
-set colorspace Gray -separate -evaluate-sequence Mean
REDUCE_PIC_COLOR := -quality 80\%
RSYNC := rsync -au --exclude 'book.epub' --exclude '*.jpg'
RSYNC := rsync -au --exclude 'book_sans_serif.epub' --exclude '*.jpg'
GIT := git --no-pager
SPELL_CHECK := hunspell -t -l -d en_US
EPUBSIZE := `du -sb epub/low_res_book.epub | cut -f1`
# We want bash as shell
SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
@@ -24,35 +25,25 @@ LATEX += -diagnostics
EBOOK += -a debug
WEBSITE += -a debug
endif
# }}}
# Default target is not all because most of the time we just want a pdf...
# and building everything take a long time.
.DEFAULT_GOAL := serif
website_dir := static_website_html
# List all files that are dependencies {{{
# List all files that are dependencies
chapters = baking basics bread-types cover flour-types history intro mix-ins\
non-wheat-sourdough sourdough-starter storing-bread troubleshooting\
wheat-sourdough glossary
# Actual book text and LaTeX code {{{
src_tex := $(foreach directory, $(chapters), $(wildcard $(directory)/*.tex))
src_tex += book.tex book_sans_serif.tex references.bib figures/vars.tex
src_tex += supporters.csv sourdough.sty colors.tex abbreviations.tex
src_tex += $(src_recipes)
# }}}
# Tables and TikZ flowcharts/plots/drawings... {{{
src_tables := $(wildcard tables/table-*.tex)
src_figures := $(wildcard figures/fig-*.tex) figures/flowcharts_tikz.tex
src_figures += $(wildcard plots/fig-*.tex) abbreviations.tex colors.tex
src_recipes := $(wildcard recipes/*.tex)
src_plots := $(wildcard plots/*.table)
# }}}
tgt_figures := $(patsubst %.tex, %.png,$(src_figures))
src_tex := $(foreach directory, $(chapters), $(wildcard $(directory)/*.tex))
src_tex += book.tex book_sans_serif.tex references.bib figures/vars.tex
src_tex += supporters.csv sourdough.sty colors.tex abbreviations.tex
src_tex += $(src_recipes)
# Photos {{{
images := $(wildcard images/*/*.jpg)
images += $(wildcard images/*.jpg)
images += $(wildcard images/*.png)
@@ -66,30 +57,37 @@ images += $(foreach directory, $(chapters), $(wildcard $(directory)/*/*.png))
# images to lower resolution and greyscale
bw_images := $(addprefix bw-book-epub/OEBPS/, $(images))
# For lower resolution colour ebook (see below) we will not convert png as it
# only get worst we will copy them instead... so remove them as a dependency.
# For lower res colour ebook we would not convert png as it only get worst
# we will copy them instead... so remove them as a dependency.
low_res_images := $(addprefix low-res-book-epub/OEBPS/, $(images))
low_res_images := $(filter-out %.png, $(low_res_images))
# }}}
# All together.
src_all := $(src_tex) $(src_figures) $(src_tables) $(images) $(src_plots)
# And format specific configurations
ebook_src := $(src_all) tex4ebook.cfg book.mk4 book-ebook.css
website_src := $(src_all) website.cfg style.css
website_dir := static_website_html
# This is more than what is actually needed but keeps the makefile simple
# and latexmk will handle the rest
booklet_src := $(src_figures) $(src_tables) $(src_recipes) $(images)
booklet_src += booklet.tex
website_assets := $(wildcard ../website/assets/*)
ruby_src := ../website/modify_build.rb $(website_assets)
ruby_pkg := ../website/Gemfile ../website/Gemfile.lock
# This is more than what is actually needed but keeps the makefile simple
booklet_src := $(src_figures) $(src_tables) $(src_recipes) $(images)
booklet_src += booklet.tex
# }}}
tgt_figures := $(patsubst %.tex, %.png,$(src_figures))
# Default target is not all because most of the time we just want a pdf...
# and ebook take a long time to build.
.DEFAULT_GOAL := build_serif_pdf
# Default rules for pdf and ebooks, getting overwritten when built in a
# sub-directory
%.pdf: %.tex
$(LATEX) $<
# Flowcharts {{{
# TODO: check if it works on github CI
%.png: %.tex
@printf '%s\n' "\input{./vars.tex}" > $@.in
@@ -101,12 +99,12 @@ booklet_src += booklet.tex
%.xbb: %.jpg
ebb -x $<
# }}}
# pdf {{{
# Default rules for pdf, getting overwritten when built in a sub-directory
%.pdf: %.tex
$(LATEX) $<
# We don't want to use latexmk as there is no biber nor references and it
# seems to make it somehow unhappy
booklet/booklet.pdf: $(booklet_src)
mkdir -p booklet
lualatex --output-directory=booklet booklet.tex
book_serif/book.pdf: $(src_all)
$(LATEX) -output-directory=book_serif book.tex
@@ -114,28 +112,16 @@ book_serif/book.pdf: $(src_all)
book_sans_serif/book_sans_serif.pdf: $(src_all)
$(LATEX) -output-directory=book_sans_serif book_sans_serif.tex
# We don't want to use latexmk as there is no biber nor references and it
# seems to make it somehow unhappy
booklet/booklet.pdf: $(booklet_src)
mkdir -p booklet
lualatex --output-directory=booklet booklet.tex
# }}}
# Ebook {{{
###################################
.PHONY: copy_ebook_files copy_ebook_files_low_res
epub/%.epub: %.tex $(ebook_src) cover/cover-page.xbb
$(EBOOK) $<
copy_ebook_files: build_ebook
$(RSYNC) --exclude '*.png' epub_build/book-epub/ bw-book-epub/
$(RSYNC) --exclude '*.png' epub_build/book_sans_serif-epub/ bw-book-epub/
# Now that we have built the ebook we will generate 2 more versions
#
# 1) With kindle app on phone we want a colour version with size < 50 MB
# 2) A black-white version for actual eink readers
#
# In both cases we just convert images and repack the ebpub
copy_ebook_files_low_res: build_ebook
$(RSYNC) epub_build/book_sans_serif-epub/ low-res-book-epub/
# We do not convert SVG to B&W or lower res for now as they are super small
# anyway
@@ -147,107 +133,120 @@ bw-book-epub/OEBPS/%.png: %.png
mkdir -p $(dir $@)
$(CONVERT_PIC) $< $(REDUCE_PIC) $@
epub/bw_book.epub: copy_ebook_files $(bw_images)
cd bw-book-epub; zip -q0X ../epub/bw_book.epub mimetype
cd bw-book-epub; zip -q9XrD ../epub/bw_book.epub ./
# Now the low res
copy_ebook_files_low_res: ebook
$(RSYNC) epub_build/book-epub/ low-res-book-epub/
low-res-book-epub/OEBPS/%.jpg: %.jpg
mkdir -p $(dir $@)
$(CONVERT_PIC) $< $(REDUCE_PIC_COLOR) $@
epub/bw_book.epub: copy_ebook_files $(bw_images)
cd bw-book-epub; zip -q0X ../epub/bw_book.epub mimetype
cd bw-book-epub; zip -q9XrD ../epub/bw_book.epub ./
epub/low_res_book.epub: copy_ebook_files_low_res $(low_res_images)
cd low-res-book-epub; zip -q0X ../epub/low_res_book.epub mimetype
cd low-res-book-epub; zip -q9XrD ../epub/low_res_book.epub ./
#}}}
# Website {{{
###################################
.PHONY: html website
$(website_dir)/book.html: $(website_src) cover/cover-page.xbb
$(WEBSITE) -d $(website_dir) book.tex
html: $(website_dir)/book.html
cp $< $(website_dir)/index.html
# Because packages will be installed in hard to predict places use a file as
# marker..
../website/_bundle_install_done: $(ruby_pkg)
-rm ../website/$@
cd ../website && bundle install
touch ../website/$@
# TODO: this will run every single time, but is so fast we don't really care
website: html ../website/_bundle_install_done $(ruby_src)
cd ../website && ruby modify_build.rb
#}}}
# Figures only {{{
###################################
.PHONY: export_figures
# Requires that you have docker running on your computer.
export_figures: pdf $(tgt_figures)
cd figures/ && bash export_figures.sh
# }}}
# Now with the targets {{{
# Expected usual targets first
# Now with the rules
# Expected usual rules first
.PHONY: all
all: bake
.PHONY: help
help:
@echo ""
@echo "default: builds the book in pdf format (serif)"
@echo ""
@echo "Releases:"
@echo " all: pdf serif and sans-serif accessible version, ebooks in colours"
@echo " and black&white versions and the website"
@echo ""
@echo " bake: same as build all"
@echo ""
@echo " release_serif: build serif only version of pdf and ebook"
@echo " release_sans_serif: build sans-serif/accessible version of pdf"
@echo ""
@echo "Portable Document Format (pdf):"
@echo " build_sans_serif_pdf: build accessible pdf only (same as release_sans_serif)"
@echo " build_serif_pdf: build serif pdf only"
@echo " build_pdf: builds both serif and accessible pdf"
@echo ""
@echo "Ebooks (epub):"
@echo " build_ebook: builds only the colour ebook"
@echo " build_bw_ebook: builds the low res black & white ebook"
@echo ""
@echo "Website:"
@echo " website: build the static website from LaTeX sources and post-process it"
@echo " html: build the static website from LaTeX sources _without_ post-processing"
@echo ""
@echo "Cleanup:"
@echo " mrproper: delete all generated files intermediate and pdf/ebooks/website"
@echo " clean: delete all intermediate files keep targets (pdf/ebooks/website)"
@echo " clean_figures: delete intermediate TikZ files"
@echo " clean_website_build: delete intermediate website files"
@echo " clean_ebook_build: delete intermediate ebook files"
@echo ""
@echo "Debug targets:"
@echo ""
@echo "figures: build TikZ figures only"
@echo ""
@echo "Quick builds:"
@echo " quick: compiles serif_pdf but runs lulatex only once"
@echo " quick_ebook: compiles ebook but runs lulatex only once"
@echo " quick_booklet: compiles booklet but runs lulatex only once"
@echo ""
@echo "Checks:"
@echo " tex-check: runs static analysis checker on LaTeX source to spot"
@echo " programming or typographic mistakes"
@echo " spell-check: runs a spell checker"
@echo " check: runs both checkers"
@echo ""
@echo "Dump informations:"
@echo " show_tools_version: Show version of tools used on the build machine"
@echo " printvars: print all variables in the makefile"
@echo " print-X: print makefile variable X"
@echo ""
@echo "set DEBUG i.e make DEBUG=1 build_ebook to add debug flags to commands"
# Finally actual project targets (i.e. build pdf and ebooks)
.PHONY: pdf booklet serif sans_serif ebook
.PHONY: build_pdf build_booklet build_serif_pdf build_sans_serif_pdf build_ebook
pdf: serif sans_serif
build_pdf: build_serif_pdf build_sans_serif_pdf
booklet: booklet/booklet.pdf
serif: book_serif/book.pdf
sans_serif: book_sans_serif/book_sans_serif.pdf
build_booklet: booklet/booklet.pdf
ebook: epub/book.epub
bw_ebook: epub/bw_book.epub
low_res_ebook: epub/low_res_book.epub
build_serif_pdf: book_serif/book.pdf
# We keep the old target names for backward compatibility
build_pdf: pdf
build_booklet: booklet
build_serif_pdf: serif
build_sans_serif_pdf: sans_serif
build_ebook: ebook
build_bw_ebook: bw_ebook
build_low_res_ebook: low_res_ebook
build_sans_serif_pdf: book_sans_serif/book_sans_serif.pdf
# top level releases rules
.PHONY: bake release_serif release_sans_serif
bake: release_serif release_sans_serif release_booklet website
build_ebook: epub/book_sans_serif.epub
release:
mkdir -p release
build_bw_ebook: epub/bw_book.epub
release_serif: serif ebook bw_ebook low_res_ebook | release
cp book_serif/book.pdf release/TheBreadCode-The-Sourdough-Framework.pdf
cp epub/bw_book.epub release/TheBreadCode-The-Sourdough-Framework-black-and-white.epub
cp epub/low_res_book.epub release/TheBreadCode-The-Sourdough-Framework.epub
# Kindle does not allow files larger than 50 MB... so let's check
@if [ `du -sb epub/low_res_book.epub | cut -f1` -gt 49500000 ]; then \
echo "ERROR: epub File too big"; \
exit 1; \
fi
build_low_res_ebook: epub/low_res_book.epub
release_sans_serif: sans_serif | release
cp book_sans_serif/book_sans_serif.pdf release/TheBreadCode-The-Sourdough-Framework-sans-serif.pdf
.PHONY: export_figures check tex-check spell-check
# Requires that you have docker running on your computer.
export_figures: build_pdf $(tgt_figures)
cd figures/ && bash export_figures.sh
release_booklet: booklet | release
cp booklet/booklet.pdf release/TheBreadCode-The-Sourdough-Framework-booklet.pdf
# }}}
# Goal is not really to have 0 warning reported but we should check we don't
# add many and if we do, we know they are false positive
check: spell-check tex-check
# Clean up {{{
###################################
tex-check: $(src_tex)
@echo "Running: " $(CHECK_1)
$(CHECK_1) book.tex
@echo ""
@echo "Running: " $(CHECK_2)
$(CHECK_2) book.tex
# delete generated files
spell-check: $(src_tex) spelling_exceptions.txt
# Generate exceptions this way to avoid false positives
# hunspell -t -l -d en_US **/*.tex *.csv *.sty *.sty | cut -f 2 -d ':' | sort -u > spelling_exceptions.txt
$(SPELL_CHECK) -p spelling_exceptions.txt $(src_tex)
# Clean up and delete generated files
.PHONY: clean_figures clean_ebook_build clean_website_build clean mrproper
clean_figures:
-$(CLEAN) $(patsubst %.tex, %.png.in, $(src_figures))
@@ -292,92 +291,52 @@ mrproper: clean
-rm -rf epub_build/
-rm -rf website_build/
-rm -rf $(website_dir)
#}}}
# Help {{{
###################################
.PHONY: help
help:
@echo ""
@echo "default: builds the book in pdf format (serif)"
@echo ""
@echo "Releases:"
@echo " all: pdf serif and sans-serif accessible version, ebooks in colours"
@echo " and black&white versions as well as the website"
@echo ""
@echo " bake: same as build all"
@echo ""
@echo " release_serif: build serif only version of pdf and ebook"
@echo " release_sans_serif: build sans-serif/accessible version of pdf"
@echo ""
@echo "Portable Document Format (pdf):"
@echo " sans_serif: build accessible pdf only (same as release_sans_serif)"
@echo " serif: build serif pdf only"
@echo " pdf: builds both serif and accessible pdf"
@echo ""
@echo "Ebooks (epub):"
@echo " ebook: builds only the colour ebook"
@echo " low_res_ebook: builds the colour ebook in lower resolution"
@echo " bw_ebook: builds the low res black & white ebook"
@echo ""
@echo "Website:"
@echo " website: build the static website from LaTeX sources and post-process it"
@echo " html: build the static website from LaTeX sources _without_ post-processing"
@echo ""
@echo "Cleanup:"
@echo " mrproper: delete all generated files intermediate and pdf/ebooks/website"
@echo " clean: delete all intermediate files keep targets (pdf/ebooks/website)"
@echo " clean_figures: delete intermediate TikZ files"
@echo " clean_website_build: delete intermediate website files"
@echo " clean_ebook_build: delete intermediate ebook files"
@echo ""
@echo "Debug targets:"
@echo ""
@echo "figures: build TikZ figures only"
@echo ""
@echo "Quick builds:"
@echo " quick: compiles serif_pdf but runs lulatex only once"
@echo " quick_ebook: compiles ebook but runs lulatex only once"
@echo " quick_booklet: compiles booklet but runs lulatex only once"
@echo ""
@echo "Checks:"
@echo " tex-check: runs static analysis checker on LaTeX source to spot"
@echo " programming or typographic mistakes"
@echo " spell-check: runs a spell checker"
@echo " check: runs both checkers"
@echo ""
@echo "Dump informations:"
@echo " show_tools_version: Show version of tools used on the build machine"
@echo " printvars: print all variables in the makefile"
@echo " print-X: print makefile variable X"
@echo ""
@echo "set DEBUG i.e make DEBUG=1 ebook to add debug flags to commands"
# }}}
# top level releases rules
.PHONY: bake release_serif release_sans_serif
# Debug Stuff from now on {{{
###################################
bake: release_serif release_sans_serif release_booklet website
# Verify your spelling and TeX warnings {{{
.PHONY: check tex-check spell-check
# Goal is not really to have 0 warning reported but we should check we don't
# add many and if we do, we know they are false positive
check: spell-check tex-check
release:
mkdir -p release
tex-check: $(src_tex)
@echo "Running: " $(CHECK_1)
$(CHECK_1) book.tex
@echo ""
@echo "Running: " $(CHECK_2)
$(CHECK_2) book.tex
release_serif: build_serif_pdf build_ebook build_bw_ebook build_low_res_ebook | release
cp book_serif/book.pdf release/TheBreadCode-The-Sourdough-Framework.pdf
cp epub/bw_book.epub release/TheBreadCode-The-Sourdough-Framework-black-and-white.epub
cp epub/low_res_book.epub release/TheBreadCode-The-Sourdough-Framework.epub
@if [ $(EPUBSIZE) -gt 49500000 ]; then \
echo "ERROR: epub File too big"; \
exit 1; \
fi
# Should be 0 if not and you are really sure update the exception file
spell-check: $(src_tex) spelling_exceptions.txt
# Generate exceptions this way to avoid false positives
# hunspell -t -l -d en_US **/*.tex *.csv *.sty *.sty | cut -f 2 -d ':' | sort -u > spelling_exceptions.txt
$(SPELL_CHECK) -p spelling_exceptions.txt $(src_tex)
#}}}
release_sans_serif: build_sans_serif_pdf | release
cp book_sans_serif/book_sans_serif.pdf release/TheBreadCode-The-Sourdough-Framework-sans-serif.pdf
release_booklet: build_booklet | release
cp booklet/booklet.pdf release/TheBreadCode-The-Sourdough-Framework-booklet.pdf
# Website stuff
.PHONY: html website
$(website_dir)/book_sans_serif.html: $(website_src) cover/cover-page.xbb
$(WEBSITE) -d $(website_dir) book_sans_serif.tex
html: $(website_dir)/book_sans_serif.html
cp $< $(website_dir)/index.html
# Because packages will be installed in hard to predict places use a file as
# marker..
../website/_bundle_install_done: $(ruby_pkg)
-rm ../website/$@
cd ../website && bundle install
touch ../website/$@
# TODO: this will run every single time, but is so fast we don't really care
website: html ../website/_bundle_install_done $(ruby_src)
cd ../website && ruby modify_build.rb
# Debug Stuff from now on
.PHONY: quick quick_ebook show_tools_version printvars
# Those 2 targets allow fast debug cycles but not resolving references etc
# They also ignore dependencies and run each time you call them.
quick: # run latex only once no biber, no references etc...
@@ -387,9 +346,9 @@ quick_booklet:
$(LATEX) -e '$$max_repeat=1' -halt-on-error -output-directory=booklet booklet.tex
quick_ebook: cover/cover-page.xbb # run latex only once no biber, ref etc...
$(EBOOK) --mode draft book.tex
$(EBOOK) --mode draft book_sans_serif.tex
show_tools_version: # Show version of tools used on the build machine {{{
show_tools_version: # Show version of tools used on the build machine
- $(GIT) log -1 --pretty=%B
@echo ""
- uname -a
@@ -424,7 +383,6 @@ show_tools_version: # Show version of tools used on the build machine {{{
- $(CONVERT_PIC) --version
@echo ""
- rsync --version
# }}}
# You can find the value of variable X with the following command:
# make print-X
@@ -434,4 +392,3 @@ printvars: # Print all variables in the makefile
@$(foreach V,$(sort $(.VARIABLES)), \
$(if $(filter-out environ% default automatic, \
$(origin $V)),$(info $V=$($V) ($(value $V)))))
# }}}

View File

@@ -1,75 +0,0 @@
% Copyright 2021-2024 by Michal Hoftich
% Copyright 2006 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
\ProvidesFileRCS{pgfsys-dvisvgm4ht.def}
% Driver commands for tex4ht
%
% Load common pdf commands:
%
% we switched to dvisvgm driver by default. it supports patterns and other features
% dvips driver is available through the tikz+ option. It doesn't support everything,
% but it worked better with nested pictures in the past.
\ifdefined\ifOption
\ifOption{tikz+}{\input pgfsys-dvips.def}{\input pgfsys-dvisvgm.def}
\else
% load the dvips driver by default
\input pgfsys-dvisvgm.def
\fi
\catcode`\:=11%
% we must call most of these redefinitions in \AtBeginDocument, because \HLet is available
% only at that moment
\AtBeginDocument{%
% configure the output picture format to svg, as it will require dvisvgm
% post processing.
\Configure{Picture}{.svg}%
% insert picture hooks to pgfsys commands
% these redefinitions are usually called only with the \tikz command,
% they are ignored in tikzpicture environment
\def\:tempa#1{%
\texfourht@tikz@begin%
\csname o:pgfsys@typesetpicturebox:\endcsname{#1}
\texfourht@tikz@end%
}
\HLet\pgfsys@typesetpicturebox\:tempa
% we must remove Picture-alt in \pgfsys@beginpicture, because it can result in alt text included in the image
\def\:tempa{\Configure{Picture-alt}{}\texfourht@tikz@begin\o:pgfsys@beginpicture:}
\HLet\pgfsys@beginpicture\:tempa
\let\o:pgfsys@endpicture:\pgfsys@endpicture
\def\:tempa{\o:pgfsys@endpicture:}
\HLet\pgfsys@endpicture\:tempa
% start picture around TikZ and PGF environments
\ConfigureEnv{tikzpicture}{\begingroup\texfourht@tikz@begin}{\texfourht@tikz@end\endgroup}{}{}%
\ConfigureEnv{pgfpicture}{\begingroup\texfourht@tikz@begin}{\texfourht@tikz@end\endgroup}{}{}%
}
\def\texfourht@tikz@begin{
\protect\csname nested:math\endcsname% support display math
\Picture*[\csname a:Picture-alt\endcsname]{}%
}
\def\texfourht@tikz@end{\EndPicture}
\catcode`\:=12%
\endinput
%%% Local Variables:
%%% mode: latex
%%% End:

1
book/sourdough_book.tex Symbolic link
View File

@@ -0,0 +1 @@
book.tex

View File

@@ -1,3 +1,5 @@
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;800&display=swap');
:root{
--ff-sans: 'Open Sans', sans-serif;
--fw-regular: 400;
@@ -145,6 +147,7 @@ nav.TOC a, nav.TOC a:visited{
/* *** Colors *** */
/* ************** */
body{
background-color: var(--c-beige);
}
@@ -251,10 +254,6 @@ figcaption.caption {
display: block;
}
.chapterToc a, .chapterToc, .likechapterToc a, .likechapterToc, .appendixToc a, .appendixToc, .addchapToc a {
font-weight: var(--fw-bold);
}
@media (max-width: 768px) {
.toggle-menu-label {
display: block;
@@ -318,7 +317,7 @@ figcaption.caption {
display: block;
color: #000;
font-size: 20px;
font-weight: var(--fw-bold);
font-weight: bold;
}
.chapterToc a, .sectionToc a, .subsectionToc a, .likechapterToc a {
@@ -499,7 +498,7 @@ blockquote {
border: 2px solid var(--c-black);
color: var(--c-black);
padding: 4px;
font-weight: var(--fw-bold);
font-weight: bold;
text-decoration: none;
}
.crosslinks-bottom a.prev {

View File

@@ -11,26 +11,4 @@
\Configure{AddCss}{book-ebook.css}
\Configure{CoverMimeType}{image/jpeg}
\CoverMetadata{cover/cover-page.jpg}
\AddToHook{env/tikzpicture/begin}{\fontfamily{opensans-TLF}\selectfont}
\Configure{@HEAD}{\HCode{
<style type="text/css">
@import url('https://fonts.cdnfonts.com/css/open-sans');
body{
font-family: 'Open Sans';
}
</style>}}
% Deal with chemical equations in a single svg
\ExplSyntaxOn
\def\standaloneenv#1{}
\pend:def\schemestart{\Picture+{}}
\append:def\CF_schemestop{\EndPicture}
\ExplSyntaxOff
\makeatletter
\def\texfourht@tikz@begin{
\protect\csname nested:math\endcsname% support display math
\Picture+[\csname a:Picture-alt\endcsname]{}%
}
\makeatother
\EndPreamble

View File

@@ -9,14 +9,6 @@
}}
\Configure{AddCss}{style.css}
\AddToHook{env/tikzpicture/begin}{\fontfamily{opensans-TLF}\selectfont}
\Configure{@HEAD}{\HCode{
<style type="text/css">
@import url('https://fonts.cdnfonts.com/css/open-sans');
body{
font-family: 'Open Sans';
}
</style>}}
\ConfigureEnv{titlepage}{\ifvmode\IgnorePar\fi\EndP\HCode{<main class="titlepage">}}{\ifvmode\IgnorePar\fi\EndP\HCode{</main>}}{}{}
% Mini TOC
@@ -47,17 +39,5 @@
}
\ConfigureToc{loc}{\HCode{<span class="lofToc">}}{\ }{}{\HCode{</span><br />}}
\ExplSyntaxOn
\def\standaloneenv#1{}
\pend:def\schemestart{\Picture+{}}
\append:def\CF_schemestop{\EndPicture}
\ExplSyntaxOff
\makeatletter
\def\texfourht@tikz@begin{
\protect\csname nested:math\endcsname% support display math
\Picture+[\csname a:Picture-alt\endcsname]{}%
}
\makeatother
\begin{document}
\EndPreamble

View File

@@ -15,13 +15,13 @@ push_docker_image: build_docker_image
docker push $(DOCKER_IMAGE):latest
# Books/website
serif_pdf:
$(DOCKER_CMD) "cd /opt/repo/book && make serif_pdf"
build_serif_pdf:
$(DOCKER_CMD) "cd /opt/repo/book && make build_serif_pdf"
ebook:
$(DOCKER_CMD) "cd /opt/repo/book && make ebook"
build_ebook:
$(DOCKER_CMD) "cd /opt/repo/book && make build_ebook"
pdf:
build_pdf:
$(DOCKER_CMD) "cd /opt/repo/book && make"
bake:
@@ -31,7 +31,7 @@ website:
$(DOCKER_CMD) "cd /opt/repo/book && make website"
booklet:
$(DOCKER_CMD) "cd /opt/repo/book && make booklet"
$(DOCKER_CMD) "cd /opt/repo/book && make build_booklet"
mrproper:
$(DOCKER_CMD) "cd /opt/repo/book && make mrproper"
@@ -48,8 +48,3 @@ print_os_version:
start_shell:
docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash
# Old names for backward compatibility
build_serif_pdf: serif_pdf
build_ebook: ebook
build_pdf: pdf

View File

@@ -79,7 +79,7 @@ class ModifyBuild
end
def is_cover_page?(filename)
["book.html", "index.html"].any? do |name|
["book_sans_serif.html", "index.html"].any? do |name|
filename.include?(name)
end
end
@@ -126,8 +126,8 @@ class ModifyBuild
def validate_file(text)
doc = build_doc(text)
stylesheets = doc.css("link[rel='stylesheet']").map{|attr| attr["href"] }
has_all_styles = %w(book.css style.css).all? { |required_stylesheet| stylesheets.include?(required_stylesheet) }
raise InvalidWebsiteFormat.new("No style tag style.css found in the website") unless has_all_styles
has_all_styles = %w(book_sans_serif.css style.css).all? { |required_stylesheet| stylesheets.include?(required_stylesheet) }
raise InvalidWebsiteFormat.new("No style tag style.css or book_sans_serif.css found in the website") unless has_all_styles
true
end
@@ -456,7 +456,7 @@ class ModifyBuild
doc.to_html
end
# Takes a name like "static_website_html/book.html" and returns "book.html"
# Takes a name like "static_website_html/book_sans_serif.html" and returns "book_sans_serif.html"
def extract_file_from_path(filename)
result = filename.split("/")
return filename if result.length == 1
@@ -483,6 +483,7 @@ class ModifyBuild
index_text = "The Sourdough Framework goes beyond just recipes and provides a solid knowledge foundation, covering the science of sourdough, the basics of bread making, and advanced techniques for achieving the perfect sourdough bread at home."
data = {
"book.html" => index_text,
"book_sans_serif.html" => index_text,
"index.html" => index_text
}
data[filename]
@@ -526,12 +527,6 @@ class ModifyBuild
el["href"] == ""
end
# Special case for index page
#if ["index.html", "book.html"].include?(filename)
# doc.css(".menu-items .chapterToc.home-link")[0].add_class("selected")
# return doc.to_html
#end
# Special case for the flowcharts page which is added by us to the menu.
# This needs to be done for future manually added pages too
if "listoflocname.html" == filename
@@ -561,7 +556,7 @@ class ModifyBuild
def add_canonical_for_duplicates(text, filename)
# Only applies to book.html which is a duplicate for index.html. The file
# is still needed though for proper display.
canonical_pages = ["book.html", "index.html"]
canonical_pages = ["book_sans_serif.html", "index.html"]
return text unless canonical_pages.include?(filename)
doc = build_doc(text)
head = doc.css("head")[0]