1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LICENSE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2018 Terrence P. Murphy and Rosalie D'Amico.
% This file may be distributed and/or modified under the conditions of the LaTeX Project
% Public License (“LPPL”), either version 1.3c of this license or (at your option) any
% later version. The latest version of this license is at:
% http://www.latex-project.org/lppl.txt.
% This file is author-maintained and is one of the files that, collectively, make up the
% MAKECOOKBOOK bundle available at https://ctan.org/pkg/makecookbook
% For additional information, please see the associated README file.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[10pt]{article}
\emergencystretch 3em
\usepackage{enumitem,multicol,xcolor, textcomp, xparse, fancyvrb, array, graphicx}
\usepackage{ifluatex, ifxetex}
\ifluatex
\usepackage{fontspec}
\else
\ifxetex
\usepackage{fontspec}
\else
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\fi
\fi
\usepackage{geometry}
\geometry{
inner=1.0in,
outer=1.0in,
top=0.75in,
bottom=1in,
nomarginpar,
footskip=40pt}
\usepackage{titlesec}
\titlespacing{\subsubsection}{15pt}{5pt}{5pt}
\usepackage{chngcntr}
%\counterwithin*{section}{part}
\newcommand{\Cmd}[1]{\texttt{\textbackslash{}#1}}
\NewDocumentCommand \latex{o}{\IfNoValueTF{#1}{\LaTeX{} }{\LaTeX{}#1}}%
\NewDocumentCommand \tex{o}{\IfNoValueTF{#1}{\TeX{} }{\TeX{}#1}}%
\NewDocumentCommand \pdftex{o}{\IfNoValueTF{#1}{pdfTeX }{pdfTeX#1}}%
\NewDocumentCommand \luatex{o}{\IfNoValueTF{#1}{LuaTeX }{LuaTeX#1}}%
\NewDocumentCommand \xetex{o}{\IfNoValueTF{#1}{XeTeX }{XeTeX#1}}%
\NewDocumentCommand \pkg{m}{\texttt{#1}}
\NewDocumentCommand \boldit{m} {\textbf{\textit{#1}}}
\NewDocumentCommand \RedText{+m}{{{\color{red} #1}}}%
\NewDocumentCommand \Quote{m}{``#1"}
\NewDocumentCommand \NL{}{\par}
\newsavebox{\HatBox}
\AtBeginDocument{\savebox{\HatBox}[\hatwidth]{\MakeChefHat}}%
\NewDocumentCommand \ChefHat {}{\usebox{\HatBox}}%
\NewDocumentCommand \ChefNote {}{{\raisebox{.4ex}{\ChefHat}}}
%\newcommand*{\fvtextcolor}[2]{\textcolor{#1}{#2}} % for Verbatim/fancyvrb -- see Q 23091
\DefineVerbatimEnvironment{MyVerbatim}{Verbatim}{fontsize=\small, fontseries=b, xleftmargin=17pt}
\DefineVerbatimEnvironment{MyVerbatimNums}{Verbatim}{fontsize=\small, fontseries=b, numbers=left, xleftmargin=17pt}
\usepackage{xcolor}
\definecolor{clrBackSideNote}{rgb}{1.0, 0.95, 0.95} % red!5!white
\definecolor{clrFrameSideNote}{rgb}{0.75, 0.0, 0.0} % red!75!black
\definecolor{clrBackTip}{rgb}{1.0, 0.95, 0.95} % red!5!white
\definecolor{clrFrameTip}{rgb}{0.75, 0.0, 0.0} % red!75!black
\definecolor{clrBackCheffy}{rgb}{1.0, 1.0, 1.0} % white
\definecolor{clrFrameCheffy}{rgb}{0.0, 0.0, 0.75} % blue!75!black
\definecolor{clrBackNotes}{rgb}{1.0, 1.0, 1.0} % white
\definecolor{clrFrameNotes}{rgb}{0.0, 0.75, 0.0} % green!75!black
\definecolor{clrHyperRef}{cmyk}{0.00, 1.00, 1.00, 0.00} % true red
\usepackage{tcolorbox}
\tcbset{fonttitle=\rmfamily\large\bfseries}
\NewDocumentEnvironment{SideNote}{+m}
{
\begin{tcolorbox}[colback=clrBackSideNote,colframe=clrFrameSideNote, title=Side Note]
{#1}%
\end{tcolorbox}
}
\NewDocumentEnvironment{Tip}{+m}
{
\begin{tcolorbox}[colback=clrBackTip,colframe=clrFrameTip, title=Food for Thought]
{#1}%
\end{tcolorbox}
}
\NewDocumentEnvironment{Cheffy}{+m}
{
\begin{tcolorbox}[colback=clrBackCheffy,colframe=clrFrameCheffy, title=Let's Get Cheffy]
{#1}%
\end{tcolorbox}
}
\NewDocumentEnvironment{ChefNotes}{+m}
{
\begin{tcolorbox}[colback=clrBackNotes,colframe=clrFrameNotes,title=Chefnotes]
\ChefNote{}{#1}%
\end{tcolorbox}
}
\usepackage{xfrac}
\def\fr#1/#2 {\sfrac{#1}{#2} }
\def\frx#1/#2 {\sfrac{#1}{#2}}
%************ TIKZ DRAWINGS ************************************************
\usepackage{tikz}
\usetikzlibrary{calc}
\def\hatscale{0.05}
\def\hatwidth{12.5pt}
\NewDocumentCommand \MakeChefHat{}
{
\begin{tikzpicture}[scale=\hatscale]
\coordinate (HA) at (1.27, 0.635);
\coordinate (HB) at (5.87375, 0);
\coordinate (HC) at (1.5825, 0.9475);
\coordinate (HD) at (5.77375, 0.15);
\coordinate (HE) at (1.5875,1.905);
\coordinate (HF) at (1.8,1.74625);
\coordinate (HG) at (6.0325, 1.27);
\coordinate (HH) at (6.22, 1.33);
\coordinate (HI) at (6.45, 2.18);
\coordinate (HJ) at (6.35, 2.70);
\coordinate (HK) at (8.5725, 3.97);
\coordinate (HL) at (6.03, 4.7625);
\coordinate (HM) at (6.03, 3.651);
\coordinate (HN) at (2.2225, 5.3975);
\coordinate (HO) at (0.159, 4.603);
\coordinate (HP) at (1.587, 3.55);
\coordinate (HQ) at (2.5, 4.7625);
\coordinate (HR) at (2.778, 2.08);
\coordinate (HS) at (2.7, 4.1275);
\coordinate (HT) at (4.0, 1.98);
\coordinate (HU) at (4.286, 3.4925);
\coordinate (HV) at (5.3, 1.7);
\coordinate (HW) at (5.55, 2.85);
\coordinate (HX) at (4.286, 5.0);
%
\path[fill=black] (HA) to [bend left=20] (HB) to (HD) to [bend right=20] (HC) to (HA);
\path[fill=black] (HA) to (HC) to (HF) to (HE) to (HA);
\path[fill=black] (HE) to (HF) to [bend left=20] (HG) to (HH) to [bend right=20] (HE);
\path[fill=black] (HB) to (HD) to (HG) to (HH) to (HB);
\path[fill=black] (HH) to (HI) to (HJ) to (HG);
\draw[line width=5*\hatscale] (HI) to [bend right=50] (HK);
\draw[line width=5*\hatscale] (HK) to [bend right=50] (HL);
\draw[line width=5*\hatscale] (HL) to [bend right=45] (HX);
\draw[line width=5*\hatscale] ($(HX) + (0.4, -.4)$) to [bend right=45] (HN);
\path[fill=black] (HM) to ($(HL) -(0.15, 0)$) to ($(HL) + (0.15, 0)$) to (HM);
\draw[line width=5*\hatscale] (HN) to [bend right=50] (HO);
\draw[line width=5*\hatscale] (HO) to [bend right=50] (HP);
\draw[line width=5*\hatscale] ($(HF) +(0, 0.15)$) to (HP);
\path[fill=black] (HQ) to ($(HN) -(0.15, 0)$) to ($(HN) + (0.15, 0)$) to (HQ);
\path[fill=black] (HS) to ($(HR) -(0.15, 0)$) to ($(HR) + (0.15, 0)$) to (HS);
\path[fill=black] (HU) to ($(HT) -(0.15, 0)$) to ($(HT) + (0.15, 0)$) to (HU);
\path[fill=black] (HW) to ($(HV) -(0.15, 0)$) to ($(HV) + (0.15, 0)$) to (HW);
\end{tikzpicture}
}
\usepackage[bookmarks=true,colorlinks=true, allcolors=clrHyperRef]{hyperref}
\usepackage{bookmark}
% the following must be run AFTER hyperref has changed \counterwithin
\counterwithin*{section}{part}
\pdfstringdefDisableCommands{% see Q 10555
\def\latex{LaTeX }%
\def\Quote#1{"#1"}%
\def\pkg#1{#1}%
}
% see Q 193380
\NewDocumentCommand \MyLabel{o m}{\IfValueTF{#1}{\phantomsection}{} \label{#2}}
\begin{document}
\title{The \pkg{MakeCookbook} Bundle\NL Make a Cookbook Using \latex}
\author{Terrence P. Murphy \and Rosalie A. D'Amico}
\maketitle
\tableofcontents
\newpage
\part{Introduction}
\section{About}
The \pkg{makecookbook} bundle contains the files needed to create a nice quality family cookbook in a form ready to submit to most print-on-demand companies. Modifiable choices have been made regarding standard book features such as trim size, margins, headers/footers, chapter heading formatting, front matter (copyright page, table of contents, etc.) and back matter (index). Commands and environments have been created to format the food stories and recipes. The user will need to: (1) supply their own food stories and recipes(!), and (2) select (install if necessary) the needed fonts.
The design, layout and typography for cookbooks varies substantially, so we necessarily take a \Quote{point of view} on the desired look of the cookbook. However, even if your goal is a significantly different layout, you may find this work helpful in thinking through and implementing your design.
Please note that no new document class or package is included here. Rather, we provide a modifiable preamble and a small number of other files that, together, fully support creation of all of the \textit{internal} pages of a cookbook (i.e., everything except the cover art). We may refer to the \pkg{makecookbook} \Quote{package} in this documentation -- by that we mean package in a broader sense and do \textit{not} mean an actual .sty style package.
\section{Preliminaries}
\subsection{Requirements}
\subsubsection{Compiler}
The \pkg{makecookbook} bundle uses the \pkg{fontspec} package. That means it must be compiled with either Lua\TeX{} or Xe\TeX. We have only tested with Lua\TeX . However, we have not used Lua code, so we expect you should be successful (after a possible tweak or two) with an Xe\TeX{} compile.
\subsubsection{Fonts}\MyLabel{IntroFonts}
The \pkg{makecookbook} bundle assumes you have installed the three fonts listed below. (All are licensed under the SIL Open Font License, Version 1.1). To have a successful compile \Quote{out of the box}, these fonts must be installed on your system:
\begin{center}
\begin{tabular}{ >{\bfseries} l | >{\itshape}l | l | l }
\hline
Serif & EB Garamond & TrueType & Version from Google Fonts\\ \hline
Sans Serif & Lato & TrueType & Version from \pkg{www.latofonts.com} \\ \hline
Script & Italianno & OpenType & Version from Google Fonts\\
\hline
\end{tabular}
\end{center}
Please note: we assume that the \textit{EB Garamond} and \textit{Italianno} fonts were obtained from Google Fonts, and that the \textit{Lato} font was obtained from \pkg{http://www.latofonts.com}. These fonts \textit{do not} required installation of any font-related packgages other than \pkg{fontspec}.
Beginning on page \pageref{Fonts}, we discuss how you can easily substitute your own favorite OpenType (including TrueType flavored) fonts, subject only to certain requirements regarding feature set.
\subsection{License}
Copyright \copyright{} 2018 Terrence P. Murphy and Rosalie A. D'Amico. This work may be distributed and/or modified under the conditions of the \latex Project Public License (“LPPL”), either version 1.3c of this license or (at your option) any later version. The latest version of this license is at:
\quad \pkg{http://www.latex-project.org/lppl.txt}.
\noindent This work is author-maintained and consists of the files listed in the FILES section of the README file.
The \pkg{makecookbook} bundle includes an example cookbook with seven recipes. Those recipes are courtesy of Rosalie D'Amico\footnote{D'Amico, Rosalie A. \textit{Mama, How Do You Make...}. (self-published, 2018).}.
You are, of course, welcome to try them! They are included in the bundle to provide real-world examples of using \latex code to enter recipes. We only ask that you consider those recipes as for you personal use and not (without attribution) for further food-related publication (further publication OK in a \latex context).
\subsection{Contact Information / Feedback}
No doubt, this documents contains typos, poorly explained (or unexplained) items, and other errors. It is equally likely the \pkg{makecookbook} package includes coding errors. We value your feedback. Please report problems or make other suggestions to Terry Murphy: \pkg{latex@rd-tpm.com}.
\subsection{Version Information / Change History}
Version 0.85 dated \date{\today}. This is the initial version of the \pkg{makecookbook} bundle.
\subsection{The \latex Community / StackExchange}
In this \pkg{makecookbook} package, much of the code (except for the mistakes!) is not original. When we ran into difficulties, we usually turned to \pkg{tex.stackexchange.com} for help. We often found solutions in previous questions and answers, but sometimes had to ask our own questions. The \latex community is amazingly generous with their time.
You may see in the text or in the comments to the code something like \Quote{See Q 59619}. That is a reference to a specific question and answer on \pkg{tex.stackexchange.com}. You can often track it down by a Google search of \Quote{latex 59619}; if that doesn't work, try \Quote{tex.stackexchange.com 59619}.
\section{Installing \pkg{makecookbook}}
Go to the CTAN homepage of the \pkg{makecookbook} package: \pkg{https://ctan.org/pkg/makecookbook}. On that page you can download the complete zip file using the download button next to \Quote{\textit{Download the contents of this package in one zip archive}}. After unzipping, you will have the following files and directories:
\begin{MyVerbatim}
makecookbook/
| README
| makecookbook-doc.tex
| makecookbook-doc.pdf
|
|--- mycookbook/
| makecookbook.tex
| makecookbook.pdf
| cb-preamble.tex
| cb-lettrine.cfl
| cb-idxstyle.ist
|
|--- tex/
| cb-frontmatter.tex
| cb-chapterA.tex
| cb-chapterB.tex
|
|--- img/
cb-imageA.jpg
cb-imageB.jpg
\end{MyVerbatim}
Copy the \pkg{mycookbook} directory (including all its subdirectories and files) to you \latex project area. Choose a location so that the \pkg{mycookbook} directory is the root directory of your cookbook project.
Next, download and install\footnote{We are not experts on font installation. Because we load fonts by filename, our understanding is that you just need to follow the normal instructions of your operating system for installing a system font. That's all we did for our Windows 10 system. If you run into problems, first verify that the installed font is available for other non-\latex programs. Beyond that, check the \luatex documentation, check the \pkg{fontspec} documentation, or ask a question at \pkg{tex.stackexchage.com}.}
the three required fonts. Get \textit{EB Garamond} and \textit{Italianno} from Google Fonts. Get \textit{Lato} from \pkg{http://www.latofonts.com/}. We highly recommend that you download the three fonts from those sources to ensure you have the same versions as we have used, with the same filenames.
Once the fonts are installed, you will be able to build the initial version of your cookbook by doing a Lua\TeX{} compile (or two) of \pkg{makecookbook.tex}.
If you decide to substitute you own fonts for any of the three fonts, you cannot compile until you modify \pkg{cb-preamble.tex} to associate your selected fonts with your cookbook project. Instructions on how to make the required modifications are given, beginning on page \pageref{Fonts}.
\section{How This Document is Organized}
Before we discuss the details of the \pkg{makecookbook} files and our \latex code, we first (in Parts II and III) look at the cookbook-writing project at a higher level:
\begin{description}
\item[Part II - Managing/Organizing Your Cookbook Files.] Keeping a book size project well organized is critical. We start by describing our approach to organizing the cookbook files.
\item[Part III - Elements of a Book/Cookbook.] Next, we provide an \textit{overview} of the key elements that make up a cookbook. This include elements common to most any book (title page, table of contents, chapters, index, etc.), as well as elements particular to a cookbook (recipe names, ingredients, steps, etc.). All of the elements listed here will be discussed in detail further below.
\end{description}
Then, we dig deeper into the elements that make a book/cookbook:
\begin{description}
\item[Part IV - Elements of a Book - the Details.] We list and discuss the key elements that are common to most books. We describe the choices we made regarding each element and, where appropriate, we describe how you can make a different choice for that element.
\item[Part V - Elements of a Book - the Details (Fonts).] Due to the length of this discussion, and due to the importance of font selection and usage, we break this topic out separately.
\item[Part VI - Elements of a Cookbook - the Details.] We list and discuss the elements that are particular to cookbooks. For each element, we describe the \latex commands and environments you will use to include that element in your cookbook, including any options that have been programmed into those commands and environments. Using the files provided and the information discussed here, you should have the tools to make a complete cookbook.
\item[Part VII - The PDF File.] We discuss the sometimes conflicting requirements for building a PDF file for a digital cookbook (with bookmarks and links) versus building a PDF file for submittal to a print-on-demand company.
\item[Part VIII - Examples.] We present and discuss several recipe examples. This allows you to see real world examples of the \latex commands and environments needed to make your cookbook.
\end{description}
\newpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\part{Managing/Organizing Your Cookbook Files}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Writing a cookbook is a large project. Early on, you should think through how you will manage your cookbook files. We describe below our fairly standard approach to organizing a book-size document in \latex[:]\footnote{See, e.g.: https://en.wikibooks.org/wiki/LaTeX/Modular\_Documents}
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item Create a directory devoted exclusively to the cookbook. We will call that directory the \textit{root directory} of the cookbook (in the files distributed with the \pkg{makecookbook} package, we call that directory \pkg{mycookbook}). All other directories used in the cookbook project will be referenced relative to the root directory. The root directory holds: (1) a one-page \pkg{makecookbook.tex} file that includes the instructions needed to pull all of the cookbook files together, (2) the \pkg{cb-preamble.tex} file that includes the \latex packages and programming code used by the cookbook, and (3) any special files needed by \pkg{cb-preamble.tex} (in our case, the \pkg{cb-lettrine.cfl} and \pkg{cb-idxstyle.ist} files).
\item Create two subdirectories under the root directory, one called \texttt{tex} and one called \texttt{img}. The \texttt{tex} directory holds a \pkg{.tex} file for each chapter of the cookbook (plus \pkg{cb-frontmatter.tex}). The \texttt{img} directory holds any image files used in the cookbook.
\end{itemize}
It is helpful to see the full contents of the \pkg{makecookbook.tex} file. This file brings in the preamble, the front matter and the cookbook chapters and handles a few other \Quote{housekeeping} items:
\begin{MyVerbatim}
\documentclass[11pt]{book}
\input{cb-preamble}
\begin{document}
\frontmatter
\include{./tex/cb-frontmatter}
\mainmatter
\include{./tex/cb-chapterA}
.
. (you include here all of the chapters of your cookbook)
.
\include{./tex/cb-chapterB}
\backmatter
\CookbookIndex{}
\end{document}
\end{MyVerbatim}
\newpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\part{Elements of a Book/Cookbook}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Here we present an \textit{overview} of the elements that make up a book (in general), plus the special additional elements that make up a cookbook.
An excellent source for the elements of a book is \textit{A Few Notes on Book Design} by Peter Wilson\footnote{https://ctan.org/pkg/memdesign}. Although the entire article is well worth reading, see in particular \textit{Chapter Two - The Parts of a Book}.
\section{Elements of a Book}
We list here some of the typical elements of a book. The first five are very basic elements:
\begin{description}
\item[Trim Size] The physical size (height x width) of the paper used to print the book.
\item[Margins] In its simplest form, this is the top, bottom, inner and outer margins of the text area. Allowances must also be made for the areas where any header or footer is printed.
\item[Headers and Footers] This is where (above or below the text area) things like page number and current chapter name/number are printed.
\item[Chapter Title Formatting] The chapter name/number as printed on the first page of each new chapter.
\item[Fonts] Selection of fonts and choice of point size both play a fundamental role in all books.
\item[Odds and Ends] We will briefly consider a few other elements, such as color, drop caps and images.
\end{description}
Next we list the elements associated with the three traditional areas of a book: the front matter, the main matter and the back matter:
\begin{description}
\item[Front Matter] This is the first part of the book, and includes an assortment of preliminary information. Typically, in this order, there is a title page, a copyright page, a dedication page, and a table of contents, all of which may be followed by one or more short chapters such as a preface or acknowledgments.
\item[Main Matter] This is the heart of the book. We follow the typical case where the main matter consists only of the chapters of the book.
\item[Back Matter] We follow the typical case where the back matter contains the book index. This is where you might include other ancillary information such as a bibliography, an appendix, notes, etc.
\end{description}
\section{Elements of a Cookbook}
\begin{description}
\item[Chapter Intro] In a cookbook, chapters tend to be organized into logical units such as cookies, desserts, pasta, appetizers, etc. Following the chapter name, there will usually be some introductory text for that chapter. We call that the \textit{chapter intro}.
\item[Recipe Name and Yield] A new recipe is introduced with a recipe name and, often, with information regarding the ``yield" of the recipe (e.g., ``makes 36 cookies" or ``serves 4 to 6", etc.).
\item[Recipe Intro/Story] Often there is a story or other information specific to a recipe.
\item[Ingredients and Steps] Following the recipe name/yield and (possibly) a recipe story, there is a list of the ingredients, plus the steps required to make the recipe.
\item[Attribution] If the source of the recipe is known, it is proper to acknowledge that source.
\item[Additional Comments/Advice] There may be some recipe side notes and/or advice that is not properly included within the recipe, but is noted afterwards.
\end{description}
\newpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\part{Elements of a Book -- the Details}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Terminology}
We define here some of the terms used below. Our book is two-sided, so visualize an open book with both the left and right page visible.
The terms \boldit{recto} and \boldit{verso} (from the Latin) refer to the text written or printed on the right (front) side and on the left (reverse or back) side of a leaf of paper. By book publishing convention, the first page of a book, and the start of each chapter of a book, is on a recto page. That means all recto pages will have odd page numbers and all verso pages will have even page numbers.
Still visualizing our open book, the \boldit{outer margin} is the right margin on a right/recto page and the left margin on a left/verso page -- the margin \textit{away from} the book binding. Similarly, the \boldit{inner margin} is the left margin on a recto page and the right margin on a verso page -- the margin \textit{closest to} the book binding.
\section{Trim Size and Margins}
In deciding on the trim size of the cookbook, we started with two requirements: (1) for the main text, we wanted an easily readable font size of at least 11 points, and (2) with very few exceptions, we wanted all recipes to fit on one page. With trial and error on margins and possible use of multiple columns, plus research on best practices in typography, and testing of various fonts, we ended up with the trim size and margins described below. Then we used the \pkg{geometry} package to set those parameters.
We chose an industry standard trim size of 8{\thinspace}x{\thinspace}10 inches. That trim size allows for printing by most print-on-demand printing companies.
It is tempting to set small margins to allow for more text on the page. Typographers have given much thought to these matters and it just isn't that simple. A useful discussion is found in Chapter 2 of the KOMA-script documentation\footnote{https://ctan.org/pkg/koma-script}. As a result, we increased our margins well beyond our initial instincts. Even so, there is still not as much margin space as some experts might like.
We set the outer margins to 1.0 inch. When the book is open, you see both sides of the inner margin together; it is therefore recommended that you set the inner margins to one-half the outer margin (here, 0.5 inch). Visually, it is as if you had three margins: a 1-inch verso outer margin, a 1-inch combined recto/verso inner margin, and a 1-inch recto outer margin. You should also add a \textbf{\textit{binding offset}} to compensate for the part of the inner margin that disappears into the binding -- we have set the binding offset (for \textit{each} side of the inner margin) to 0.375 inches.
Because we are using footers but not headers, we have set the top margin to 0.75 inches and the bottom margin to 1.0 inch. That leaves the text area at 6.125{\thinspace}x{\thinspace}8.25 inches, about 63\% of the full page size.
We have set the distance between the bottom of the text area and the baseline of the footer to 40 points, which seems to give a nice separation between the text area and the footer.
The above is obtained with the following \pkg{geometry} package settings:
\begin{MyVerbatim}
\usepackage{geometry}
\ifCookbookDraft
\geometry{paper=letterpaper, % the physical paper size during draft mode
layoutsize={8in,10in}, % always use intended final paper size for layout
layouthoffset=0.25in, % center the "layout" horizontally
layoutvoffset=0.5in, % center the "layout" vertically
%showframe, % use when needed
showcrop}
\else
\geometry{papersize={8in,10in}} % the physical paper size in final production mode
\fi
\geometry{nomarginpar, % do not reserve space for margin notes
bindingoffset=0.375in,
inner=0.5in,
outer=1in,
top=0.75in,
bottom=1in,
footskip=40pt} % default seems to be 27pt
\end{MyVerbatim}
\MyLabel[1]{Geometry}When you submit your cookbook to a print-on-demand printer, the PDF file's metadata must show the paper size equal to the intended trim size. In the \pkg{geometry} package, this is done by making sure that \pkg{papersize} equals \pkg{layoutsize}. However, during the time you are working on your cookbook (in draft mode), you want to set the \pkg{geometry} package \pkg{papersize} equal to the physical size of the paper coming out of your local printer. In our case, we are printing draft pages in \pkg{letterpaper} size (8.5 x 11 inches). You manage this draft vs.{}\thinspace final difference, by setting the \Cmd{newif} value of \Cmd{ifCookbookDraft} to \Cmd{CookbookDrafttrue} (draft) or \Cmd{CookbookDraftfalse} (final). You will find these settings near the very top of \pkg{cb-preamble.tex}.
Just modify the above \pkg{geometry} settings for your needed trim size, draft paper size, margins, etc.
\section{Headers and Footers}
\latex sets headers and footers with the \pkg{pagestyle} command. Several page\-styles are predefined by \latex[,] but you are also allowed to define your own. We are using the \pkg{book} document class, which by default uses: (1) the predefined \pkg{empty} pagestyle (no header or footer on the page), (2) the predefined \pkg{plain} pagestyle (no header, the footer contains only a centered page number), and (3) a modified version of the predefined \pkg{headings} pagestyle.
In the cookbook, we use the \pkg{empty} pagestyle, a modified version of the \pkg{plain} pagestyle, plus a \pkg{main} pagestyle that we define. We use the \pkg{fancyhdr} package to redefine the \pkg{plain} pagestyle and to define our own \pkg{main} pagestyle, as follows:
\begin{MyVerbatim}
\usepackage{emptypage, fancyhdr} % for emptypage, see Q360739
% NOTE: RO = right/odd; LE = left/even; CE = center/even; CO = center/odd
\fancypagestyle{plain}{%
\fancyhf{} % clear the header and footer
\renewcommand{\headrulewidth}{0pt} % use 0 to disable header ruler line
\renewcommand{\footrulewidth}{0.2pt}
\fancyfoot[RO, LE] {Page \thepage}}
\makeatletter % \makeatletter must be OUTSIDE the command - see Q 444532
\fancypagestyle{main}{ % identical to plain, except in mainmatter, where
% it includes \leftmark in the center of the footer
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.2pt}
\fancyfoot[RO, LE] {Page \thepage}
\fancyfoot[CE,CO]{\if@mainmatter \leftmark\fi}} % See Q340125
\makeatother
\end{MyVerbatim}
The above code does as follows:
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item By loading the \pkg{emptypage} package, we force all completely empty pages to use the \pkg{empty} pagestyle.
\item The redefined \pkg{plain} pagestyle: (1) has no header and no header-area rule line, (2) has a footer-area rule line that is 0.2 points thick, and (3) prints the page number at the outer margin -- the right side of the footer on \textit{recto} (odd numbered) pages and the left side of the footer on \textit{verso} (even numbered) pages.
\item The \pkg{main} pagestyle is identical to the redefined \pkg{plain} pagestyle, except, \textit{in the mainmatter area only}, it prints the \Cmd{leftmark} in the center of the footer on both even and odd numbered pages. In the \pkg{book} class, the \Cmd{leftmark} is in all-caps and looks like \Quote{CHAPTER 2. COOKIES}. %is \Quote{CHAPTER} followed by the chapter number (Arabic) and the chapter name.
\end{itemize}
With our pagestyles defined, we now describe how they are used. We follow a very typical approach to headers and footers in printed books:
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item Empty Page: if a page is otherwise completely empty, we use the \pkg{empty} pagestyle. This rule applies through the frontmatter, mainmatter and backmatter, \textit{and supersedes all other rules}. An empty page happens, for example, when a chapter ends on a recto page. Since all new chapters start on a recto page, the intervening verso page is completely empty.
\item Frontmatter: We employ the \pkg{empty} pagestyle from the beginning (title page) up to and including the page just before the \Cmd{tableofcontents} page. Then, from that page through the end of the frontmatter, we employ the (redefined) \pkg{plain} pagestyle. We follow the default rule for the \pkg{book} class, where frontmatter page numbers are indicated by small roman numerals. Note that there is “pagination” (page counting) from the first page, but only printing of the page number after switching to the \pkg{plain} pagestyle.
\item Mainmatter: We employ the \pkg{main} pagestyle, except on the first page of each \Cmd{chapter}, which switches to the redefined \pkg{plain} pagestyle (this switch is the default book class \Cmd{chapter} behavior, so requires no coding by us). Page numbers are arabic, with page 1 being the first page of the first mainmatter chapter.
\item Backmatter: We employ the \pkg{plain} pagestyle. Page numbers are arabic, and continue with the pagination from the mainmatter.
\end{itemize}
Our code only needs to issue two \Cmd{pagestyle} commands: (1) we include \Cmd{pagestyle\{empty\}} as the first line of \pkg{cb-frontmatter.tex}, and (2) we include \Cmd{pagestyle\{main\}} just after the \Cmd{tableofcontents} command in \pkg{cb-frontmatter.tex}. (Recall that the \pkg{main} pagestyle is identical to the \pkg{plain} pagestyle in the frontmatter and backmatter). To implement our rule for empty pages, we load the \pkg{emptypage} package, which automatically applies the \pkg{empty} pagestyle to all empty pages.
The \pkg{fancyhdr} documentation is a good source of additional information on these matters.
\section{Chapter Title Formatting}
We use the \pkg{titlesec} package for the formatting of chapter titles. Following are some key concepts of the \pkg{titlesec} package:
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item The \boldit{label} means the basic chapter information, such as ``Chapter 6".
\item To obtain the current \boldit{label}, you use the \Cmd{chaptertitlename} command (to obtain ``Chapter") and the \Cmd{thechapter} command (to obtain the current chapter number). Importantly, per the \pkg{book} class default, both of those commands are blank in the frontmatter and backmatter, so we only obtain a non-empty \boldit{label} in the mainmatter.
\item The \boldit{title body} means the text identifying the current chapter, such as ``Sauces and Chutneys".
\item the \boldit{title} means the entire chapter title (\textit{label} plus \textit{title body}).
\item Two commands are provided to change the \boldit{title} format. The \Cmd{titleformat} command is used for the “internal” format (i.e., shape, font, label, etc.) and the \Cmd{titlespacing} command defines the “external” format (i.e., spacing before and after, etc.).
\end{itemize}
Following is our code:
\begin{MyVerbatim}
\usepackage{titlesec}
\titleformat{\chapter}[display] % [display] puts the label in a separate paragraph
{\filleft\FontChapterLabel} % The format for the whole title (label and title body text)
{\chaptertitlename\ \thechapter} % This defines the text for the label
{1pt} % The horizontal separation between label and title body:
% Next is optional code preceding the title body. We change
% the title body font from the initial setting above.
% we include \raggedleft because text may exceed one line.
{\titlerule\vspace{1ex}\raggedleft\FontChapterTitle}
\titlespacing*{\chapter} % The starred version kills the indentation of the
% paragraph following the title.
{0pt} % amount to increase left margin
{20pt} % vertical space before title
{20pt} % verticle space between title and text
\end{MyVerbatim}
The \pkg{titlesec} documentation is a good source of additional information on these matters.
\section{Odds and Ends}
\subsection{Color}\MyLabel{Color}
An important decision in a cookbook is whether to print in black and white or color. The printing costs can be substantially different. One option is to first print a small number of books in black and white, live with the book for a while, edit as necessary, and then move to color printing when you are fully satisfied with the final product.
Our approach is to define all colors used in the cookbook in one place in the preamble. We use the \pkg{xcolor} package and the \Cmd{definecolor} command to create our defined names for all of our colors. That allows us (in one place) to change those color definitions to accommodate either a black and white or color cookbook.
You should check with your print on demand printer to determine whether they prefer (or require) either the CMYK or RGB color model. In our code, below, we provide examples of both color models:
\begin{MyVerbatim}
\usepackage{xcolor}
\definecolor{clrWhite}{cmyk}{0.00, 0.00, 0.00, 0.00} % true white
\definecolor{clrBackTip}{rgb}{1.0, 0.95, 0.95} % red!5!white
\definecolor{clrFrameTip}{rgb}{0.75, 0.0, 0.0} % red!75!black
\definecolor{clrBackCheffy}{rgb}{1.0, 1.0, 1.0} % white
\definecolor{clrFrameCheffy}{rgb}{0.0, 0.0, 0.75} % blue!75!black
\definecolor{clrBackNotes}{rgb}{1.0, 1.0, 1.0} % white
\definecolor{clrFrameNotes}{rgb}{0.0, 0.75, 0.0} % green!75!black
\definecolor{clrLettrineBig}{gray}{0.5}
\definecolor{clrLettrineSmall}{gray}{0.5}
\definecolor{clrIngTitle}{cmyk}{0.00, 1.00, 1.00, 0.00} % true red
\definecolor{clrEditNote}{cmyk}{0.00, 1.00, 1.00, 0.00} % true red
\definecolor{clrHyperRef}{cmyk}{0.00, 1.00, 1.00, 0.00} % true red
\end{MyVerbatim}
See the \pkg{xcolor} package for helpful information on the CMYK and RGB color models.
\subsection{Drop Cap}\MyLabel{DropCap}
A \textit{drop cap letter} is a single letter (usually at the beginning of a chapter or important paragraph) that is larger than the following text. The practice began more than 2,000 years ago. Originally, the drop cap was very ornate and several lines high. As typesetting took hold in the mid 15th century, the typesetter would leave the necessary blank space to allow for a hand-drawn drop cap. The drop cap served two purposes: (1) it was a decorative element and (2) it assisted the reader by dividing the text into different parts. By the latter part of the 19th century, drop caps had mostly lost their ornamental flourish and usually consisted only of a larger letter (maybe sized to two or three lines) signifying the start of a chapter or section.
There was a substantial reduction in the use of drop caps at the beginning of the 20th century. More recently, there has been a bit of a revival. Our review of modern cookbooks found that it now quite common, but hardly universal. We have elected to use drop caps in the chapter intro and in the recipe story, but our code does not require it. We use the \pkg{lettrine} package to implement our drop caps (\Quote{lettrine} is the French word for drop caps). As is customary, the \pkg{lettrine} package (optionally) uses a different font style for the first several characters following the drop cap (by default they are set to small caps). We call these special characters the \textit{drop caps text}. Our code:
\begin{MyVerbatim}
\usepackage{lettrine}
\renewcommand{\LettrineFontHook}{\MyScriptFont\color{clrLettrineBig}}
\renewcommand{\LettrineTextFont}{\color{clrLettrineSmall}\FontLettrineText}
\renewcommand{\DefaultOptionsFile}{cb-lettrine.cfl}
\end{MyVerbatim}
We use the \Cmd{LettrineFontHook} command to set the font (and color) of the \textit{drop cap letter} to our script font. We use the \Cmd{LettrineTextFont} command to set the font (and color) of our \textit{drop caps text} to a small-caps version of the current roman font. Finally, we use the \Cmd{DefaultOptionsFile} command to point to a \pkg{lettrine} package configuration file (here \pkg{cb-lettrine.cfl}) where we fine-tuned the height (in rows) and width of each alphabetic letter that may be used as a \textit{drop cap letter}. See the \pkg{lettrine} package documentation for more details.
\subsection{Images/Photos}
There is very little material here on using images in your cookbook. We use the well-documented \pkg{graphicx} package and its\Cmd{includegraphics} command as the starting point for displaying photos. Our advice is to use non-\latex programs to put your images in final form (any rotation or cropping needed, as well as any needed adjustments to size or dpi).
By way of example, we include the code for our \Cmd{SideBySide} command, used for displaying two images side-by-side. Some comments on the setup:
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item Recall that all of our \pkg{*.tex} files (and therefore our \Quote{current directory}) will either be in: (1) the root directory of the cookbook project, or (2) the \pkg{tex} subdirectory under that root directory. Also, all of our image files will be in the \pkg{img} subdirectory under that root directory. We use the \Cmd{graphicspath} command to tell \latex to look for the image files either: (1) in the \pkg{img} subdirectory under the current directory, or (2) in the \pkg{img} directory that is a sibling of the current directory.
\item We use the \pkg{caption} package to manage any caption we put under an image. With \pkg{skip=2pt}, the vertical distance between the image and caption is set to 2 points. With \pkg{labelformat=empty}, we have an empty caption label. With \pkg{font=\{rm,it\}}, the caption font is \Cmd{rmfamily} and italic. The \pkg{caption} package options can be selected in the \Cmd{usepackage} command, or separately in the \Cmd{captionsetup} command. To demonstrate the latter, we select the \pkg{justification=centering} option in \Cmd{captionsetup}.
\item The \Cmd{SideBySide} command has two mandatory arguments. For the two side-by-side images, \textbf{Arg \#2} is the left image and \textbf{Arg \#3} is the right image.
\item \textbf{Arg \#1} is an optional key-value argument with three possible entries. \pkg{VertAlign=} defaults to \pkg{c} (vertically align images at their centers) and can also be set to \pkg{t} (align at their tops) or \pkg{b} (align at their bottoms). \pkg{LeftCaption=} and \pkg{RightCaption=} default to \Cmd{empty} and can be use to include a caption under one or both of the images.
\end{itemize}
\begin{MyVerbatim}
\graphicspath{{img/}{../img/}} % look in img directory (subdir of book root or sibling of tex)
\usepackage[skip=2pt, labelformat=empty, font={rm,it}]{caption} %
\captionsetup{justification=centering} % this is needed to have multi-line captions centered
\pgfkeys{
/SideBySide/.is family, /SideBySide,
default/.style = {VertAlign = c, LeftCaption = \empty, RightCaption = \empty},
VertAlign/.estore in = \VerticalAlign,
LeftCaption/.estore in = \LeftText,
RightCaption/.estore in = \RightText,
}
\NewDocumentCommand \SideBySide{O{\empty} m m} % Q 5769
{
\pgfkeys{/SideBySide, default, #1}%
%
\begin{figure}[htb]
\centering
\begin{minipage}[\VerticalAlign]{0.49\textwidth} % align at t= top, c = center, b = bottom
\centering
\includegraphics[width=0.97\textwidth]{#2} %
\ifx\LeftText\empty\relax\else\caption{\LeftText}\fi
\end{minipage}\hfill%
\begin{minipage}[\VerticalAlign]{0.49\textwidth}
\centering
\includegraphics[width=0.97\textwidth]{#3} %
\ifx\RightText\empty\relax\else\caption{\RightText}\fi
\end{minipage}
\end{figure}
}
\end{MyVerbatim}
\section{Front Matter, Main Matter and Back Matter}
\subsection{Introduction}
Almost all books have a structure consisting of three sections: the front matter, the main matter and the back matter. We describe here the organization and contents of those three sections. Although there are many options regarding the organization and contents of those three sections, we limit our discussion to the actual (and very typical) structure we have selected.
\subsection{Front Matter}
The \textbf{front matter} (sometimes called \Quote{preliminaries}) is the first section of a book. Because the front matter is normally the last section of a book to be completed, small roman numerals are traditionally used for the front matter page numbers. That way, last-minute changes will not require renumbering the main text.
For our cookbook, the front matter is contained in the file \pkg{cb-frontmatter.tex}. We now describe, in order of appearance, the parts that make up the front matter.
\subsubsection{Title Page}
It is actually typical for old-line publishers to start with a half-title page (just the book name and no other information) and then the full title page (including author's name and possibly other information). We include only a full title page.
\subsubsection{Copyright Page}
Here we provide the copyright information. As is common, we also includes information on the publisher, the book edition and edition history, the ISBN number (if any), and the Library of Congress number (if a USA book). We also include here information about the production, design and fonts (the \Quote{colophon}). \textit{You will need to make several edits to this page -- see the \Quote{front matter helper commands} section of the preamble}.
\subsubsection{Dedication}
The dedication, if any, follows the copyright page and is the only element on that page.
\subsubsection{Table of Contents}
We provide the page number for each chapter in the book, and for the index. If your book has an appendix (or similar), you should also include that in the table of contents.
With the book class, no package is required to include chapters, sections and subsections in the table of contents. Because our cookbook has no sections or subsections, we list only chapters (plus the index) in our table of contents. We insert the table of contents at the desired location in the front matter simply by issuing the \Cmd{tableofcontents} command. Section \ref{BackMatter} (page \pageref{BackMatter}) shows how we add the index to our table of contents.
\subsubsection{Other}
Following the table of contents, there may be some or all of the following (each as a separate chapter and each included in the table of contents): foreword, preface, acknowledgments, introduction, or similar.
\subsection{Main Matter}
The \textbf{main matter} (sometimes called the \Quote{body matter}) follows the front matter. This is the actual text of your book. We follow the typical case where the main matter consists only of the chapters of the book. The first page of the main matter is page 1 of the book (Arabic numbering).
\subsection{Back Matter}\label{BackMatter}
The \textbf{back matter} (sometimes called the \Quote{end matter}) follows the main matter. Ours is a typical case, where the back matter contains only the book index. The back matter is where you might include other ancillary information such as an appendix, notes, a glossary, a bibliography, etc. Our index consists only of the recipes in the cookbook. See page \pageref{RecNameYield} and the \Cmd{RecipeNameAndYield} command for how we put our recipes in the index.
Following is the code to include the index in the back matter. First, from \pkg{cb-preamble.tex} we have:
\begin{MyVerbatim}
\usepackage{imakeidx} % supports creation of an index (here, a recipe index)
\makeindex[intoc] % make the *.idx file; intoc = include this Index in TOC (Q 59619)
\NewDocumentCommand \CookbookIndex{}{
\cleardoublepage % flush all material and clear until you start new odd numbered (recto) page
\phantomsection\addcontentsline{toc}{chapter}{\indexname} % see also Q 59619
\printindex
}
\end{MyVerbatim}
\noindent And from \pkg{makecookbook.tex} we have:
\begin{MyVerbatim}
\backmatter
\CookbookIndex{}
\end{MyVerbatim}
With the above code, you get the standard index format for the \pkg{book} document class (plus inclusion in the table of contents). We have also added code that modifies the format of the index in three ways: (1) it slightly changes the hanging indent of long index items, (2) it right justifies the page number associated with the index item, and (3) it \Quote{dot fills} between the index item and the page number. Our code:
\begin{MyVerbatim}
\makeatletter
\def\@idxitem{\par\hangindent 10pt} % not needed unless you want to fine tune hanging indent
\newcommand{\betterdotfill} % see Q 396898
{\leavevmode \nobreak\cleaders \hb@xt@ .44em{\hss .\hss }\hskip .5em plus 1fill \kern \z@}
\makeatother
\makeindex[options=-s cb-idxstyle] % use cb-idxstyle.ist for style; Q 132465 & Q 396898
\end{MyVerbatim}
You might want to temporarily comment out this additional code, just to compare the results to the standard \pkg{book} class index format.
The above code: (1) slightly changes the hanging indent for index items that are longer than a single line (this code is definitely \textit{not} necessary), (2) defines the \Cmd{betterdotfill} command (more on this below), and (3) uses the \Cmd{makeindex} command to load an \Quote{index style file} named \pkg{cb-idxstyle.ist} to modify the format of the index\footnote{See \pkg{https://ctan.org/tex-archive/indexing/makeindex/paper/ind.pdf} for documentation on the index style file.}. The \pkg{cb-idxstyle.ist} file is a text file with the following contents:
\begin{MyVerbatim}
delim_0 "\\betterdotfill "
delim_1 "\\betterdotfill "
delim_2 "\\betterdotfill "
\end{MyVerbatim}
What is with that strange \Cmd{betterdotfill} command (courtesy of Enrico Gregorio in Q 396898)? If you still have the default setup of the \pkg{makecookbook} package (including fonts, margins, etc.), we can demonstrate why it is needed. In the above \pkg{cb-idxstyle.ist} file, change the three \pkg{betterdotfill} entries to standard \pkg{dotfill} entries:
\begin{MyVerbatim}
delim_0 "\\dotfill "
delim_1 "\\dotfill "
delim_2 "\\dotfill "
\end{MyVerbatim}
Now compile and look at the index entry for the recipe named \Quote{G -- Potato Salad with Sherry Shallot Vinaigrette}. That recipe is \textit{exactly} the wrong size, causing \Cmd{dotfill} to fail. The page number is not right justified and there is no dot fill. Enrico's magic code\footnote{Don't ask us to fully explain Enrico's code, although there are strong hints in \textit{The TeXbook} by Donald E. Knuth.} solves the problem by forcing the last part of \Quote{wrong-sized} recipe names to spill over to the next line.
\newpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\part{Elements of a Book -- the Details (Fonts)}\MyLabel{Fonts}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}
The \texttt{METAFONT} font selection scheme in original \tex was developed beginning in the late 1970's. Although advanced for its time, it is quite limiting by today's standards. In \latex[,] a 'New Font Selection Scheme' (NFSS) was released in 1989 and then updated in 1993. While certainly a great improvement, allowing package writers to make many new fonts available, it is still a cumbersome and limiting system.
Backward compatibility has been a limiting factor in \latex development, due to: (1) the expectation that older documents will still compile and produce identical output and (2) the large ecosystem of third-party packages. Until recently, one of the most important advances was the \pkg{pdfTeX} compiler, which produced PDF output directly from a \tex or \latex compile. However, \pkg{pdfTeX} is still an 8-bit system with the same font limitations. While there are packages and methods for incorporating Unicode in a \pkg{pdfTeX} compile, it is both kludgy and incomplete.
Recently, the \xetex and \luatex compilers have been released. They are Unicode-based 32-bit systems. Both can load any OpenType (including TrueType) font installed on your computer -- all you need is the \pkg{fontspec} package. That allows easy use of the advanced typographic features of OpenType. It must be noted that these two new compilers have some subtle incompatibilities with \tex and \latex{}. However, those incompatibilities are minimal and will impact a small group of uses -- primarily those with old legacy code. Of course, \pkg{pdfTeX} is still available for any such legacy code.
To allow for more modern font handling, we therefore decided to use the \luatex compiler. As between \luatex and \xetex[,] we decided that \luatex is a better choice due to its more complete support of the \pkg{microtype} package and for the option (which we have not used) of Lua scripting.
\subsection{Fonts}
We discussed on page \pageref{IntroFonts} the three fonts you must install if you want a successful compile \Quote{out of the box}. Here we discuss the attributes required of substitute fonts. We begin by again listing the three font, along with the weights and shapes required of substitute fonts:
\begin{description}
\item[Serif] \textit{EB Garamond} (version from Google Fonts). Any substitute font should have regular and bold weights, both to include the italics shape. Also, the regular weight should include the small caps shape.
\item[Sans Serif] \textit{Lato} (version from \pkg{www.latofonts.com}). Any substitute font should have regular, semi-bold and bold weights, all to include the italics shape.
\item [Script] \textit{Italianno} (version from Google Fonts). We only need the regular font weight and shape.
\end{description}
In addition to the above, the substitute fonts must be OpenType (including TrueType) and should support the \pkg{Ligatures=TeX} font feature described in the \pkg{fontspec} package manual. Finally, the \textit{serif} and \textit{sans serif} fonts should support the following (there are workarounds if they do not):
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item These glyphs: \textit{degree} (char 176), \textit{copyright} (char 169), \textit{center dot} (char 183), and \textit{bullet} (char 8226).
\item The \pkg{Fractions=On} OpenType font feature, as described in the \pkg{fontspec} package manual.
\end{itemize}
On page \pageref{FontCode} and following, below, we discuss the simple changes to \pkg{cb-preamble.tex} you must make to substitute your own favorite fonts.
\section{Line Length and Font Size}
Part of the font selection process is choosing a proper point size for the intended use. And these decisions directly impact other issues, such as the choice of trim size and margins. We consider here the important relationship between point size and line length.
Lines of text can be less comfortable to read if they are either too long or too short. Following are a couple of (sometimes contradictory) rules of thumb for the body text of a printed book\footnote{See, e.g.: \pkg{https://en.wikipedia.org/wiki/Line\_length} and the references cited there.}:
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item Line length should be between 45 and 75 characters per line. For printed works with multiple columns, 40 to 50 characters per line is preferred.
\item Line length should be about 30 times the point size of the font, with an acceptable range between 20 and 40 times. We call that number the \textit{point multiple}, and calculate it by dividing the length (in points) of the line by the point size of the font. We assume that 1 inch equals 72.27 points (often rounded to 72 points in desktop publishing applications). Our 6.125-inch text margin is therefore about 443 points wide.
\end{itemize}
Now let's relate the above rules of thumb to our four different layouts of body text.
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item The introductory text at the beginning of each chapter has a font size of 14 points. Dividing 443 by 14, we have a nearly ideal \textit{point multiple} of about 31.6. We roughly calculate the characters per line at between 78 and 80 -- a little high, but we find the text easily readable and note the \textit{point multiple} is right where it needs to be.
\item The introductory text at the beginning of each recipe has a font size of 13 points. Also, the text is indented on each side by 20 points, giving a text width of 403 points. Dividing 403 by 13, we have a nearly ideal \textit{point multiple} of about 31. We roughly calculate the characters per line at about 78 -- again, a little high, but we find the text easily readable and note the \textit{point multiple} is right where it needs to be.
\item The recipe ingredients and steps are presented in a two-column format, with a font size of 10.95 points. Listing of ingredients should not be considered \Quote{body text}, so we focus on the recipe steps. With a 10 point separation between the two columns, each column is about 217 points wide. Dividing 217 by 10.95, we have a \textit{point multiple} of just about 20 -- at the low end, as might be expected for multi-column text. We roughly calculate the characters per line at 48, right where it should be for multi-column text.
\item The copyright page uses a font size of 9 points. This is a \Quote{fine print} page and should not be considered as body text. It is of no concern that the characters per line and \textit{point multiple} are not within prescribed parameters.
\end{itemize}
\section{Our Selected Fonts}
Below we provide additional detail on the fonts and font sizes we selected.
\subsection{Serif Font}
For the \pkg{makecookbook} package, we selected the \textit{EB Garamond} font. Garamond (produced in many versions) is an old-style serif typeface, named for sixteenth-century Parisian engraver Claude Garamond. It and related typefaces are very popular for printing body text in books. It is a classic design that does not shout \Quote{look at me} but just unobtrusively makes for very easy to read text.
\textit{EB Garamond} is the primary font used in the cookbook. It is used everywhere in the cookbook that is not specifically mentioned below for the other fonts. Some of the key places where this font is used:
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item When listing the steps to make a recipe. This is in a two-column environment, using a 10.95 point font.
\item At the beginning of recipes, when telling a story about the recipe or describing other special information regarding the recipe. This is in a one-column environment, indented 20 points on both the left and right sides. We use a 13 point font.
\item At the beginning of each chapter, when discussing the recipes in that chapter. This is in a one-column full-width environment, using a 14 point font.
\item On the copyright page, where it is typical to have a smaller font. We use a 9 point font.
\item In the chapter title, this font is used as the chapter \boldit{label} (e.g., ``Chapter 7"), using a 14.4 point font.
\end{itemize}
\subsection{Sans Serif Font}
For the \pkg{makecookbook} package, we selected the \textit{Lato} font. \textit{Lato} is described as \Quote{clean and modern} as well as \Quote{transparent} (unobtrusive), meeting our goal for easy to read but low-key body text fonts. This is the only other font used for body text. It is used in two places:
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item When listing recipe ingredients. This is in a two-column environment, using a 10.95 point font. We use the semi-bold face to provide a better visual contrast between recipe ingredients and recipe steps.
\item When a recipe has multiple sections of ingredients/steps, we use this font for the title of a recipe section. It is still 10.95 points, but in italics with a bold face.
\end{itemize}
\subsection{Script}
For the \pkg{makecookbook} package, we selected the \textit{Italianno} font. We believe it provides an interesting contrast to our two body text fonts, while still remaining readable. It is used in three places:
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item In the chapter title, it is used for the name of the chapter. We use a 40 point font size.
\item In recipes, it is used for the recipe name. We use a 24 point font size.
\item As the large \textit{drop cap letter}. (Font size determined by the \Cmd{lettrine} package).
\end{itemize}
\begin{SideNote}
{
We have a confession to make. For our cookbook, we do not use the \textit{EB Garamond} or \textit{Lato} font. (We do use \textit{Italianno}). In their place, we use the \textit{Adobe Garamond Pro} and \textit{Adobe Myriad Pro} commercial fonts. Although both implementation of Garamond are excellent, for our main font we wanted a well-tested and reliable font (\textit{EB Garamond} is still in development). For our secondary font, we just very much like the look and readability of the Myriad typeface. Of course, we could not use a commercial font in this package.
}
\end{SideNote}
\section{Code to Implement our Font Usage}\MyLabel{FontCode}
\subsection{Load Our Fonts}
The first step is to load our three fonts using the \pkg{fontspec} package:
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item Our \textit{serif} font is loaded using the \Cmd{setmainfont} command. After that, our code refers to this family as the \Cmd{rmfamily}.
\item Our \textit{sans serif} font is loaded using the \Cmd{setsansfont} command. After that, our code refers to this family as the \Cmd{sffamily}.
\item Our \textit{script} font is loaded using the \Cmd{newfontfamily} command. The \Cmd{newfontfamily} command allows us to name the family (similar to \Cmd{rmfamily}). We name our script font \Cmd{MyScriptFont}.
\end{itemize}
All three font loading commands include a mandatory argument to identify the font, plus various optional key-value augments. The \pkg{fontspec} package provides several options for identifying the font. We use their \Quote{by file name} option. The easiest way to understand this is to look at the six font files that make up \textit{EB Garamond's} regular, regular italic, bold, bold italic, semi-bold and semi-bold italic font faces:
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item \pkg{ebgaramond-regular.ttf}
\item \pkg{ebgaramond-italic.ttf}
\item \pkg{ebgaramond-bold.ttf}
\item \pkg{ebgaramond-bolditalic.ttf}
\item \pkg{ebgaramond-semibold.ttf}
\item \pkg{ebgaramond-semibolditalic.ttf}
\end{itemize}
The leading part of the font name (\pkg{ebgaramond}) is entered as the mandatory argument. The \pkg{.ttf} file extension is entered in the optional key-value argument: \pkg{Extension=.ttf}. The six font faces are identified by their filename, with a \pkg{*} representing the leading part of their filename. The complete code to load the fonts (see the \pkg{fontspec} package for more details):
\begin{MyVerbatim}
\usepackage{fontspec}
\usepackage{microtype}
\setmainfont{ebgaramond}[
Extension=.ttf,
UprightFont=*-regular,
ItalicFont=*-italic,
BoldFont=*-bold,
BoldItalicFont=*-bolditalic,
FontFace={sb}{n}{*-semibold},
FontFace={sb}{it}{*-semibolditalic},
Ligatures=TeX,
Numbers=Lining]
\setsansfont{lato}[
Extension=.ttf,
UprightFont=*-regular,
ItalicFont=*-italic,
BoldFont=*-bold,
BoldItalicFont=*-bolditalic,
FontFace={sb}{n}{*-semibold},
FontFace={sb}{it}{*-semibolditalic},
FontFace={k}{n}{*-black},
FontFace={k}{it}{*-blackitalic},
Ligatures=TeX,
Numbers=Lining]
\newfontfamily\MyScriptFont{Italianno}[
Extension=.otf,
UprightFont=*-Regular-OTF,
Ligatures=TeX]
\end{MyVerbatim}
As mentioned above, in our cookbook, we use the \textit{Adobe Garamond Pro} and \textit{Adobe Myriad Pro} fonts. To replace \textit{EB Garamond} and \textit{Lato} with those fonts, it is as simple as changing the \Cmd{setmainfont} and \Cmd{setsansfont} commands with (you can do the same to substitute your favorite fonts):
\begin{MyVerbatim}
\setmainfont{agaramondpro}[
Extension=.otf,
UprightFont=*-regular,
ItalicFont=*-italic,
BoldFont=*-bold,
BoldItalicFont=*-bolditalic,
FontFace={sb}{n}{*-semibold},
FontFace={sb}{it}{*-semibolditalic},
Ligatures=TeX,
Numbers=Lining]
\setsansfont{myriadpro}[
Extension=.otf,
UprightFont=*-regular,
ItalicFont=*-it,
BoldFont=*-bold,
BoldItalicFont=*-boldit,
FontFace={sb}{n}{*-semibold},
FontFace={sb}{it}{*-semiboldit},
FontFace={k}{n}{*-black},
FontFace={k}{it}{*-blackit},
Ligatures=TeX,
Numbers=Lining]
\end{MyVerbatim}
\subsection{Handle Special Font Faces}
We handle the two special font faces, semi-bold and black, giving them commands that are similar to the built-in commands used, for example, by bold (i.e., similar to the \Cmd{textbf} and \Cmd{bfseries} comands):
\begin{MyVerbatim}
\NewDocumentCommand \sbseries {}{\fontseries{sb}\selectfont}
\DeclareTextFontCommand{\textsb}{\sbseries}
\NewDocumentCommand \kseries {}{\fontseries{k}\selectfont}
\DeclareTextFontCommand{\textk}{\kseries}
\end{MyVerbatim}
\subsection{Commands to Select Our Fonts}
Next, we provide the commands needed to select the fonts. This gives us a level of indirection between the actual font used and the more abstract name we use for that font. In referencing/selecting a font, we will only use the below command names:
\begin{MyVerbatim}
\NewDocumentCommand \FontSteps {}{\rmfamily\mdseries}
\NewDocumentCommand \FontStepsDefault {}{\rmfamily\mdseries}
\NewDocumentCommand \FontIngredients {}{\sffamily\sbseries}
\NewDocumentCommand \FontIngDefault {}{\sffamily\sbseries}
\NewDocumentCommand \FontIngTitle {}{\sffamily\bfseries\itshape}
\NewDocumentCommand \FontChapterIntro {}{\rmfamily\fontsize{14}{16.8}\selectfont}
\NewDocumentCommand \FontRecipeStory {}{\rmfamily\fontsize{13}{15.6}\selectfont}
\NewDocumentCommand \FontCopyrightPage {}{\rmfamily\fontsize{9}{11}\selectfont}
\NewDocumentCommand \FontChapterLabel {}{\rmfamily\fontsize{14.4}{18}\selectfont}
\NewDocumentCommand \FontChapterTitle {}{\MyScriptFont\fontsize{40}{48}\selectfont}
\NewDocumentCommand \FontRecipeName {}{\MyScriptFont\fontsize{24}{29}\selectfont}
\NewDocumentCommand \FontLettrineText {}{\rmfamily\scshape\sbseries}
\NewDocumentCommand \FontTitleColorBox {}{\rmfamily\Large\bfseries}
\NewDocumentCommand \FontTitlepageTitle {}{\MyScriptFont\fontsize{40}{48}\selectfont}
\NewDocumentCommand \FontTitlepageAuthor{}{\rmfamily\sbseries\scshape\fontsize{14.4}{18}\selectfont}
\end{MyVerbatim}
\subsection{Special Handling of Fractions}
For a cookbook, it is important to have a consistent way to display \Quote{nice} (and readable) fractions. For cookbooks, fractions are almost always of the \Quote{split level} type. Based on a suggestion in Q416164, we began by using the \pkg{xfrac} package and the \Cmd{sfrac} command, as follows:
\begin{MyVerbatim}
\usepackage{xfrac}
\def\fr#1/#2 {\sfrac{#1}{#2} }
\def\frx#1/#2 {\sfrac{#1}{#2}}
\end{MyVerbatim}
The first \Cmd{def} allows you to type \Cmd{fr}1/2 to get nicely formatted \fr1/2 followed by a space.
The second \Cmd{def} allows you to type \Cmd{frx}1/2 to get nicely formatted \fr1/2 where the space following
your entry is “gobbled” by the \Cmd{def} because there is a space between \Cmd{def} and \{. This second form is needed in the less common case when you want a parenthesis, comma, period or other character to immediately follow the fraction (i.e., no space between). Thus, to have a period immediately follow a nice \fr1/2 fraction, you would
enter \Cmd{frx}1/2 . (Note the space between the 2 and the period).
Later we noted the discussion in Q234857 and the possibility of using the OpenType \pkg{Fractions=On} option. Our serif and sans serif fonts include full support for \pkg{Fractions=On}. So we replaced the \Cmd{sfrac} command with the \Cmd{addfontfeatures} command (below). Although \Cmd{sfrac} does a good job of producing \Quote{nice} fractions, the fractions look even nicer when you use an OpenType font that fully supports \pkg{Fractions=On}. The new \Cmd{def} still uses the same “space trick” as the old \Cmd{def}. NOTE: some OpenType fonts \Quote{support} \pkg{Fractions=On} only partially – if there is an internal \Quote{pre-made} fraction they will use that, but things don’t otherwise look so nice (or consistent). Check you font.
Our final code (you can revert to \Cmd{sfrac} if you desired font does not support this feature):
\begin{MyVerbatim}
\def\fr#1/#2 {{\addfontfeatures{Fractions=On}#1/#2} }
\def\frx#1/#2 {{\addfontfeatures{Fractions=On}#1/#2}}
\end{MyVerbatim}
\subsection{Commands for Certain Glyphs}\MyLabel{Glyphs}
The degree, copyright, bullet and center (or mid) dot glyphs all have standard unicode character codes, and all are available in our serif and sans serif fonts. We therefore provide our own commands for these glyphs, rather than using the associated \latex commands. Our goal is to avoid the possible loading by \latex of other unnecessary fonts to create those glyphs. A font uses only for a few glyphs can cause some confusion, and even failed print jobs, at some of the print on demand companies.
Similarly, to avoid use of the math command \texttt{\$\Cmd{cdot}\$} (and possible loading of a math font), we “rolled our own” using our \Cmd{CtrDot} glyph and appropriate kerning to build the \Cmd{CtrDots} (plural) command.
If you use a font that does not provide these glyphs, use the \latex macros \Cmd{textdegree} or \Cmd{copyright} or \Cmd{textbullet} or (math) \texttt{\$\Cmd{cdot}\$}.
We also include here the code to use two \Quote{glyph-like} images: \Cmd{ChefHat} and \Cmd{Oven}. We made those two images using the \pkg{tikz} package and then saved them each in a \tex box. They are used in selected places, in the same fashion as normal font glyphs.
\begin{MyVerbatim}
\NewDocumentCommand \TextDegree {}{{\char176}} % or ^^^^00B0
\NewDocumentCommand \Copyright {}{{\char169}} % or ^^^^00A9
\NewDocumentCommand \TextBullet {}{{\char8226}} % or ^^^^2022
\NewDocumentCommand \CtrDot {}{{\char183}} % or ^^^^00B7
\NewDocumentCommand \CtrDots {}{{\CtrDot\kern 0.2em\CtrDot\kern 0.2em\CtrDot\kern 0.2em}}
\newsavebox{\HatBox}
\AtBeginDocument{\savebox{\HatBox}[\hatwidth]{\MakeChefHat}}%
\NewDocumentCommand \ChefHat {}{\usebox{\HatBox}}%
\NewDocumentCommand \ChefNote {}{{\raisebox{.4ex}{\ChefHat}}}
\newsavebox{\OvenBox}
\AtBeginDocument{\savebox{\OvenBox}[\ovenwidth]{\MakeOven}}%
\NewDocumentCommand \Oven {}{\usebox{\OvenBox}}%
\end{MyVerbatim}
\subsection{Point Size of Default Roman and Sans Fonts}
The \pkg{IngredientsAndSteps} environment and the \Cmd{RecipeStory} and \Cmd{ChapterIntro} commands (discussed further below) need to know certain default font parameters (in points) for the fonts they use. We calculated those values beforehand and stored the hard-coded values:
\begin{MyVerbatim}
\def\StdIFontSize{10.95}
\def\StdSFontSize{10.95}
\def\StdIBaseline{13.6}
\def\StdSBaseline{13.6}
\def\RStoryFontBaseline{15.6pt}
\def\CIntroFontBaseline{16.8pt}
\end{MyVerbatim}
\newpage
\part{Elements of a Cookbook -- the Details}
\section{Chapter Introduction}
In a cookbook, chapters tend to be organized into logical units such as cookies, pasta, appetizers, etc. Following the chapter name, there will usually be some introductory text for that chapter. We call that the \textit{chapter intro}.
Use the \Cmd{ChapterIntro} command to enter your \textit{chapter intro} text. The command sets the default (roman serif) font to a larger size (14 points). A simplified version of the \Cmd{ChapterIntro} command follows. The actual code (page \pageref{RealChapterIntro}) includes an optional argument that you will rarely use:
\begin{MyVerbatim}
\NewDocumentCommand \ChapterIntro {+m}{\FontChapterIntro{#1\par}} % the \par needed by \lettrine
\end{MyVerbatim}
As noted, the \Cmd{ChapterIntro} command sets a default font face and size. However, you are free to use most any of the \latex text markup commands. You might make some text \textbf{bold} or \textit{italic}, or use an \pkg{enumerate} environment (e.g., to list you favorite cookie recipes). In our book, we have elected to use the \Cmd{lettrine} command to create a \Quote{drop cap} effect -- see the separate discussion of this on page \pageref{DropCap}.
\section{Recipe Name and Yield}\MyLabel{RecNameYield}
A new recipe is introduced with a recipe name and, often, with information regarding the ``yield" of the recipe (e.g., ``makes 36 cookies" or ``serves 4 to 6", etc.). To enter this information, we use the \Cmd{RecipeNameAndYield} command. It uses a key/value interface of the form:
\begin{MyVerbatim}
\RecipeNameAndYield{〈key=value, ...〉}
\end{MyVerbatim}
The key/value options are as follows:
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item \textbf{[Name=]} Required. This is the recipe name. it is the only required key/value option.
\item \textbf{[Yield=]} Optional. You can optionally provide the \Quote{yield} of the recipe.
\item \textbf{[NoIdxName=]} Optional. As a general rule, the recipe name (as entered in the \textbf{Name=} option) is included in the Index to the cookbook (in the back matter). However, if you set this key to the number '1', the recipe name will not be placed in the Index. The purpose of this option is to allow you to make enties in the \Cmd{index} that are somewhat different than the actual recipe name. For example, perhaps you want to slightly shorten the recipe name for the Index.
\item \textbf{[IndexA=]} Optional. This is where you would enter alternate text for this recipe's index.
\item \textbf{[IndexB=]} Optional. Use this if you want another recipe index entry.
\item \textbf{[IndexC=]} Optional. Use this if you want yet another recipe index entry.
\item \textbf{[XRefLabel=]} Optional. Normally, recipes do not have a cross-reference \Cmd{label} created. Use this key/value option if you want to create a cross-reference \Cmd{label} for this recipe (the value entered here is the \Cmd{label}). That allows you to reference this recipe's page number from another location in the cookbook.
\end{itemize}
\begin{SideNote}
{This is a good place to remind you of the special handling needed when the \pkg{value} element of a key/value entry includes a comma. Suppose, for example, that your recipe is \textit{Pasta with Sausage, Tomatoes and Cream}. If your key/value entry is \textbf{Name=Pasta with Sausage, Tomatoes and Cream}, then they key/value parser will think the \pkg{Name=} entry ends at the comma. The solution is to put an extra set of curly braces around the value, such as: \textbf{Name=\{Pasta with Sausage, Tomatoes and Cream\}}. That tells the parser to treat the internally braced text as one unit.
}
\end{SideNote}
Following is the code defining the \Cmd{RecipeNameAndYield} command:
\begin{MyVerbatim}
\pgfkeys{
/RecipeNameAndYield/.is family, /RecipeNameAndYield,
default/.style = {Name = 0, NoIdxName = 0, XRefLabel = \empty, Yield = \empty,
IndexA = \empty, IndexB = \empty, IndexC = \empty},
Name/.estore in = \RecipeName,
NoIdxName/.estore in = \NoIndexName,
IndexA/.estore in = \IdxA,
IndexB/.estore in = \IdxB,
IndexC/.estore in = \IdxC,
XRefLabel/.estore in = \XRefLbl,
Yield/.estore in = \RecipeYield,
}
\NewDocumentCommand \RecipeNameAndYield {m}{%
\pgfkeys{/RecipeNameAndYield, default, #1}%
% Put the recipe name in the Index, unless the user sets NoIdxName = 1:
\ifnum\NoIndexName=1 \relax\else\index{\RecipeName}\fi
% Can add up to three other Index entries:
\ifx\IdxA\empty\relax\else\index{\IdxA}\fi
\ifx\IdxB\empty\relax\else\index{\IdxB}\fi
\ifx\IdxC\empty\relax\else\index{\IdxC}\fi
% Did the user ask us to set up a label for cross-reference?:
\ifx\XRefLbl\empty\relax\else\RecipeLabel{\XRefLbl}\fi
% Add a bookmark (only adds bookmark if hyperref is active):
\ifnum\NoIndexName=1 \RecipeBookmark{\IdxA}\else\RecipeBookmark{\RecipeName}\fi
% Now write the recipe name and (possibly) the yield
\begin{center}%
{\FontRecipeName{\RecipeName}}\par%
\ifx\RecipeYield\empty\relax\else {\textit{\RecipeYield}}\par \fi%
\end{center}%
}
\end{MyVerbatim}
\section{Recipe Story}
Often there is a story or other information specific to a recipe. In our design, that story follows the recipe's \pkg{RecipeNameAndYield} and precedes its \pkg{IngredientsAndSteps}. We call it the \textit{recipe story}.
For reasons of readability, and for visual interest, we indent both the left and right margin of the \textit{recipe story} by 20 points and use a font size of 13 points. However, like the chapter intro, you are free to use most any of the \latex text markup commands\footnote{But see Q 66332 and Q 183569. You cannot use a list environment or similar.}. A simplified version of the \Cmd{RecipeStory} command follows. The actual code (page \pageref{RealRecipeStory}) includes an optional argument that you will rarely (if ever) use.
\begin{MyVerbatim}
\def\RecipeStoryIndent{20 pt}
\NewDocumentCommand \RecipeStory {+m}{%
\FontRecipeStory
\leftskip=\RecipeStoryIndent \rightskip=\leftskip
{#1\par} % the \par needed by \lettrine
}
\end{MyVerbatim}
\section{Ingredients and Steps}
Following the recipe name/yield and (possibly) a recipe story, there is a list of the ingredients, plus the steps required to make the recipe. We have formatted this section into two columns, with the ingredients in a semi-bold face of the sans serif font and the steps in a normal face of the roman (serif) font. Both fonts use the default font size of 10.95 points.
The code to accomplish this uses the \pkg{IngredientsAndSteps} environment to establish the two-column format, and then the \Cmd{ListIngredientsAndSteps} command to list the ingredients and steps. We discuss them below.
\subsection{The \pkg{IngredientsAndSteps} Environment}
A simplified version of the \pkg{IngredientsAndSteps} environment follows. The actual code (page \pageref{RealIngStepEnv}) is somewhat complicated. It has no mandatory arguments, but has several optional \pkg{key=value} style arguments that you will rarely (if ever) use.
When used without optional arguments, the \pkg{IngredientsAndSteps} environment is very simple. Its only purpose is to establish the two-column format, using code that is equivalent to the following:
\begin{MyVerbatim}
\NewDocumentEnvironment{IngredientsAndSteps}{}
{\begin{multicols}{2}} % The "before environment" setup
{\end{multicols}} % The "after environment" cleanup
\end{MyVerbatim}
\noindent We simply provide a wrapper around the \pkg{multicols} environment where we select the two-column option.
\subsection{The \Cmd{ListIngredientsAndSteps} Command}
We use the \Cmd{ListIngredientsAndSteps} command to list the ingredients and provide the steps needed to make the recipe. There is one optional argument and two mandatory arguments, as follows:
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item \textbf{[Arg 1]} Optional. In some recipes, there may be multiple sections of ingredients and steps. For example, the first section might be the ingredients and steps to make the cake, and the second section the ingredients and steps to make the frosting. In that case, you may want a label associated with each ingredients and steps section. The optional argument is the name of that section, formatted in bold italics and using the \pkg{clrIngTitle} color.
\item \textbf{[Arg 2]} Required. This is the list of ingredients. Each ingredient entry is separated by a blank line (i.e., the paragraph indicator in \latex text entry). Each paragraph becomes an ingredient in the list, formatted as \Cmd{raggedright} (not right justified), with a separation of 2 points between paragraphs.
\item \textbf{[Arg 3]} Required. This is the recipe steps. Each step entry is separated by a blank line (again, the paragraph indicator). Each paragraph becomes a recipe step. Unlike the ingredients, the steps are formatted as justified (the document default). We use the \pkg{enumerate} list environment to list the steps by number.
\end{itemize}
Following is the code defining the \Cmd{ListIngredientsAndSteps} command:\MyLabel{IngredientsHeading}
\begin{MyVerbatim}
\NewDocumentCommand \IngredientsHeading {O{0} m O{2}}%
{\begingroup \setlength{\parindent}{0pt} \ifnum #1 > 0 {\vspace{#1 pt}}\fi
\FontIngTitle\color{clrIngTitle} #2\par\vspace{#3 pt} \endgroup}%
\NewDocumentCommand \ListIngredientsAndSteps {o +m +m}{%
\IfValueT {#1}{\IngredientsHeading{#1}[3]}%
{\begingroup\ifx\relax#2\relax\else\FontIngredients{}\IngredientsList{#2}\fi\endgroup}% arg2
{\begingroup\ifx\relax#3\relax\else\FontSteps{}\RecipeSteps{#3}\fi\endgroup}% % arg3
}
\NewDocumentCommand \IngredientsList { >{\SplitList{\par}} +m}{%
\setlength{\parskip}{2pt}\raggedright%
\ProcessList{#1}{\ProcessIngList}}
\newcommand\ProcessIngList[1]{\hangindent1em #1\par}
\NewDocumentCommand \RecipeSteps { >{\SplitList{\par}} +m}{%
\begin{enumerate}[itemsep=2pt plus 1 pt minus 1pt, parsep=0pt plus 1pt,
topsep=4.5pt plus 2.0pt minus 1.0pt, leftmargin=*]
\ProcessList{#1}{\item}
\end{enumerate}
}
\end{MyVerbatim}
As indicated in the description of the optional argument, please note that one \pkg{IngredientsAndSteps} environment may contain more than one \Cmd{ListIngredientsAndSteps} command.
\section{Attribution}
If the source of the recipe is known, it is proper to acknowledge that source. In that case, after the listing of ingredients and steps, we include an attribution. It is formatted as right justified and italics, in the default 11 point roman/serif font. The code:
\begin{MyVerbatim}
\NewDocumentCommand \Attribution{m}{{\hspace*\fill}{\textit{#1}}}%
\end{MyVerbatim}
\section{Additional Comments/Advice}
There may be some recipe side notes and/or advice that is not properly included within the recipe, but is noted afterwards. We provide three separate environments to display that information -- the \pkg{Tip}, the \pkg{Cheffy}, and the \pkg{ChefNotes} environments -- all based on the \pkg{tcolorbox} package. All three environments take one mandatory arguments, which is the text (and any associated \latex markup commands) to be included in the body of the \pkg{tcolorbox} environment.
For example, the following code...:
\begin{MyVerbatim}
\begin{Tip}
{You can substitute \fr1/2 cup of vegetable or light olive oil for the butter.}
\end{Tip}
\begin{Cheffy}
{Using some almond flour results in biscotti with a delightful crunchy texture without making
them hard. I encourage you try useing 25\% almond flour.}
\end{Cheffy}
\begin{ChefNote}
{The amount of flour might vary if you use all-purpose flour versus “00” flour. If Tipo “00”
flour, you might need a little more flour. Use the texture of your dough as a guide.}
\end{ChefNote}
\end{MyVerbatim}
\noindent...gives you the following results:
\vspace{5pt}
\begin{Tip}
{You can substitute \fr1/2 cup of vegetable or light olive oil for the butter.}
\end{Tip}
\begin{Cheffy}
{Using some almond flour results in biscotti with a delightful crunchy texture without making them
hard. I encourage you try using 25\% almond flour.}
\end{Cheffy}
\begin{ChefNotes}
{The amount of flour might vary if you use all-purpose flour versus “00” flour. If Tipo “00” flour,
you might need a little more flour. Use the texture of your dough as a guide.}
\end{ChefNotes}
Of course, given the needs of your cookbook, you can easily change the title and color of these three environments. The \latex code follows (see page \pageref{Color} for information on the colors used below):
\begin{MyVerbatim}
\usepackage{tcolorbox}
\tcbset{fonttitle=\FontTitleColorBox}
\NewDocumentEnvironment{Tip}{+m}
{
\begin{tcolorbox}[colback=clrBackTip,colframe=clrFrameTip, title=Food for Thought]
{#1}%
\end{tcolorbox}
}
\NewDocumentEnvironment{Cheffy}{+m}
{
\begin{tcolorbox}[colback=clrBackCheffy,colframe=clrFrameCheffy, title=Let's Get Cheffy]
{#1}%
\end{tcolorbox}
}
\NewDocumentEnvironment{ChefNotes}{+m}
{
\begin{tcolorbox}[colback=clrBackNotes,colframe=clrFrameNotes,title=Chefnotes]
\ChefNote{}{#1}%
\end{tcolorbox}
}
\end{MyVerbatim}
\section{Odds and Ends}
This section includes a number of cooking-related commands that were included in our preamble. Some you may find useful; others, not so much. Even if not right for your cookbook, we hope you can use the ideas here to make your own \Quote{helper} commands.
\subsection{Various Simple but Useful Commands/Defines}
We present the code immediately below and selectively discuss that code following:
\begin{MyVerbatim}
\def\nl{\par} % see Q 96247 for why we defined \nl for use with pgfkeys
\NewDocumentCommand \PreheatC{m}{Preheat oven to #1\Degrees convection.\thinspace\Oven}%
\NewDocumentCommand \PreheatR{m}{Preheat oven to #1\Degrees regular oven.\thinspace\Oven}%
\NewDocumentCommand \Tbl{o}{\IfNoValueTF{#1}{tablespoon }{tablespoon#1}}%
\NewDocumentCommand \tsp{o}{\IfNoValueTF{#1}{teaspoon }{teaspoon#1}}%
\NewDocumentCommand \Pd{o}{\IfNoValueTF{#1}{pound }{pound#1}}%
\NewDocumentCommand \Ounce{o}{\IfNoValueTF{#1}{ounce }{ounce#1}}%
\NewDocumentCommand \Degrees{o}{\IfNoValueTF{#1}{\TextDegree{} }{\TextDegree{}#1}}%
\NewDocumentCommand \AxB{m m o}{{#1\thinspace{x}\thinspace#2}\IfValueT{#3}{#3}}%
\NewDocumentCommand \AxBxC{m m m o}{%
{#1\thinspace{x}\thinspace#2\thinspace{x}\thinspace#3}\IfValueT{#4}{#4}}%
\NewDocumentCommand \Inch{m}{{#1-inch}}%
\NewDocumentCommand \EditNote{m}{{{\color{clrEditNote} #1}}}%
\NewDocumentCommand \Quote{m}{{``#1''}}%
\NewDocumentCommand \IngredientsSeparator{}{{\FontStepsDefault \CtrDots\CtrDots}}%
\NewDocumentCommand \SeparateParagraphs{}{{\vskip 5pt}}%
\NewDocumentCommand \Recipe{+m}{{\textit{\textsb{#1}}}}%
\end{MyVerbatim}
The definition of \Cmd{nl} is needed to get around a problem with the \pkg{pgfkeys} package (for handling \pkg{key=value} arguments), because \pkg{pgfkeys} does not allow use of \Cmd{par} in a \pkg{value}.
There is a story behind the \Cmd{Preheat} commands. Traditionally, cookbooks have assumed the reader has only a regular (not convection) oven. We went back and forth on whether we should stick with tradition. When we surveyed friends and family most likely to use our cookbook, almost all had convection ovens. If we gave cooking times and temperatures only for regular ovens, those times and temperatures would be wrong for the vast majority of our readers. Our compromise was to include an \Cmd{Oven} image (drawn using the \pkg{tikz} package) after the \Cmd{Preheat} instructions. That oven acts as a reminder to the reader that they may need to adjust time and temperature based on their particular oven type. Of course, even if the reader has the indicated oven type, it also acts as a reminder that each oven is different -- they should adjust if their oven normally cooks hotter or cooler. If the \Cmd{Oven} image is too quirky for you, just remove it from the \Cmd{Preheat} commands.
The five commands (beginning with \Cmd{Tbl} and ending with \Cmd{D}egrees) first came about due to indecision. When first entering our recipes, we couldn't decide whether \Quote{teaspoon} and \Quote{tablespoon} should be spelled our or abbreviated. We put off the decision by using these commands, which could be redefined later based on our final decision. We quickly ran into a problem in cases where we wanted no space after the command, such as plurals (needing an 's' after tablespoon), punctuation or closed parenthesis. That lead to the current approach, with an optional argument that is appended without an space; without the optional argument, a space is automatically inserted.
The next two commands (\Cmd{AxB} and \Cmd{AxBxC}) are used to get the right spacing when you want \Quote{5 x 7} or \Quote{5 x 7 x 2}. By using \Cmd{thinspace}, we believe the results are better: e.g.: \Quote{5\thinspace{x}\thinspace{7}} and \Quote{5\thinspace{x}\thinspace{7}\thinspace{x}\thinspace{2}}. We also use the same optional argument technique as with teaspoon.
We use the \Cmd{EditNote} command to insert editing notes {\color{red}{(in red)}} in the cookbook, allowing comments and notes at places that need some further work. The \Cmd{Quote} command ensures that quote marks around text are the correct shape for beginning and ending quotes.
In some recipes, there is a logical separation of ingredients into two parts. The \Cmd{IngredientsSeparator} command provides a visual marker (6 center dots) for that separation.
\subsection{\Cmd{BakeUntil}}
No doubt, your collection of recipes come from all sorts of sources, many no longer even known to you. There is no standard way to describe the steps to make a recipe, so your recipes likely vary substantially in the ordering and wording used to describe common recipe steps. It is good goal to make your cookbook recipes as consistent as possible in this regard.
One place we constantly ran across this issue is in \Quote{Bake Until} instructions. We decided to standardize our instruction by use of a \Cmd{BakeUntil} command. This command takes one key/value style argument.
The key/value options are as follows:
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item \textbf{[Min=]} Required. The minimum baking time.
\item \textbf{[Max=]} Optional. The maximum baking time.
\item \textbf{[TPick=]} Optional. If equal to 1, then the \Quote{until} is \Quote{until toothpick tests clean}
\item \textbf{[GBrown=]} Optional. If equal to 1, then the \Quote{until} is \Quote{until golden brown}
\item \textbf{[Until=]} Optional. Use this if you want any other \Quote{until} phrase.
\end{itemize}
Here are three examples:
\begin{MyVerbatim}
\BakeUntil[Min=15, Max=18, GBrown=1]
\BakeUntil[Min=15, TPick=1]
\BakeUntil[Min=15, Max=18, Until=until firm to the touch]
\end{MyVerbatim}
The results:
\vspace{5pt}
\quad Bake about 15-18 minutes, until golden brown
\quad Bake about 15 minutes, until toothpick tests clean
\quad Bake about 15-18 minutes, until firm to the touch
\vspace{5pt}
Following is the code defining the \Cmd{BakeUntil} command:
\begin{MyVerbatim}
\pgfkeys{
/BakeUntil/.is family, /BakeUntil,
default/.style = {Min = 0, Max = 0, TPick = 0, GBrown = 0, Until = \empty},
Min/.estore in = \BkMin,
Max/.estore in = \BkMax,
TPick/.estore in = \BkTPick,
GBrown/.estore in = \BkGBrown,
Until/.estore in = \BkUntil,
}
\NewDocumentCommand \BakeUntil{m}{%
\pgfkeys{/BakeUntil, default, #1}%
\newcount\MyCount \MyCount = \BkMax%
\newcount\MyCase%
{Bake about \BkMin}%
\ifnum\MyCount > 0 {-\BkMax}\fi
{ minutes}%
\ifx\BkUntil\empty \MyCase = 0 \else \MyCase = 1 \fi%
\ifnum\BkTPick = 1 \MyCase = 2 \fi%
\ifnum\BkGBrown = 1 \MyCase = 3 \fi%
\ifcase\MyCase% '0' case - do nothing
\or {, \BkUntil}% '1' case - use the "Until" text
\or {, until toothpick tests clean}% '2' case - TPick
\or {, until golden brown}% '3' case - GBrown
\fi
}
\end{MyVerbatim}
\subsection{A Few Other Commands}
\textbf{Copyright}. We establish the environment for the copyright page. In that environment: (1) the font size is set to 9 points, (2) there is no indentation of the first line of a paragraph, and (3) all of the text is pushed down (as far as possible) to the bottom of the page.
\begin{MyVerbatim}
\NewDocumentEnvironment{CopyrightPage}{} % See 31186
{\FontCopyrightPage\setlength{\parindent}{0pt}\par\vspace*{\fill}}
{\clearpage}
\end{MyVerbatim}
\noindent \textbf{Hidden Lines}. When listing recipe ingredients and steps, the \pkg{multicol} environment matches the lengths of the first and second columns. There are some cases where the results don't look quite right. For example, the ingredients may take up \textit{almost} all of the first column, but not quite. So the listing of steps begins with one (lonely) line in the first column. We use the \Cmd{InsertHiddenLines} command to insert an extra (non-visible) ingredient that tricks the \pkg{multicol} environment into moving the first line of the recipe steps to the second column.
The \Cmd{InsertHiddenLines} command takes one parameter: the number of hidden lines to insert:
\begin{MyVerbatim}
\newcount\LineCount
\NewDocumentCommand \InsertHiddenLines{m}{%
\LineCount = #1
{%
\newcount\foo \foo=0
\loop % \loop starts the construct ended by \repeat
\phantom{.}\par \advance \foo by 1
\ifnum \foo < \LineCount \repeat % \repeat also “serves as” the \fi to the \ifnum
}%
}
\end{MyVerbatim}
\section{Handling of Long Recipes}
The code for the \Cmd{RecipeStory} command and the \pkg{IngredientsAndSteps} environment is actually more complicated than was shown above. In both cases, the actual code includes a rarely-used optional parameter. For a longer recipe, these optional parameters allow certain tweaks to the recipe layout that may allow you to keep the recipe name plus the full text of the ingredients and steps on one page.
\subsection{The \Quote{Real} \Cmd{RecipeStory} Command}\MyLabel{RealRecipeStory}
In our standard setup, the recipe story comes after the recipe name and before the ingredients and steps. One potential problem is that the length of the recipe story may cause the ingredients and steps to continue past the bottom of the current page. To avoid that problem, we designed the \Cmd{RecipeStory} command to include an option of dividing the recipe story into two parts. That allows one part (or none) to print before the ingredients and steps and the remaining part to print after.
The parameters for the actual \Cmd{RecipeStory} command:
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item \textbf{[Arg \#1]} Optional. Permitted values: non-negative integers less than or equal to the number of lines in the recipe story. If a value is provided, then the given number of lines (possibly zero) of the recipe story will be printed \textit{before} the ingredients and steps. To print the remaining lines after the ingredients and steps, you issue the \Cmd{Finish RecipeStory} command.
\item \textbf{[Arg \#2]} Required. This is the text of the recipe story. As mentioned above, this may also include many of the \latex text markup commands. (However, if you use the optional argument, your \latex code should not change the height of the baseline from the predefine \Cmd{RStoryFontBaseline} value).
\end{itemize}
The actual code follows:
\begin{MyVerbatim}
\def\RecipeStoryIndent{20 pt}
\newbox\StoryBox
\newbox\StoryBoxA
\NewDocumentCommand \RecipeStory {o +m} % arg1 = optional = lines for first part
{ % arg2 = story text
\setbox\StoryBox\vbox
{
\FontRecipeStory
\leftskip=\RecipeStoryIndent \rightskip=\leftskip % Q 66332
{#2\par} % the \par needed by \lettrine
}
\IfNoValueTF {#1} % NoValue=TRUE or NoValue=FALSE?
{\unvbox\StoryBox} % NoValue=TRUE, so flush the full StoryBox
{ % handle the NoValue=FALSE case
\ifnum #1 > 0 % > 0 means we split the story into two part; print the first part here
{ % = 0 means ALL of story is deferred
\setbox\StoryBoxA=\vsplit\StoryBox to #1\dimexpr \RStoryFontBaseline %
\unvbox\StoryBoxA%
}
\fi
}
}
\NewDocumentCommand \FinishRecipeStory{}%
{\ifvoid\StoryBox \else \smallskip\unvbox\StoryBox\par\medskip\fi} %
\end{MyVerbatim}
\subsection{The \Quote{Real} \pkg{IngredientsAndSteps} Environment}\MyLabel{RealIngStepEnv}
There is one more thing to try if splitting the recipe story, above, does not work to fit the recipe name plus ingredients and steps all on one page. We have coded the \pkg{IngredientsAndSteps} environment to provide some additional options.
In it default mode, the \pkg{IngredientsAndSteps} environment simply: (1) creates a two-column environment, and (2) sets the \Cmd{FontIngredients} and \Cmd{FontSteps} font selection commands to use their default font size of 10.95 points.
Using an optional parameter with a key/value interface, the the \pkg{IngredientsAndSteps} environment can be used to change (temporarily) the default text width and default font size. By increasing the text width and/or decreasing the font size for the ingredients and steps, it might be possible to fit the recipe on one page. The key/value options are as follows:
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item \textbf{[AdjIFont=]} Default value = 1. This is a floating point number that indicates the size you want the \Cmd{FontIngredients} font, computed as a ratio of the default size. For example, if AdjIFont=0.92, then the font would be set to 92 percent of its default size. IMPORTANT: This is the \Quote{controlling} ratio for all font parameters. If any of the other font parameters are set to 0 or not entered, then that other parameter will have the same value as set here.
\item \textbf{[AdjIBaseline=]} Default value = 0. This is a floating point number that indicates the size you want the \Cmd{FontIngredients} baseline, computed as a ratio of the default baseline size. For example, if AdjIBaseline=0.92, then the ingredient font's baseline would be set to 92 percent of its default size. If 0 or not entered, then AdjIBaseline = AdjIFont.
\item \textbf{[AdjSFont=]} Default value = 0. This is a floating point number that indicates the size you want the \Cmd{FontSteps} font, computed as a ratio of the default size. For example, if AdjIFont=0.92, then the font would be set to 92 percent of its default size. If 0 or not entered, then AdjSFont = AdjIFont.
\item \textbf{[AdjSBaseline=]} Default value = 0. This is a floating point number that indicates the size you want the \Cmd{FontSteps} baseline, computed as a ratio of the default baseline size. For example, if AdjIBaseline=0.92, then the steps font's baseline would be set to 92 percent of its default size. If 0 or not entered, then AdjSBaseline = AdjIFont.
\item \textbf{[AddWidth=]} Default value = 0. This is amount (taken as points) that you want to increase both the left and right margins. So, if AddWidth=5, then the text width will be increased by 5 points on both the left and right margins.
\end{itemize}
Following is the code defining the \pkg{IngredientsAndSteps} environment:
\begin{MyVerbatim}
\usepackage{multicol} % allows multiple column environments
\usepackage[strict]{changepage} % for \adjustwidth
\usepackage{xfp} % for fpeval floating point macro
\pgfkeys{ /IngredientsAndSteps/.is family, /IngredientsAndSteps,
default/.style = {AdjIFont = 1, AdjIBaseline = 0,
AdjSFont = 0, AdjSBaseline = 0,
AddWidth = 0, RaggedCols = 0},
AdjIFont/.estore in = \AdjustIFont,
AdjIBaseline/.estore in = \AdjustIBaseline,
AdjSFont/.estore in = \AdjustSFont,
AdjSBaseline/.estore in = \AdjustSBaseline,
AddWidth/.estore in = \AddPageWidth,
RaggedCols/.estore in = \RaggedColumns,
}
\newdimen\IFont \newdimen\IBase \newdimen\SFont \newdimen\SBase \newdimen\AddWidth
\NewDocumentEnvironment{IngredientsAndSteps}{o}
{ % Do the before-environment setup:
\IfNoValueTF {#1}%
% Handle the simple case = no optional key/value argument:
{\AddWidth = 0 pt}
% Handle the special case = there IS an optional key/value argument:
{
\pgfkeys{/IngredientsAndSteps, default, #1}%
\IFont = \AdjustIFont pt
\IBase = \AdjustIBaseline pt
\SFont = \AdjustSFont pt
\SBase = \AdjustSBaseline pt
\AddWidth = \AddPageWidth pt
\ifdim\IBase = 0 pt \IBase = \IFont \fi
\ifdim\SFont = 0 pt \SFont = \IFont \fi
\ifdim\SBase = 0 pt \SBase = \IFont \fi
\RenewDocumentCommand\FontIngredients{}{\FontIngDefault\fontsize{\fpeval{\StdIFontSize * \IFont}}
{\fpeval{\StdIBaseline * \IBase}}\selectfont}
\RenewDocumentCommand\FontSteps{}{\FontStepsDefault\fontsize{\fpeval{\StdSFontSize * \SFont}}
{\fpeval{\StdSBaseline * \SBase}}\selectfont}
}
% Now, finish setup:
\adjustwidth{-\AddWidth}{-\AddWidth}
\begin{multicols}{2}%
} % End of the before-environment setup
% Now do the after-environment cleanup:
{
\end{multicols}
\endadjustwidth
% We need to restore the fonts to default size IF there was an optional key/value argument:
\IfValueT {#1}
{
\RenewDocumentCommand \FontIngredients {}{\FontIngDefault}
\RenewDocumentCommand \FontSteps {}{\FontStepsDefault}
}
} % End of the "after environment" cleanup
\end{MyVerbatim}
\section{Adding Images in the Chapter Intro}
You may wish to strategically place images in the middle of the \textit{chapter intro} text. For example, on the first page of a chapter, you may begin with the \textit{chapter intro} text, then include image(s) at the bottom of that first page, and then complete the \textit{chapter intro} text on the next page.
\subsection{The \Quote{Real} \Cmd{ChapterIntro} Command}\MyLabel{RealChapterIntro}
The code for the \Cmd{ChapterIntro} command is shown below. It allows for splitting the \textit{chapter intro} into two parts and is essentially identical to the code for the \Cmd{RecipeStory} command. For the use of the optional first argument, see the \Cmd{RecipeStory} command (page \pageref{RealRecipeStory}). To print the second part of the \textit{chapter intro} text, you issue the \Cmd{FinishChapterIntro} command.
\begin{MyVerbatim}
\newbox\IntroBox
\newbox\IntroBoxA
\NewDocumentCommand \ChapterIntro {o +m} % arg1 = optional = lines for first part
{ % arg2 = chapter intro text
\setbox\IntroBox\vbox
{
\FontChapterIntro {#2\par}% the \par needed by \lettrine
}
\IfNoValueTF {#1} % NoValue=TRUE or NoValue=FALSE?
{\unvbox\IntroBox} % NoValue=TRUE, so flush the full IntroBox
{ % handle the NoValue=FALSE case
\ifnum #1 > 0 % > 0 means we split the story into two part; print the first part here
{ % = 0 means ALL of story is deferred
\setbox\IntroBoxA=\vsplit\IntroBox to #1\dimexpr \CIntroFontBaseline %
\unvbox\IntroBoxA %
}
\fi
}
}
\NewDocumentCommand \FinishChapterIntro{}%
{\ifvoid\IntroBox \else \smallskip\unvbox\IntroBox\par\medskip\fi} %
\end{MyVerbatim}
\newpage
\part{The PDF File}
We have two separate goals for the PDF file created by \latex[.] We need a PDF file in the proper form to submit to a print-on-demand printer. We also need a PDF file that is a digital version of the cookbook, but also includes bookmarks and links. Unfortunately, the two styles of PDF files are not identical and therefore require different compile-time options.
The best way to show the differences between the digital and print-on-demand compiles is to first describe our setup for the digital cookbook. We will then describe the changes needed to generate the print-on-demand PDF file.
\section{The Digital Cookbook}
In the digital version of the cookbook, we would like to include bookmarks and other links to content. Specifically, we would like:
\begin{itemize}[label=\textbullet, leftmargin=*, itemsep=1pt, parsep=1pt]
\item Top-level bookmarks equal to the entries in the Table of Contents.
\item Second-level bookmarks for each recipe (associated with its top-level cookbook chapter).
\item For the recipe Index, links back to each recipe by clicking on the recipe's indicated page number.
\item Within the cookbook main text, where there is a page number cross-reference to another recipe, a link back to that recipe by clicking on the cross-reference page number.
\end{itemize}
We implement these bookmarks and links by using the \pkg{hyperref} and \pkg{bookmark} packages. First, we load the packages (and set the color of the links):
\begin{MyVerbatim}
\usepackage[bookmarks=true,colorlinks=true, allcolors=clrHyperRef]{hyperref}
\usepackage{bookmark} % Q 247158 shows Heiko (the author) loads both hyperref and bookmark
\end{MyVerbatim}
To create a bookmark/link for each recipe, we define the \Cmd{RecipeBookmark} command, which will be called by the \Cmd{RecipeNameAndYield} command. (The [1] in \Cmd{pdfbookmark} makes the recipe a second-level bookmark):
\begin{MyVerbatim}
\newcounter{ctrRecipe} % initially set to zero by \newcounter macro
\NewDocumentCommand \RecipeBookmark{m}{%
\ifx\%1\empty\relax\else\stepcounter{ctrRecipe}\pdfbookmark[1]{#1}{Recipe\arabic{ctrRecipe}}\fi
}
\end{MyVerbatim}
To create a linkable \Cmd{label} to a recipe, we define the \Cmd{RecipeLabel} command (note: \Cmd{phantomsection} is from \pkg{hyperref} and marks the linkable location of the recipe). Our \Cmd{RecipePageNo} command then uses \Cmd{pageref} to display the page number and (via \pkg{hyperref}) provide a link to the recipe \Cmd{label}:
\begin{MyVerbatim}
\NewDocumentCommand \RecipeLabel{m}{\phantomsection\label{recipe:#1}}
\NewDocumentCommand \RecipePageNo{m}{\pageref{recipe:#1}}
\end{MyVerbatim}
Finally, we define the \Cmd{CookbookIndex} command (called from \pkg{cb-frontmatter.tex}) to create the recipe Index, make the Index a top-level part of the bookmarks, and include the Index in the Table of Contents:
\begin{MyVerbatim}
\NewDocumentCommand \CookbookIndex{}
{
\cleardoublepage % flush all material and clear until you start new odd numbered (recto) page
\phantomsection\addcontentsline{toc}{chapter}{\indexname} % see also Q 59619
\printindex
}
\end{MyVerbatim}
\section{The Print-On-Demand Cookbook}
There are generally stricter requirements for PDF files submitted for print-on-demand printing. We discuss the various issues below.
\subsection{Embedded Fonts}
Your print-on-demand company will require that all of your fonts are embedded in the PDF file. In most cases, it will be sufficient to include an \Quote{embedded subset} (i.e., includes only the glyphs that were actually used). However, we note Q 24005, where the questioner stated that the print-on-demand company lulu.com requires full font embedding. If that happens to you, a solution is provided at that question. But, as stated there, many font licenses disallow full font embedding. Check your font license if that situation arises.
We note that our compiled PDF file includes an embedded subset of our fonts without any special or additional steps. You should still double-check your PDF file to make sure your fonts are embedded.
As discussed at Section \ref{Glyphs} (page \pageref{Glyphs}), to avoid any unnecessary font issues, it is best to avoid loading any font you do not really need. For that reason, we relied on our already loaded fonts (rather than relying on \latex macros) for the degree, copyright, bullet and center (or mid) dot glyphs.
\subsection{Bookmarks, Annotations, and Comments}
Your PDF file should not include any bookmarks, links, annotations or comments. Because our digital cookbook includes bookmarks and links, we will need different compile-time options. We handle that by making a few small changes to the preamble. Near the top of the preamble, we use \Cmd{newif} to create a new conditional: \Cmd{ifHyperRef}. We set the value to \Cmd{HyperReftrue} if we are making the digital cookbook, and to \Cmd{HyperReffalse} if we are making the printed cookbook. For example, for the printed cookbook:
\begin{MyVerbatim}
\newif\ifHyperRef \HyperReffalse
\end{MyVerbatim}
We also modify the first two code snippets shown in the above discussion of the Digital Cookbook. Below, the \pkg{hyperref} and \pkg{bookmark} packages are only loaded if we have \Cmd{HyperReftrue}. If \Cmd{HyperReffalse}, we only need to set the \Cmd{phantomsection} and \Cmd{RecipeBookmark} commands to do nothing:
\begin{MyVerbatim}
\ifHyperRef
\usepackage[bookmarks=true,colorlinks=true, allcolors=clrHyperRef]{hyperref}
\usepackage{bookmark}
\newcounter{ctrRecipe}
\NewDocumentCommand \RecipeBookmark{m}{%
\ifx\%1\empty\relax\else\stepcounter{ctrRecipe}\pdfbookmark[1]{#1}{Recipe\arabic{ctrRecipe}}\fi
}
\else
\providecommand\phantomsection{}% Q 44088
\NewDocumentCommand \RecipeBookmark{m}{}%
\fi
\end{MyVerbatim}
\begin{SideNote}
{
You may run into anomalies in your compile if you switch back and forth between \Cmd{HyperReftrue} and \Cmd{HyperReffalse}. Because the \pkg{*.ind} index file was created with the \Quote{other} option, in the first switched compile, the contents of that file may contain unknown commands causing compile errors. Just run the compile again and all should be OK.
}
\end{SideNote}
\subsection{Trim Size, Crop Marks and Other Printer's Marks}
Almost all print-on-demand companies require: (1) that the trim size indicated in the PDF file matches the trim size requested for the printed cookbooks, and (2) that there are no crop marks or other printer's marks in the submitted PDF file.
The \Cmd{ifCookbookDraft} logic discussed on page \pageref{Geometry} handles the trim size, plus the crop marks and other printer's marks made by the \pkg{geometry} package. We also use \Cmd{ifCookbookDraft} logic to only load the \pkg{layout} and \pkg{lipsum} packages when we are in draft mode:
\begin{MyVerbatim}
\ifCookbookDraft
\usepackage{lipsum, layout}
\fi
\end{MyVerbatim}
\noindent Note that some print-on-demand printers (e.g., Kindle Direct Publishing) will not accept a PDF file that includes filler from the \pkg{lipsum} package (or similar).
\subsection{PDF/X}
Although very few print-on-demand companies \textit{require} PDF/X compliant documents, it is almost always their preferred format. We have not taken the extra steps needed for full PDF/X compliance. However, you may wish to familiarize yourself with this (very large) topic. A good starting point is the documentation for the \pkg{pdfx} package.
If you use \pkg{pdfx} or other methods of entering metadata (such as title, author, etc.) into you PDF file, be sure the entered information \boldit{exactly} matches the information you give to your print-on-demand company in their submittal forms.
\subsection{Other Print-on-Demand Issues}
Of course, document security of any type must not be used. For the best results, all images should be sized at 100\%, flattened to one layer and inserted into your file at a minimum resolution of 300 dots per inch. You should expect that all transparent objects will be flattened. See also Section \ref{Color} on page \pageref{Color} for consideration relating to color.
\newpage
\part{Examples}
In this part, we present and discuss some example code (mostly for entering recipes). You will see \Quote{in action} the use of various commands and environments, and you will see how we use some of the helper macros. We assume you have downloaded and installed the \pkg{makecookbook} package, and that you are ready to compile the sample cookbook that uses \pkg{mycookbook} as its root directory.
Recall that the \pkg{mycookbook/tex} directory holds two example chapters of recipes. To make those recipes easier to reference here, we name the first recipe \textbf{\Quote{A -- (With Recipe Name Here)}}, the second recipe \textbf{\Quote{B -- (With Recipe Name Here)}}, and so on. Here, we will refer to the included recipes by their first alphabetic letter only (e.g., \Quote{see recipe \textbf{D}}).
\section{\Cmd{RecipeNameAndYield} Command}
\subsection{Recipe A}
Recipe \textbf{A} presents the simplest case of the \Cmd{RecipeNameAndYield} command. We enter only the recipe name (no yield, no special Index entries, no cross-reference label). Our actual code:
\begin{MyVerbatim}
\RecipeNameAndYield{Name=A -- Lemon Roasted Potatoes}
\end{MyVerbatim}
\subsection{Recipe B}
In recipe \textbf{B} the \Cmd{RecipeNameAndYield} command includes an entry for \pkg{Yield=}. We also wanted the Index to hold only the actual recipe name (without the leading \textbf{B}), so we included \pkg{NoIdxName=1} and \pkg{IndexA=Pumpkin Pancakes}.
On second thought, we decided a leading \textbf{B} was needed so you could use the index to find the recipe. We therefore added \pkg{IndexB=B!Pumpkin Pancakes}, which also allowed us to demonstrate the sub-entry indicator character !\footnote{see the \pkg{makeindex} package at \pkg{ctan.org/pkg/makeindex} for documentation of the \Cmd{index} command.} and create a sub-entry for this recipe. (Yes, it looks a little funny. In the real world, a sub-entry only looks right if there are multiple sub-entries under the entry).
Check the Index entries for recipe \textbf{A} and recipe \textbf{B} to see the differences. Please note that you \textit{do not} need to include \pkg{NoIdxName=1} when you use \pkg{IndexA=} (You can have \textit{both} the original name and up to three alternate names).
\begin{MyVerbatim}
\RecipeNameAndYield{Name=B -- Pumpkin Pancakes, Yield=Yield: 6 Pancakes, NoIdxName=1,
IndexA=Pumpkin Pancakes, IndexB=B!Pumpkin Pancakes}
\end{MyVerbatim}
\subsection{Recipe C}
Recipe \textbf{C} demonstrates use of \pkg{XRefLabel=} to create a cross-reference label for this recipe. (See recipe \textbf{D} for the reference back to this recipe). Our actual code:
\begin{MyVerbatim}
\RecipeNameAndYield{Name=C -- Pesto, XRefLabel=Pesto}%
\end{MyVerbatim}
\subsection{Recipe D}
Recipe \textbf{D} demonstrates two things regarding the \Cmd{RecipeNameAndYield} command: (1) the use of \Cmd{nl} to manage multi-line text for the recipe or yield, and (2) the use of an extra set of curly braces when the key/value text includes commas. Our actual code:
\begin{MyVerbatim}
\RecipeNameAndYield{Name=D -- Pasta Genovese,
Yield={(Pasta with Pesto, Potatoes and Green Beans)\nl Makes 4 to 6 servings}}
\end{MyVerbatim}
\section{\Cmd{RecipeStory} Command}
\subsection{Recipe A}
Recipe \textbf{A} presents the typical case, using the \Cmd{RecipeStory} command \textit{without} the optional argument. We also demonstrate use of the \Cmd{lettrine} command. Our actual code:
\begin{MyVerbatim}
\RecipeStory{\lettrine{T}{his is a recipe} story. \lipsum[66]}
\end{MyVerbatim}
\subsection{Recipe E}
Recipe \textbf{E} presents the special case, using the \Cmd{RecipeStory} command \textit{with} the optional argument. Note that our recipe is the same as recipe \textbf{A}, except we: (1) increased the length of the recipe story, and (2) included the optional argument to the \Cmd{RecipeStory} command ([8]) that prints only the first 8 lines of the recipe story before the recipe, with the balance printed at the location of the \Cmd{FinishRecipeStory} command. Our actual code:
\begin{MyVerbatim}
\RecipeStory[8]{\lettrine{T}{his is a recipe} story. \lipsum[1-3]}
\end{MyVerbatim}
\section{\pkg{IngredientsAndSteps} Environment}
\subsection{Recipe A}
Recipe \textbf{A} presents the typical case, using the \pkg{IngredientsAndSteps} environment \textit{without} the optional (key/value style) argument. In that case, they only thing the \pkg{IngredientsAndSteps} environment does is set up a two-column environment (using the \pkg{multicol} package) for entering the ingredients and steps. Our actual code (with pseudo-code for the \Cmd{ListIngredientsAndSteps} command):
\begin{MyVerbatim}
\begin{IngredientsAndSteps}
\ListIngredientsAndSteps{...ingredients...}{...steps...}
\end{IngredientsAndSteps}
\end{MyVerbatim}
\subsection{Recipe F}
Recipe \textbf{F} presents the special case, using the \pkg{IngredientsAndSteps} environment \textit{with} the optional (key/value style) argument. Here, we want to shrink the ingredients and steps fonts, and and their baselines, to 92\% of their default size. We also want to increase both the left and right margins by 5 points. Our actual code (with pseudo-code for the \Cmd{ListIngredientsAndSteps} command):
\begin{MyVerbatim}
\begin{IngredientsAndSteps}[AdjIFont=0.92, AddWidth=5]
\ListIngredientsAndSteps[Tomato Meat Sauce]{...ingredients...}{...steps...}
\ListIngredientsAndSteps[Béchamel]{...ingredients...}{...steps...}
\ListIngredientsAndSteps[Assembly]{...ingredients...}{...steps...}
\end{IngredientsAndSteps}
\end{MyVerbatim}
Note that these values allow the recipe to fit on one page (try that recipe without any optional key/value entries). You might also try playing with the optional key/value entries by entering your own values. For example, set both fonts and their baselines to different values.
\section{\Cmd{ListIngredientsAndSteps} Command}
\subsection{Recipe A}
Recipe \textbf{A} presents the typical case, using the \Cmd{ListIngredientsAndSteps} command \textit{without} its optional argument. The first required argument is the list of ingredients, and the second is the list of steps. Our actual code:
\begin{MyVerbatim}
\ListIngredientsAndSteps
{ % begin ingredients
2 \Pd[s] baby Dutch gold potatoes, washed and cut in half
\fr1/2 cup water
\fr1/4 cup extra-virgin olive oil
...and the rest of the ingredients
} % end ingredients
{ % begin steps
\PreheatC{375} \ChefNote
In a \Inch{\AxB{9}{13}} baking dish, combine all ingredients except parsley.
Roast for 30 minutes.
...and the rest of the steps
} % end steps
\end{MyVerbatim}
\subsection{Recipe F}
Recipe \textbf{F} presents the special case, using the \Cmd{ListIngredientsAndSteps} command \textit{with} its optional argument. This normally is needed when you have more than one listing of ingredients and steps (e.g., one for making the cake and one for making the frosting). Our actual code (mostly pseudo-code, and for clarity we also show the \pkg{IngredientsAndSteps} environment, but not its optional arguments):
\begin{MyVerbatim}
\begin{IngredientsAndSteps}
\ListIngredientsAndSteps[Tomato Meat Sauce]
{
...ingredients...
}
{
...steps...
}
\ListIngredientsAndSteps[Béchamel]
{
...ingredients...
}
{
...steps...
}
\ListIngredientsAndSteps[Assembly]
{
...ingredients...
}
{
...steps...
}
\end{IngredientsAndSteps}
\end{MyVerbatim}
\subsection{Recipe I}
Recipe \textbf{I} presents another special case. You might wish to divide the ingredients into separate groupings, each with a heading, but only have one grouping of recipe steps. We use the \Cmd{ListIngredientsAndSteps} command \textit{without} its optional argument. But we use the \Cmd{IngredientsHeading} helper command (page \pageref{IngredientsHeading}) to enter those heading within the listing of ingredients. Note the use of optional \pkg{Arg \#1} (for the second heading) -- that is the number of points of vertical skip before the heading. (Not really needed here, but it would be useful if the heading was not at the top of a column).
\subsection{Recipes B, C and G}
Our \pkg{IngredientsAndSteps} environment uses the \pkg{multicols} environment (from the \pkg{multicol} package). It creates a two-column environment for entering ingredients and steps. One of the features of the \pkg{multicols} environment is that it balances the lengths of the first and second column. In some instances, the result may not look right to you. For example, the ingredients may take up \textit{almost} all of the first column, but not quite. To balance the two columns, the \pkg{multicols} environment may put one line from the recipe steps in the first column.
To work around the above problem, you can use the \Cmd{InsertHiddenLines} command. That command takes one mandatory parameter, which is the number of hidden lines to insert. Now look at the printed output for recipes \textbf{B}, \textbf{C} and \textbf{G}. You can probably see that we inserted, respectively, 1, 2 and 3 hidden lines at the bottom of the first column of those recipes.
Recipe \textbf{B} also uses the \Cmd{IngredientsSeparator} command. That command provides a visual separation between ingredients. In this case, it separates the dry ingredients from the wet ingredients.
\section{\Cmd{ChapterIntro} Command}
\subsection{Chapter One}
Chapter One presents the typical case, using the \Cmd{ChapterIntro} command \textit{without} the optional argument. We also demonstrate use of the \Cmd{lettrine} command. Our actual code:
\begin{MyVerbatim}
\ChapterIntro{
\lettrine{T}{his is the} chapter intro. \lipsum[1-3]
}
\end{MyVerbatim}
\subsection{Chapter Two}
Chapter Two presents the special case, using the \Cmd{ChapterIntro} command \textit{with} the optional argument. We wanted two side-by-side images at the bottom of the first page of the chapter. After a trial run, we calculated that the first 16 lines of the \textit{chapter into} text would fit (with the images) on page one. We print the balance of the \textit{chapter into} text with the \Cmd{FinishChapterIntro} command. Our actual code:
\begin{MyVerbatim}
\ChapterIntro[16]{\lipsum[1-3]}
\SideBySide[LeftCaption={left caption}, RightCaption={right caption}]{image-a}{image-b}
\FinishChapterIntro{}
\end{MyVerbatim}
\end{document}
|