Change flowchart color (#185)

* Change BG color to white

* Fix flowcharts where graphics overlap with text

* Increase border size

* change arrow style

* Allow standalone building of TikZ flowcharts

Useful for reference or website etc..

* Prevent manual hyphenation in TikZ diagrams

A Bit of a manual tweak.. but worth it to look nicer :D

* Add missing file for flowcharts

---------

Co-authored-by: Cedric <ced@awase.ostal>
This commit is contained in:
Hendrik Kleinwaechter
2023-08-19 16:35:02 +02:00
committed by GitHub
parent fad30fa1db
commit a8dc6dc210
13 changed files with 73 additions and 63 deletions

12
book/colors.tex Normal file
View File

@@ -0,0 +1,12 @@
\definecolor{codeblue}{RGB}{69, 161, 248}
\definecolor{codeblack}{RGB}{40, 40, 40}
\definecolor{maingray}{HTML}{F8F8F8}
\definecolor{hlocre}{HTML}{E5B874}
\definecolor{hlorange}{HTML}{EC7850}
\definecolor{hlyellow}{HTML}{FAE69E}
\definecolor{pinkpic}{RGB}{246, 183, 194}
\definecolor{redpic}{RGB}{232, 72, 71}
\definecolor{yellowpic}{RGB}{246, 235, 51}

View File

@@ -1,8 +1,15 @@
#!/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
#
if [ "$#" -ne 1 ]; then
for i in *.pdf
do
target=figures/`basename $1 .png.pdf`.png
docker run -v $(pwd):/imgs dpokidov/imagemagick -density 900 -trim /imgs/$i -quality 100 /imgs/${target}
rename 's/fig-/figure-/' *.png
done
else
target=figures/`basename $1 .png.pdf`.png
echo "Converting: " $1 " to: " ${target}
convert -density 900 -trim $1 -quality 100 ${target}
fi

View File

@@ -7,7 +7,7 @@
\node [decision, right of=ph_value, node distance=4cm] (dough_ready) {\footnotesize Dough ready?};
\node [success, below of=dough_ready] (divide_preshape) {\footnotesize Divide and preshape};
\node [decision, below of=smell] (dough_flattened) {\footnotesize Dough flattened out?};
\node [block, below of=check_dough, node distance=3cm] (wait_60_minutes) {\footnotesize Wait 60~minutes};
\node [block, below of=check_dough, node distance=3cm] (wait_60_minutes) {\footnotesize Wait\\ 60~minutes};
\node [block, below of=wait_60_minutes, node distance=4cm] (stretch_fold) {\footnotesize Stretch and fold};
\path [line] (init) -- (check_dough);

View File

@@ -7,7 +7,7 @@
\node [block, below of=spritz] (close) {\footnotesize Close DO};
\node [block, left of=close] (back_oven) {\footnotesize Place DO back in oven};
\node [block, left of=back_oven] (bake) {\footnotesize Bake 30~minutes at \qty{230}{\degreeCelsius} (\qty{446}{\degF})};
\node [block, below of=heat_oven] (wait_5_minutes) {\footnotesize Wait 5 minutes};
\node [block, below of=heat_oven] (wait_5_minutes) {\footnotesize Wait\\ 5 minutes};
\node [decision, below of=wait_5_minutes, node distance=4cm] (is_ready_check) {\footnotesize Core temperature \qty{92}{\degreeCelsius} (\qty{197}{\degF})?};
\node [block, right of=is_ready_check, node distance=4cm] (remove_do_lid) {\footnotesize Remove DO lid};
\node [block, right of=wait_5_minutes] (test_temperature_again) {\footnotesize Test core temperature again};

View File

@@ -1,10 +1,10 @@
\begin{tikzpicture}[node distance = 3cm, auto]
\node [start] (init) {\footnotesize Homogenize recipe ingredients};
\node [block, right of=init, node distance=3cm] (wait1) {\footnotesize Wait 15~minutes};
\node [block, right of=init, node distance=3cm] (wait1) {\footnotesize Wait\\15~minutes};
\path [line] (init) -- (wait1);
\node [block, right of=wait1, node distance=3cm] (knead1) {\footnotesize Knead 5~minutes};
\path [line] (wait1) -- (knead1);
\node [block, right of=knead1, node distance=3cm] (wait2) {\footnotesize Wait 15~minutes};
\node [block, right of=knead1, node distance=3cm] (wait2) {\footnotesize Wait\\15~minutes};
\path [line] (knead1) -- (wait2);
\node [decision, below of=wait2, node distance=3cm] (windowpane_test) {\footnotesize Window-pane?};
\path [line] (wait2) -- (windowpane_test);

View File

@@ -1,7 +1,7 @@
\begin{tikzpicture}[node distance = 3cm, auto]
\node [start] (init) {\footnotesize Make a regular or stiff starter};
\node [block, right of=init] (feed_new_ratio) {\footnotesize Mix \qty{1}{\gram} existing starter, \qty{5}{\gram} flour and \qty{25}{\gram} water};
\node [block, right of=feed_new_ratio] (next_day) {\footnotesize Wait \qty{24}{\hour}};
\node [block, right of=feed_new_ratio] (next_day) {\footnotesize Wait\\ \qty{24}{\hour}};
\node [block, below of=init, node distance=4cm] (feed_again) {\footnotesize Feed again using 1:5:25 ratio};
\node [block, right of=next_day, node distance=5cm] (test) {\footnotesize Check starter readiness?};
\node [decision, below of=next_day, node distance=4cm] (ready_signs) {\footnotesize Sour yogurty smell and bubbles visible on flour?};

View File

@@ -1,6 +1,6 @@
\begin{tikzpicture}[node distance = 3cm, auto]
\node [start] (init) {\footnotesize Mix \qty{50}{\gram} flour + \qty{50}{\gram} water, stir};
\node [block, right of=init, node distance=3cm] (wait1) {\footnotesize Wait \qty{24}{\hour}};
\node [block, right of=init, node distance=3cm] (wait1) {\footnotesize Wait\\ \qty{24}{\hour}};
\path [line] (init) -- (wait1);
\node [block, right of=wait1, node distance=3cm] (feed) {\footnotesize \qty{10}{\gram} of previous day + \qty{50}{\gram} water + \qty{50}{\gram} flour, stir};
\path [line] (wait1) -- (feed);
@@ -8,7 +8,7 @@
\path [line] (feed) -- (discard);
\node [decision, right of=feed, node distance=3.5cm] (decide) {\footnotesize Is good?};
\node [decision, above of=decide, node distance=3cm] (timeout) {\footnotesize Less than 10 feeds?};
\node [block, above of=feed, node distance=3cm] (wait2) {\footnotesize Wait \qty{24}{\hour}};
\node [block, above of=feed, node distance=3cm] (wait2) {\footnotesize Wait\\ \qty{24}{\hour}};
\node [fail, right of=timeout, node distance=3cm] (discard2) {\footnotesize Batch failed};
\path [line] (timeout) -- node{no} (discard2);
\path [line] (timeout) -- node{yes} (wait2);

View File

@@ -2,11 +2,11 @@
\node [start] (init) {\footnotesize Make a starter};
\node [block, right of=init, node distance=3cm] (feed) {\footnotesize Feed your starter};
\path [line] (init) -- (feed);
\node [block, right of=feed, node distance=3cm] (wait_12_after_feed) {\footnotesize Wait \qty{12}{\hour}};
\node [block, right of=feed, node distance=3cm] (wait_12_after_feed) {\footnotesize Wait\\ \qty{12}{\hour}};
\path [line] (feed) -- (wait_12_after_feed);
\node [block, right of=wait_12_after_feed, node distance=3cm] (ready_question) {\footnotesize Perform readiness check};
\path [line] (wait_12_after_feed) -- (ready_question);
\node [block, below of=feed, node distance=3cm] (wait_12) {\footnotesize Wait \qty{12}{\hour}};
\node [block, below of=feed, node distance=4cm] (wait_12) {\footnotesize Wait\\ \qty{12}{\hour}};
\path [line] (wait_12) -- (feed);
\node [decision, right of=ready_question, node distance=3.5cm] (is_bubbly) {\footnotesize Bubbly? Size Increase?};
\path [line] (ready_question) -- (is_bubbly);

View File

@@ -1,11 +1,11 @@
\begin{tikzpicture}[node distance = 3cm, auto]
\node [start] (init) {\footnotesize Make a regular or liquid starter};
\node [block, right of=init] (feed_new_ratio) {\footnotesize Mix \qty{10}{\gram} existing starter, \qty{50}{\gram} flour and \qty{25}{\gram} water};
\node [decision, right of=feed_new_ratio, node distance=3cm] (too_dry) {\footnotesize Starter very dry, hard to mix?};
\node [decision, right of=feed_new_ratio, node distance=3.5cm] (too_dry) {\footnotesize Starter very dry, hard to mix?};
\node [block, right of=too_dry, node distance=4cm] (add_water) {\footnotesize Add more water};
\node [block, below of=add_water, node distance=2cm] (next_day) {\footnotesize Wait \qty{24}{\hour}};
\node [decision, below of=too_dry, node distance=3cm] (repeated_3_times) {\footnotesize Stiff starter fed 3 times overall?};
\node [block, left of=repeated_3_times] (feed_again) {\footnotesize Feed again using 1:5:2.5 ratio};
\node [block, below of=add_water, node distance=2cm] (next_day) {\footnotesize Wait\\ \qty{24}{\hour}};
\node [decision, below of=too_dry, node distance=3.5cm] (repeated_3_times) {\footnotesize Stiff starter fed 3 times overall?};
\node [block, below of=feed_new_ratio, node distance=3.5cm] (feed_again) {\footnotesize Feed again using 1:5:2.5 ratio};
\node [decision, below of=repeated_3_times, node distance=3.5cm] (ready_signs) {\footnotesize Size increase and sour smell?};
\node [block, below of=next_day, node distance=2cm] (last_feed) {\footnotesize Feed one last time};
\node [success, below of=last_feed, node distance=3cm] (bread_dough) {\footnotesize Make bread dough};

View File

@@ -0,0 +1,21 @@
\tikzstyle{every picture}+=[font=\small\sffamily]
\usetikzlibrary{shapes,arrows}
\tikzstyle{decision} = [diamond, draw=codeblack, fill=codeblack, text=white,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt,
line width=2mm]
\tikzstyle{block} = [rectangle, draw=codeblack, fill=white, text=black,
text width=5em, text centered, rounded corners, minimum height=4em,
line width=0.4mm]
\tikzstyle{decision_start} = [diamond, draw=codeblack, fill=pinkpic, text=black,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt,
line width=0.4mm]
\tikzstyle{start} = [rectangle, draw=codeblack, fill=pinkpic, text=black,
text width=5em, text centered, rounded corners, minimum height=4em,
line width=0.4mm]
\tikzstyle{success} = [rectangle, draw=codeblack, fill=yellowpic, text=black,
text width=5em, text centered, rounded corners, minimum height=4em,
line width=0.4mm]
\tikzstyle{fail} = [rectangle, draw=codeblack, fill=redpic, text=black,
text width=5em, text centered, rounded corners, minimum height=4em,
line width=0.4mm]
\tikzstyle{line} = [draw, -latex', thick, ->,>=to]

View File

@@ -1,13 +1,6 @@
\documentclass[tikz]{standalone}
\usepackage{tikz}
\usepackage{siunitx}
\usepackage[mode=match, reset-text-family=false]{siunitx}
\DeclareSIUnit\degF{\text{°}F}
\definecolor{codeblue}{RGB}{69, 161, 248}
\definecolor{codegray}{RGB}{40, 40, 40}
\usetikzlibrary{shapes,arrows}
\tikzstyle{decision} = [diamond, draw, fill=codegray, text=white,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=codeblue, text=white,
text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\input{flowcharts_tikz.tex}
\input{../colors.tex}

View File

@@ -20,11 +20,11 @@ chapters = baking basics bread-types cover flour-types history intro\
wheat-sourdough
src_tables := $(wildcard tables/table-*.tex)
src_figures := $(wildcard figures/fig-*.tex)
src_figures := $(wildcard figures/fig-*.tex) figures/flowcharts_tikz.tex
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
src_tex += supporters.csv sourdough.sty colors.tex
images := $(wildcard images/*/*.jpg)
images += $(wildcard images/*/*.png)
@@ -48,12 +48,13 @@ tgt_figures := $(patsubst %.tex, %.png,$(src_figures))
# TODO: check if it works on github CI
%.png: %.tex
@echo "\input{./vars}" > $@.in
@echo "\input{./vars.tex}" > $@.in
# \b is backspace..
@echo "\\\begin{document}" >> $@.in
@cat $< >> $@.in
@echo "\end{document}" >> $@.in
@echo "\\\end{document}" >> $@.in
$(LATEX) $@.in
figures/export_figures.sh $@.pdf
%.xbb: %.jpg
ebb -x $<
@@ -167,6 +168,7 @@ clean_figures:
- $(CLEAN) $(patsubst %.tex, %.png.in, $(src_figures))
- rm $(patsubst %.tex, %.png.pdf, $(src_figures))
- rm $(patsubst %.tex, %.png.in, $(src_figures))
- rm $(wildcard figures/*.png.*)
- rm cover/cover-page.xbb
.PHONY: clean_ebook_build

View File

@@ -18,35 +18,10 @@
% For tables
\renewcommand\theadfont{\bfseries}
\definecolor{codeblue}{RGB}{69, 161, 248}
\definecolor{codeblack}{RGB}{40, 40, 40}
\definecolor{maingray}{HTML}{F8F8F8}
\definecolor{hlocre}{HTML}{E5B874}
\definecolor{hlorange}{HTML}{EC7850}
\definecolor{hlyellow}{HTML}{FAE69E}
\definecolor{pinkpic}{RGB}{246, 183, 194}
\definecolor{redpic}{RGB}{232, 72, 71}
\definecolor{yellowpic}{RGB}{246, 235, 51}
\tikzstyle{every picture}+=[font=\small\sffamily]
\usetikzlibrary{shapes,arrows}
\tikzstyle{decision} = [diamond, draw, fill=codeblack, text=white,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=codeblue, text=white,
text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{decision_start} = [diamond, draw, fill=pinkpic, text=black,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{start} = [rectangle, draw, fill=pinkpic, text=black,
text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{success} = [rectangle, draw, fill=yellowpic, text=black,
text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{fail} = [rectangle, draw, fill=redpic, text=black,
text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\input{colors.tex}
% Define flowcharts macros independently so we can build them as png files
% for the website or something. This is supported in the makefile
\input{figures/flowcharts_tikz.tex}
% Fonts
\defaultfontfeatures{Scale=MatchLowercase, Ligatures=TeX}
% Define Semi-bold
@@ -58,7 +33,7 @@
\else
\setmainfont{TeX Gyre Pagella}[Scale=1.0] % Or Palatino Linotype, etc.
% TODO not available on github CI
% \setmonofont{Andale Mono}[Scale=MatchLowercase]
% \setmonofont{Andale Mono}[Scale=MatchLowercase]
\fi
% Opens Sans in both case..
\setsansfont{Open Sans}[