Skip to content

Commit

Permalink
Feature/reformat part2 (#91)
Browse files Browse the repository at this point in the history
* begin reformatting part 2

* wip

* wip subtyping explanation

* wip

* wip

* wip

* final corrections in chapter 1

* clarify chapter 5

* wip

* final corrections
  • Loading branch information
winitzki authored Mar 29, 2024
1 parent c6a36c5 commit d2dce7f
Show file tree
Hide file tree
Showing 41 changed files with 1,901 additions and 947 deletions.
15 changes: 15 additions & 0 deletions sofp-src/check-punctuation-before-code-blocks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
for a in sofp*tex; do
b=linenumbers-p-$a
LC_ALL=C egrep -n -B1 '^(\\begin{lstlisting}|\\\[$)' "$a" \
| LC_ALL=C egrep -v '^[0-9]+-.*[]?$):%},.~] *$' \
| LC_ALL=C egrep '^[0-9]+-[^ ]' \
| LC_ALL=C sed -e 's/^x\([0-9][0-9]*\)-.*$/\1/' \
| LC_ALL=C sed -e 's/^\(.*\)$/"\1"/' > $b
test -s $b && {
echo "Warning: file $a has no punctuation before code blocks or display math at lines:"
cat $b
}
rm -f $b
# Output may contain several line numbers.
done
1 change: 1 addition & 0 deletions sofp-src/make_sofp_pdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ bash spelling_check.sh &
#draft_pages=`pdfPages "$draft".pdf`
bash check-consistent-labels.sh
bash check-lines_with_displaymath_in_new_paragraph.sh
bash check-punctuation-before-code-blocks.sh

if [ x"$1" == x-nolulu ]; then
# Create a pdf file without references to lulu.com and without lulu.com's ISBN.
Expand Down
6 changes: 5 additions & 1 deletion sofp-src/prepare_volume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,12 @@ esac
echo "Detected previous chapter $firstchapter, first page $firstpage, previous part number $firstpart"

sed -i.bak -e 's|\(of Functional Programming\)|\1, '"$title1"'|; s|\(\\part{.*}\)|\\setcounter{page}{'$firstpage'}\\setcounter{part}{'$firstpart'}\\setcounter{chapter}{'$firstchapter'}\1|;' $name.tex

# Subtitle on cover page.
sed -i.bak -e 's|% End of title.|\\vspace{0.2in}\\centerline{\\fontsize{20pt}{20pt}\\selectfont{'"$title2"'}}|' book_cover/sofp-cover-page-no-bg.tex
sed -i.bak -e 's|\(of Functional Programming\)|\1 - '"$title1"'|;' book_cover/sofp-spine.tex

# Title on spine.
sed -i.bak -e 's|\(of Functional Programming\)|\1, '"$title1"'|;' book_cover/sofp-spine.tex

# Replace lulu.com hyperlink.
sed -i.bak -e 's|{https://www.lulu.com/[^}]*}{\(Print on demand[^}]*\)}|{'"$url"'}{\1}|;' $name.tex
Expand Down
8 changes: 4 additions & 4 deletions sofp-src/sofp-appendices.lyx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
%\titlespacing{\subparagraph}{\parindent}{\parskip}{3\wordsep}
%\titlespacing{\paragraph}{0pt}{3pt}{2\wordsep}

\renewcommand*{\subsubsectionformat}{}
\renewcommand*{\subsubsectionformat}{} % This does not work if cleardoubleempty is given as a class option!
\RedeclareSectionCommand[ % Statement 1.2.3.4
runin=true,
afterskip=2ex,
Expand Down Expand Up @@ -191,7 +191,7 @@
\renewcommand{\ogreaterthan}{\boxrightarrow}
\renewcommand{\varogreaterthan}{\boxrightarrow}
\end_preamble
\options numbers=noenddot,index=totoc,bibliography=totoc,listof=totoc,fontsize=12pt
\options openright,numbers=noenddot,index=totoc,bibliography=totoc,listof=totoc,fontsize=12pt
\use_default_options true
\master sofp.lyx
\maintain_unincluded_children false
Expand All @@ -216,7 +216,7 @@
\output_sync 0
\bibtex_command default
\index_command makeindex
\paperfontsize 10
\paperfontsize 12
\spacing single
\use_hyperref true
\pdf_title "The Science of Functional Programming: A Tutorial, with Examples in Scala"
Expand Down Expand Up @@ -40152,7 +40152,7 @@ def payments[Person, Amount](data: Seq[Map[Person, Amount]]): Map[Person,

\begin_layout Plain Layout

data.flatMap(_.toSeq).groupBy(_._1).mapValues(_.map(_._2))
data.flatMap(_.toSeq).groupBy(_._1).map { case (k, v) => (k, v.map(_._2)) }
\end_layout

\end_inset
Expand Down
2 changes: 1 addition & 1 deletion sofp-src/sofp-appendices.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4781,7 +4781,7 @@ \subsubsection*{Exercise \ref{tuples-Exercise-12}}
~
\begin{lstlisting}
def payments[Person, Amount](data: Seq[Map[Person, Amount]]): Map[Person, Seq[Amount]] =
data.flatMap(_.toSeq).groupBy(_._1).mapValues(_.map(_._2))
data.flatMap(_.toSeq).groupBy(_._1).map { case (k, v) => (k, v.map(_._2)) }
\end{lstlisting}


Expand Down
6 changes: 3 additions & 3 deletions sofp-src/sofp-applicative.lyx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
%\titlespacing{\subparagraph}{\parindent}{\parskip}{3\wordsep}
%\titlespacing{\paragraph}{0pt}{3pt}{2\wordsep}

\renewcommand*{\subsubsectionformat}{}
\renewcommand*{\subsubsectionformat}{} % This does not work if cleardoubleempty is given as a class option!
\RedeclareSectionCommand[ % Statement 1.2.3.4
runin=true,
afterskip=2ex,
Expand Down Expand Up @@ -191,7 +191,7 @@
\renewcommand{\ogreaterthan}{\boxrightarrow}
\renewcommand{\varogreaterthan}{\boxrightarrow}
\end_preamble
\options numbers=noenddot,index=totoc,bibliography=totoc,listof=totoc,fontsize=12pt
\options openright,numbers=noenddot,index=totoc,bibliography=totoc,listof=totoc,fontsize=12pt
\use_default_options true
\master sofp.lyx
\maintain_unincluded_children false
Expand All @@ -216,7 +216,7 @@
\output_sync 0
\bibtex_command default
\index_command makeindex
\paperfontsize 10
\paperfontsize 12
\spacing single
\use_hyperref true
\pdf_title "The Science of Functional Programming: A Tutorial, with Examples in Scala"
Expand Down
Loading

0 comments on commit d2dce7f

Please sign in to comment.