Skip to content

Commit 1ed79b3

Browse files
committed
Fix various LaTeX issues around quote blocks and special characters
1 parent db2f18d commit 1ed79b3

25 files changed

Lines changed: 123 additions & 41 deletions

02_program_structure.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
= Program Structure =
66

7+
[chapterquote="true"]
78
[quote, _why, Why's (Poignant) Guide to Ruby]
89
____
910
And my heart glows bright red under my filmy, translucent skin and

03_functions.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
= Functions =
66

7+
[chapterquote="true"]
78
[quote, Donald Knuth]
89
____
910
People think that computer science is the art of geniuses but the

04_data.txt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
= Data Structures: Objects and Arrays =
77

8+
[chapterquote="true"]
89
[quote, Charles Babbage, Passages from the Life of a Philosopher (1864)]
910
____
1011
On two occasions I have been asked, ‘Pray, Mr. Babbage, if you put
@@ -446,7 +447,7 @@ number of times the various combinations of the two variables were
446447
observed. For example, we could take the event of eating pizza and
447448
put that in a table like this:
448449

449-
image::img/pizza-squirrel.svg[alt="Eating pizza versus turning into a squirrel",width="8cm"]
450+
image::img/pizza-squirrel.svg[alt="Eating pizza versus turning into a squirrel",width="7cm"]
450451

451452
_ϕ_ can be computed using the following formula, where n refers to the table:
452453

@@ -469,22 +470,22 @@ endif::html_target[]
469470

470471
ifdef::tex_target[]
471472

472-
latexmath:[\phi = \frac{n_{11}n_{00}-n_{10}n_{01}}{\sqrt{n_{1\bullet}n_{0\bullet}n_{\bullet1}n_{\bullet0}}}]
473+
pass:[\begin{equation}\phi = \frac{n_{11}n_{00}-n_{10}n_{01}}{\sqrt{n_{1\bullet}n_{0\bullet}n_{\bullet1}n_{\bullet0}}}\end{equation}]
473474

474475
endif::tex_target[]
475476

476-
The notation _n_~01~ indicates the number of measurements where the first
477+
The notation (!html _n_~01~!)(!tex pass:[$n_{01}$]!) indicates the number of measurements where the first
477478
measurement (pizza) is false (0) and the second measurement (squirrelness) is
478-
true (1). In this example, _n_~01~ is 4.
479+
true (1). In this example, (!html _n_~01~!)(!tex pass:[$n_{01}$]!) is 4.
479480

480-
The value _n_~1•~ refers to the sum of all
481+
The value (!html _n_~1•~!)(!tex pass:[$n_{1\bullet}$]!) refers to the sum of all
481482
measurements where the first variable is true, which is 10 in the
482-
example table. Likewise, _n_~•0~ refers to the sum of the measurements where
483+
example table. Likewise, (!html _n_~•0~!)(!tex pass:[$n_{\bullet0}$]!) refers to the sum of the measurements where
483484
the squirrel variable is false.
484485

485486
So for the pizza table, the part above the division line (the dividend)
486487
would be 1×76 - 9×4 = 40, and the part below it (the divisor) would be the
487-
square root of 10×80×5×85, or √340000. This comes out to _ϕ_ ≈ 0.069. This
488+
square root of 10×80×5×85, or (!html √340000!)(!tex pass:[$\sqrt{340000}$]!). This comes out to _ϕ_ ≈ 0.069, which
488489
is tiny. Eating pizza does not appear to have influence on the
489490
transformations.
490491

@@ -526,12 +527,12 @@ console.log(phi([76, 9, 4, 1]));
526527
(((square root)))(((sqrt function)))This is simply a direct translation
527528
of the _phi_ formula into JavaScript. `Math.sqrt` is the square root function,
528529
as provided by the `Math` object in a standard JavaScript environment.
529-
We have to sum two fields from the table to get fields like n~1•~
530+
We have to sum two fields from the table to get fields like (!html n~1•~!)(!tex pass:[$n_{1\bullet}$]!)
530531
because the sums of rows or columns are not stored directly in our
531532
data structure.
532533

533534
Jacques kept his journal for three months. The resulting data set is
534-
available in the coding sandbox for this chapter!!tex (`eloquentjavascript.net/code`)!!,
535+
available in the coding sandbox for this chapter(!tex (`eloquentjavascript.net/code`)!),
535536
where it is stored
536537
in the `JOURNAL` variable, and in a downloadable
537538
http://eloquentjavascript.net/code/jacques_journal.js[file].

05_higher_order.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
= Higher-Order Functions =
77

8+
ifdef::html_target[]
9+
10+
[chapterquote="true"]
811
[quote, Master Yuan-Ma, The Book of Programming]
912
____
1013
Tzu-li and Tzu-ssu were boasting about the size of their latest
@@ -14,6 +17,9 @@ already.' Master Yuan-Ma said, 'My best program has five hundred
1417
lines.' Hearing this, Tzu-li and Tzu-ssu were enlightened.
1518
____
1619

20+
endif::html_target[]
21+
22+
[chapterquote="true"]
1723
[quote, C.A.R. Hoare, 1980 ACM Turing Award Lecture]
1824
____
1925
There are two ways of constructing a software design: One way is to
@@ -407,7 +413,7 @@ console.log(JSON.parse(string).born);
407413
The variable `ANCESTRY_FILE`, available in the sandbox for this
408414
chapter as well as in
409415
http://eloquentjavascript.net/code/ancestry.js[a downloadable file] on
410-
the website!!tex (`eloquentjavascript.net/code`)!!,
416+
the website(!tex (`eloquentjavascript.net/code`)!),
411417
contains the content of my JSON file as a string. Let's decode it and
412418
see how many people it contains:
413419

06_object.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
= The Secret Life of Objects =
77

8+
[chapterquote="true"]
89
[quote, Joe Armstrong, interviewed in Coders at Work]
910
____
1011
The problem with object-oriented languages is they’ve got all this
@@ -716,7 +717,7 @@ anything interesting.
716717
The source data for the table of mountains that we are trying to build
717718
is available in the `MOUNTAINS` variable in the sandbox, and also
718719
http://eloquentjavascript.net/code/mountains.js[downloadable] from the
719-
list of data sets on the website!!tex (`eloquentjavascript.net/code`)!!.
720+
list of data sets on the website(!tex (`eloquentjavascript.net/code`)!).
720721

721722
We will want to highlight the top row, which contains the column
722723
names, by underlining the cells with a series of dash characters. No
@@ -1059,7 +1060,7 @@ done with the `Object.defineProperty` function. To compute the
10591060
distance from (0, 0) to (x, y), you can use the Pythagorean theorem, which
10601061
says that the square of the distance we are looking for is equal to
10611062
the square of the x coordinate plus the square of the y coordinate.
1062-
Thus √(x^2^ + y^2^) is the number you want, and `Math.sqrt` is the way
1063+
Thus (!html √(x^2^ + y^2^)!)(!tex pass:[$\sqrt{x^2 + y^2}$]!) is the number you want, and `Math.sqrt` is the way
10631064
you compute a square root in JavaScript.
10641065

10651066
!!solution!!

07_elife.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
= Project: Electronic Life =
77

8+
[chapterquote="true"]
89
[quote, Edsger Dijkstra, The Threats to Computing Science]
910
____
1011
[...] the question of whether Machines Can Think [...] is about as
@@ -969,8 +970,8 @@ var valley = new LifelikeWorld(
969970
);
970971
----
971972

972-
Let's see what happens if we run this. !!tex These snapshots
973-
illustrate a typical run of this world.!!
973+
Let's see what happens if we run this. (!tex These snapshots
974+
illustrate a typical run of this world.!)
974975

975976
ifdef::html_target[]
976977

08_error.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55

66
= Bugs and Error Handling =
77

8+
[chapterquote="true"]
89
[quote, Brian Kernighan and P.J. Plauger, The Elements of Programming Style]
910
____
1011
Debugging is twice as hard as writing the code in the first place.
1112
Therefore, if you write the code as cleverly as possible, you are, by
1213
definition, not smart enough to debug it.
1314
____
1415

16+
ifdef::html_target[]
17+
18+
[chapterquote="true"]
1519
[quote, Master Yuan-Ma, The Book of Programming]
1620
____
1721
Yuan-Ma had written a small program that used many global variables
@@ -21,6 +25,8 @@ this be?’ The master said, ‘There is no need to fetch a water hose
2125
when the house is not on fire.’
2226
____
2327

28+
endif::html_target[]
29+
2430
(((error handling)))A program is crystallized thought. Sometimes those
2531
thoughts are confused. Other times, mistakes are introduced when
2632
setting thought into code. Either way, the result is a

09_regexp.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,25 @@
44

55
= Regular Expressions =
66

7+
[chapterquote="true"]
78
[quote,Jamie Zawinski]
89
____
910
Some people, when confronted with a problem, think ‘I know, I'll use
1011
regular expressions.’ Now they have two problems.
1112
____
1213

14+
ifdef::html_target[]
15+
16+
[chapterquote="true"]
1317
[quote, Master Yuan-Ma, The Book of Programming]
1418
____
1519
Yuan-Ma said, ‘When you cut against the grain of the wood, much
1620
strength is needed. When you program against the grain of a problem,
1721
much code is needed.’
1822
____
1923

24+
endif::html_target[]
25+
2026
Programming tools and techniques survive and spread
2127
in a chaotic, evolutionary way. It's not always the pretty or
2228
brilliant ones that win, but rather the ones that function

10_modules.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
= Modules =
77

8+
ifdef::html_target[]
9+
10+
[chapterquote="true"]
811
[quote, Master Yuan-Ma, The Book of Programming]
912
____
1013
A beginning programmer writes her programs like an ant builds her
@@ -22,6 +25,8 @@ things in their simple form. Her programs are like clay, solid yet
2225
malleable.
2326
____
2427

28+
endif::html_target[]
29+
2530
Every program has a shape. On a small scale, this shape is determined
2631
by its division into functions, and the blocks inside those functions.
2732
Programmers have a lot of freedom in the shape they give their

11_language.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,24 @@
55

66
= Project: A Programming Language =
77

8+
[chapterquote="true"]
89
[quote, Hal Abelson and Gerald Sussman, Structure and Interpretation of Computer Programs]
910
____
1011
The evaluator, which determines the meaning of expressions in a
1112
programming language, is just another program.
1213
____
1314

15+
ifdef::html_target[]
16+
17+
[chapterquote="true"]
1418
[quote, Master Yuan-Ma, The Book of Programming]
1519
____
1620
When a student asked the master about the nature of the cycle of Data
1721
and Control, Yuan-Ma replied ‘Think of a compiler, compiling itself.’
1822
____
1923

24+
endif::html_target[]
25+
2026
Building your own programming language is surprisingly easy (as long as
2127
you do not aim too high) and very enlightening.
2228

0 commit comments

Comments
 (0)