From fa91b6f06f8946850b91f3810206b2c80e70c3f4 Mon Sep 17 00:00:00 2001 From: cedounet <134267244+cedounet@users.noreply.github.com> Date: Thu, 13 Jul 2023 15:32:00 +0100 Subject: [PATCH] Komascript (#148) * Add chemfig package Somhow forgot it in chemical equation commit 8004497b * Change links colors to codeblue Closes https://github.com/hendricius/the-sourdough-framework/issues/142 * Use KOMA-Script and twosided printing Because it looks better. Also gets rid of headers/footers on empty pages * Fix tex4ebook and komascript clash See https://github.com/michal-h21/tex4ebook/issues/110 * Factor out packages into a sty file Separates style details out of the main file, now that we start having more and more style-related settings. * Remove parskip Not needed with Koma-script * Remove tocloft package Not needed with koma-script * Use tocbasics instead of floats to please kpmascript internal algorithm * Add a bit more breathing space in ToC so they are not stuck together at 11.11 onwards... --- book/book.tex | 77 ++-------------------------------------- book/book_sans_serif.tex | 4 ++- book/makefile | 2 +- book/sourdough.sty | 70 ++++++++++++++++++++++++++++++++++++ book/sourdough_book.tex | 1 + 5 files changed, 77 insertions(+), 77 deletions(-) create mode 100644 book/sourdough.sty create mode 120000 book/sourdough_book.tex diff --git a/book/book.tex b/book/book.tex index 14e3314..f3efa29 100644 --- a/book/book.tex +++ b/book/book.tex @@ -1,80 +1,8 @@ -\documentclass[a4paper, 12pt]{book} +\documentclass[a4paper, twoside, 12pt]{scrbook} % General packages -\usepackage[utf8]{inputenc} -\usepackage{blindtext} -\usepackage{graphicx} -\usepackage{booktabs} -\usepackage{longtable} -\usepackage{float} -\usepackage[T1]{fontenc} -\usepackage{tocloft} -% \usepackage{tex4ebook} -\usepackage{chemformula} -\usepackage{chemfig} -\usepackage{booktabs} -\usepackage{makecell} -\usepackage{siunitx} +\usepackage{sourdough} -\renewcommand\theadfont{\bfseries} - -\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'] - -% Fonts for accessibility -\ifdefined\isaccessible - \usepackage{helvet} - \renewcommand{\familydefault}{\sfdefault} -\fi - -% Kerning in footnotes -\usepackage{fnpct} - -% References -\usepackage[backend=biber]{biblatex} -\addbibresource{references.bib} - -% Clickable links in the table of contents -\usepackage[ocgcolorlinks]{hyperref} -\hypersetup{% - linktoc=all, - allcolors=codeblue -} - -% Folders where to search for images -\graphicspath{ - {images/} - {troubleshooting/} - {sourdough-starter/} - {troubleshooting/crumb-structures/} - {history/} - {images/external/} - {baking/} - {wheat-sourdough/} - {wheat-sourdough/shaping/} - {non-wheat-sourdough/} -} - -% Layout rules -\interfootnotelinepenalty=10000 -\advance\cftsecnumwidth 0.5em\relax -\advance\cftsubsecindent 0.5em\relax -\advance\cftsubsecnumwidth 0.5em\relax - -% Space between paragraphs -\usepackage[skip=5pt plus1pt, indent=0pt]{parskip} - -% Caption and figure size below images -\usepackage{caption} -\captionsetup[figure]{font=footnotesize} - -\DeclareSIUnit\degF{\text{°}F} % Basic attributes \author{Hendrik Kleinwächter} \title{The Sourdough Framework} @@ -91,7 +19,6 @@ \end{center} \end{titlepage} - % \tableofcontents \ifdefined\HCode\else\tableofcontents\fi diff --git a/book/book_sans_serif.tex b/book/book_sans_serif.tex index 4174a9f..0377a38 100644 --- a/book/book_sans_serif.tex +++ b/book/book_sans_serif.tex @@ -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} diff --git a/book/makefile b/book/makefile index 131c049..7a050a4 100644 --- a/book/makefile +++ b/book/makefile @@ -21,7 +21,7 @@ src_figures := $(wildcard figures/fig-*.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 +src_tex += supporters.csv sourdough.sty images := $(wildcard images/*/*.jpg) images += $(wildcard images/*/*.png) diff --git a/book/sourdough.sty b/book/sourdough.sty new file mode 100644 index 0000000..2d4d21b --- /dev/null +++ b/book/sourdough.sty @@ -0,0 +1,70 @@ +\ProvidesPackage{sourdough} +\usepackage[utf8]{inputenc} +\usepackage{blindtext} +\usepackage{graphicx} +\usepackage{booktabs} +\usepackage{longtable} +\usepackage{tocbasic} +\usepackage[T1]{fontenc} +\usepackage{chemformula} +\usepackage{chemfig} +\usepackage{booktabs} +\usepackage{makecell} +\usepackage{siunitx} + +\renewcommand\theadfont{\bfseries} + +\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'] + +% Fonts for accessibility +\ifdefined\isaccessible + \usepackage{helvet} + \renewcommand{\familydefault}{\sfdefault} +\fi + +% Kerning in footnotes +\usepackage{fnpct} + +% References +\usepackage[backend=biber]{biblatex} +\addbibresource{references.bib} + +% Clickable links in the table of contents +\usepackage[ocgcolorlinks]{hyperref} +\hypersetup{% + linktoc=all, + allcolors=codeblue +} + +% Folders where to search for images +\graphicspath{ + {images/} + {troubleshooting/} + {sourdough-starter/} + {troubleshooting/crumb-structures/} + {history/} + {images/external/} + {baking/} + {wheat-sourdough/} + {wheat-sourdough/shaping/} + {non-wheat-sourdough/} +} + +% Caption and figure size below images +\usepackage{caption} +\captionsetup[figure]{font=footnotesize} + + +\DeclareSIUnit\degF{\text{°}F} + +\RedeclareSectionCommand[ + tocindent=0pt, + tocnumwidth=35pt, +]{section} diff --git a/book/sourdough_book.tex b/book/sourdough_book.tex new file mode 120000 index 0000000..c0a4f0d --- /dev/null +++ b/book/sourdough_book.tex @@ -0,0 +1 @@ +book.tex \ No newline at end of file