summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/cuisine/cuisine.dtx
blob: e68a15601bd4db99d770c3eca8eab18f5694a4ca (plain)
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
%\iffalse        This is file `cuisine.dtx'
%%
%% Recipe typesetting package `cuisine' by Ben Cohen.
%% cuisine.dtx
%% Copyright 2000-2002, 2014 Ben Cohen
%
% This program may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.2
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.2 or later is part of all distributions of LaTeX 
% version 1999/12/01 or later.
%
% This program consists of the files cuisine.dtx and cuisine.ins
%
%  $Id: cuisine.dtx,v 1.105 2014/06/26 20:12:05 ben Exp ben $
% ------------------------------------------------ 
%
%<*driver>
\documentclass{ltxdoc}
\usepackage[nonumber]{cuisine}
\GetFileInfo{cuisine.sty} % defines \filename, \filedate, \fileversion, 
                          % \fileinfo from cuisine.sty
\begin{document}
  \def\myemailaddress{\texttt{ben\_c@tiscali.co.uk}}
  \title{The \texttt{cuisine} package}
  \author{Ben Cohen}
  \date{\filedate, \fileversion}
  \maketitle
  \DocInput{cuisine.dtx}
\end{document}
%</driver> 
%\fi
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \CheckSum{739} 
%
% \begin{abstract}
% This package provides an environment for typesetting recipes in steps
% in which each ingredient is on the left of the page next to the
% method step where it is used.
% \end{abstract}
% 
% \MakeShortVerb{\|}
% \section{Introduction}
% There appear to be two styles of typesetting recipes in general use.  The
% more common (at least in recipe books in the U.K.)
% is where the ingredients appear at the top above the method, 
% as in the class |macros/latex/contrib/other/recipe|. Another
% way is to have each ingredient next to the method step in which it appears, 
% as in the package |macros/latex/contrib/supported/cooking|; 
% the |cuisine| package also uses this style, but closer to the format in 
% \textit{Practical Professional Cookery} by H.~L.\ Cracknell and R.~J.\
% Kaufmann.
%
% \section{Usage}
% The package is loaded using the header |\usepackage{cuisine}|;  the
% available options are:
% \begin{itemize}
% \item{|number|}\ \ Recipes will be numbered sequentially to the left of the 
% recipe title.  (This is the
% default.) The recipe \emph{steps} will always be numbered.
% \item{|nonumber|}\ \ Recipes will not be numbered.
% \item{|index|}\ \ Recipe titles will be written to the index for the
% document.
% \item{|noindex|}\ \ Recipe titles will not be written to the document
% index.
% (This is the default.)
% \item{|contents|}\ \ Recipe titles will be written to the contents for the
% document.
% \item{|nocontents|}\ \ Recipe titles will not be written to the document
% contents.
% (This is the default.)
% \end{itemize}
% You will need the package |nicefrac|; 
% it comes
% with current versions of te\TeX\ and is also 
% available from CTAN as part of the package |units| in 
% |macros/latex/|\hskip0cm|contrib/supported/|\hskip0cm|units|.
% 
%
% \medskip
% \DescribeEnv{recipe}
% Each recipe is set out in a |recipe| environment.  The three
% parameters are the title, and two recipe description fields---it is assumed
% that they are used for the number of servings and the preparation time, for
% example:
% \begin{quote}
%   |\begin{recipe}{|\textit{Title}|}|%
%               |{|\textit{Number of servings}|}|%
%               |{|\textit{Preparation time}|}|
%               \\$\vdots$\\|\end{recipe}|
% \end{quote}
% There is no reason why the descriptive fields cannot be used for other
% things (such as the number of calories).
% 
% \medskip
% \DescribeMacro{\ingredient}
% \DescribeMacro{\ing}
% Within the environment, you type in method details directly, and you
% type the ingredients using |\ingredient| or the shorter version |\ing|
% \textit{before} the method step beside which you want the ingredient to
% appear.  A new method step is started whenever there is method text before
% an |\ingredient|.  Two consecutive |\ingredient|
% declarations will appear next to the same method step.
%
% The |\ingredient| command is used as follows:
% \begin{quote}
%   |\ingredient{|\textit{Quantity}|}|%
%               |{|\textit{Ingredient}|}|
% \end{quote}
% There is an optional first parameter which allows you to separate the 
% numerical quantity from the name of the unit of measurement:
% \begin{quote}
%   |\ingredient[|\textit{Numerical quantity}|]|%
%               |{|\textit{Unit of measurement}|}|%
%               |{|\textit{Ingredient}|}|
% \end{quote}
% Examples include:
% \begin{quote}
%   |\ingredient{a pinch}{salt}|\\
%   |\ingredient[4]{oz}{sugar}|
% \end{quote}
%
% \medskip
% \DescribeMacro{\Ingredient}
% \DescribeMacro{\Ing}
% There is an alternative way to specify ingredients using a single 
% description for both the quantity and the ingredient, as follows:
% \begin{quote}
%   |\Ingredient{|\textit{Ingredient and quantity}|}|
% \end{quote}
% This can be used where describing awkward descriptions of units.  It would 
% also be preferable if you simply don't like the appearance of separating 
% units from ingredients as required by |\ingredient|.  (My taste has
% apparently changed over the last decade and a half!)  For example:
% \begin{quote}
%   |\Ingredient{zest and juice of 2 lemons}|\\
%   |\Ingredient{Worcestershire sauce, to taste}|\\
% \end{quote}
%
%
% \medskip
% \DescribeMacro{\fr}
% Within the recipe you can use |\fr| to typeset fractions using
% |\fr12| to get \nicefrac12, or |\fr{11}{12}| to typeset \nicefrac{11}{12}.
% If the numerator or denominator of the fraction is more than one digit long
% then you will need to enclose it in braces (otherwise they are optional).
%
% \DescribeMacro{\degrees}
% \DescribeMacro{\0}
% \DescribeMacro{\X}
% \DescribeMacro{\%}
% A degree symbol can be obtained using |\degrees| or the shorter form |\0|;
% for example |120\0| gives 120${}^\circ$.
% A times symbol, ${}\times{}$, can be obtained using |\X|.
% As is usual with \LaTeX, to obtain a percent sign, \%, you must use |\%|
% since |%| on its own starts a comment.
% 
% 
% \section{More advanced usage}
% The |cuisine| package has been designed so that it is easy to vary the
% widths of the columns.  \LaTeX\ has very wide margins by default 
% so the text width is very narrow which may be unsuitable for
% typesetting recipes using this package.  (It might be worth looking at the
% KOMA-Script classes in 
% |macros/latex/|\hskip0pt|contrib/supported/|\hskip0pt|koma-script/| as an
% alternative to the standard \LaTeX\ classes.)
%
% \DescribeMacro{\RecipeWidths}
% The |\RecipeWidths| command is designed to be used in conjunction with the
% \LaTeX\ commands for changing the page layout.  It is used as follows:
% \begin{quote}
%   |\RecipeWidths{|\textit{Total recipe width}|}|%
%               |{|\textit{Number of servings width}|}|%
%               |{|\textit{Step number width}|}|%
%               |{|\textit{Ingredient width}|}|%
%               |{|\textit{Quantity width}|}|%
%               |{|\textit{Units width}|}|
% \end{quote}
%
% \medskip
% \DescribeMacro{\ResetRecipeCounter}
% The |\ResetRecipeCounter| command will reset the recipe counter so that 
% subsequent recipes are numbered from 1.
%
% \medskip
% \DescribeMacro{\newstep}
% Within the recipe environment, to force a new step if you do not want 
% to declare any ingredients, use the
% |\newstep| command.  (A |\newstep| command with no preceding ingredient or
% method text will be ignored to prevent completely empty steps from
% appearing.)
%
% \DescribeMacro{\newpage}
% |\newpage| ends the current step (as for |\newstep|) but also tells the 
% environment that the next step will appear on
% the next page. 
% It is not normally necessary to use this command since page breaking after
% each method step will be done automatically by \LaTeX\ as necessary.
% Page breaks can only
% occur between method steps; method steps will not be split across pages.
% (Consequently, it may be advisable to keep method steps fairly short.)
%
% \medskip
% \DescribeMacro{\freeform}
% To typeset text across the whole width of the recipe instead of just the
% width of the method, use the |\freeform| command.  This is equivalent to 
% |\noalign| in tables.  Freeform text is not given a step number.
%
% \medskip
% The recipe environment has an optional first parameter with which you can
% assign a label to a recipe.
% \begin{quote}
%   |\begin{recipe}[|\textit{Label}|]{|\textit{Title}|}|%
%               |{|\textit{Servings}|}|%
%               |{|\textit{Preparation time}|}|
%               \\$\vdots$\\|\end{recipe}|
% \end{quote}
% |\pageref| and |\ref| then refer to the recipe page number
% and recipe number respectively of the recipe with that label.  For example,
% the label in the recipe below will make |\ref{Zabaglione}| give recipe
% number \ref{Zabaglione}.  (Note that you cannot use |\label| for this
% purpose within the environment because it breaks the formatting.)
%
% \section{Fonts}
% The fonts used in the different parts of a recipe can be altered by
% changing the definition of the following macros; this should be done
% using, for example, \verb|\renewcommand*{\recipetitlefont}{\sffamily}|.
%
% \begin{tabular}{ll}
% \verb|\recipefont|&The default font used for the fonts below\\
% \verb|\recipetitlefont|&The font for the recipe title\\
% \verb|\recipeservingsfont|&The font for the number of servings\\
% \verb|\recipetimefont|&The font for the preparation time\\
% \verb|\recipenumberfont|&The font for the recipe number\\
% \verb|\recipestepnumberfont|&The font for each step number\\
% \verb|\recipequantityfont|&The font for the numerical quantity\\
% \verb|\recipeunitfont|&The font for the unit of measurement\\
%   & (or descriptive quantity)\\
% \verb|\recipeingredientfont|&The font for the ingredient\\
% \verb|\recipemethodfont|&The font for the method details\\
% \verb|\recipefreeformfont|&The font for freeform descriptions\\
% \end{tabular}
%
% \section{Examples}
% \subsection{A simple example}
% There is only whitespace between the first three 
% ingredients, so they are used for the first step with
% the method text which follows.  (Had
% there been text before the first ingredient, that text would become the first
% step and the heating instruction would be the second step.)  The fourth
% |\ingredient| signals the end of the method text and starts a new step.  The
% final |\end{recipe}| finishes that step.  
% \medskip
%
% \begin{small}\noindent
% |\begin{recipe}{Yorkshire Pudding}{4 portions}{1\fr12 hours}|\\
% |\ingredient[\fr12]{pt}{milk}|\\
% |\ingredient[2]{oz}{butter}|\\
% |\ingredient[5]{oz}{self-raising flour}|\\
% |Heat the milk and butter until nearly boiling.  Add flour and allow to|\\
% |seeth over.|\\
% |\ingredient[3]{}{eggs}|\\
% |\ingredient{to taste}{salt and pepper}|\\
% |Add the remaining eggs and whisk again.  Cook at 220\0C for about 1 hour.|\\
% |\end{recipe}|
% \end{small}
% \medskip
%
% \begin{recipe}{Yorkshire Pudding}{4 portions}{1\fr12 hours}
% \ingredient[\fr12]{pt}{milk}
% \ingredient[2]{oz}{butter}
% \ingredient[5]{oz}{self-raising flour}
% Heat the milk and butter until nearly boiling.  Add flour and
% allow to seeth over.
% \ingredient[3]{}{eggs}
% \ingredient{to taste}{salt and pepper}
% Add the remaining eggs and whisk again.  Cook at 220\0C
% for about 1 hour.
% \end{recipe}
%
% \bigskip
% The recipe below is the same but using the single-argument |\Ingredient| 
% command.  As you can see, the alignment is different from that of
% |\ingredient| and mixing them probably won't produce a pleasing output.
% If you are using only |\Ingredient| then the ingredients column can probably
% be made narrower (remember that this is still the sum of the quantity, unit
% and ingredient widths).
% \begin{recipe}{Yorkshire Pudding}{4 portions}{1\fr12 hours}
% \Ingredient{\fr12 pt milk}
% \Ingredient{2 oz butter}
% \Ingredient{5 oz self-raising flour}
% Heat the milk and butter until nearly boiling.  Add flour and
% allow to seeth over.
% \Ingredient{3 eggs}
% \Ingredient{salt and pepper, to taste}
% Add the remaining eggs and whisk again.  Cook at 220\0C
% for about 1 hour.
% \end{recipe}
% 
% \bigskip
%
% \subsection{A more complex example}
% We can change the widths of the columns using, for example,
% \begin{quote}
% |\RecipeWidths{.75\textwidth}{3cm}{0.5cm}{1.75cm}{.75cm}{.75cm}|
% \end{quote}
% \noindent and the |small| environment to produce a different layout.
% We can also change the fonts, for example:
% \begin{quote}
% |\renewcommand*{\recipetitlefont}{\large\bfseries\sffamily}|\\
% |\renewcommand*{\recipenumberfont}{\large\bfseries\sffamily}|\\
% |\renewcommand*{\recipequantityfont}{\sffamily\bfseries}|\\
% |\renewcommand*{\recipeunitfont}{\sffamily}|\\
% |\renewcommand*{\recipeingredientfont}{\sffamily}|\\
% |\renewcommand*{\recipefreeformfont}{\itshape}|
% \end{quote}
%
% The example below demostrates the |\newstep| and |\newpage| commands, and
% also how to use |\freeform| to create freeform text.  |\freeform| can also
% be used to create rules in the same way as when using |\noalign| in tables.
% In this case, recipe numbering has been turned on, and the |small|
% environment is being used.  Note the label declaration 
% ``Zabaglione''.
%
% \medskip
% \begin{small}\noindent
% |\begin{recipe}[Zabaglione]{Zabaglione alla Marsala}{4 Portions}{\fr12 hour}|\\
% |\freeform This is a well-known Italian recipe which is |\\
% |great for piling on the calories.|\\
% |\ingredient[6]{}{egg yolks}|\\
% |\ingredient[2]{oz}{granulated sugar}|\\
% |\ingredient[6--8]{tbsp}{Marsala (or sherry)}|\\
% |\ingredient[\fr14]{oz}{gelatine}|\\
% |\ingredient[2]{tbsp}{cold water}|\\
% |In the top of a double boiler, combine the egg yolks with sugar and|\\
% |Marsala, and whip the mixture over hot, but not boiling, water until it|\\
% |thickens. Stir in gelatine, softened in cold water and dissolved over hot|\\
% |water.|\\
% |\ingredient[3]{tbsp}{brandy}|\\
% |\ingredient[\fr38]{pt}{double cream}|\\
% |Put the pan in a bowl of ice and stir the |\\
% |zabaglione well until it is thick and free of bubbles.  When it is almost |\\
% |cold, fold in brandy and whipped cream and pour into individual moulds.|\\
% |\freeform\rule{\textwidth}{0.05pt}\newpage|\\
% |\freeform\rule{\textwidth}{0.05pt}|\\
% |\ingredient[3]{}{egg yolks}|\\
% |\ingredient[1]{oz}{granulated sugar}|\\
% |\ingredient[3--4]{tbsp}{Marsala (or sherry)}|\\
% |\ingredient[1\fr12]{tbsp}{brandy}|\\
% |To make the sauce, combine egg yolks and sugar in the top of a double |\\
% |saucepan.  Whisk mixture over hot, but not boiling, water until the|\\
% |sauce coats |\\
% |the back of a spoon.  Stir in the Marsala and brandy.|\\
% |\newstep|\\
% |Chill the zabaglione, unmould it, and serve with the sauce immediately.|\\
% |\freeform\hrulefill|\\
% |\end{recipe}|
% \medskip
% \begin{center}
% \renewcommand*{\recipetitlefont}{\large\bfseries\sffamily}
% \renewcommand*{\recipenumberfont}{\large\bfseries\sffamily}
% \renewcommand*{\recipequantityfont}{\sffamily\bfseries}
% \renewcommand*{\recipeunitfont}{\sffamily}
% \renewcommand*{\recipeingredientfont}{\sffamily}
% \renewcommand*{\recipefreeformfont}{\itshape}
% \RecipeWidths{.75\textwidth}{3cm}{0.5cm}{1.75cm}{.75cm}{.75cm}
% \makeatletter\numb@ringtrue\makeatother ^^A Cheap trick
% \ResetRecipeCounter
%
% \begin{recipe}[Zabaglione]{Zabaglione alla Marsala}{4 Portions}{\fr12 hour}
% \freeform This is a well-known Italian recipe which is 
% great for piling on the calories.
% \ingredient[6]{}{egg yolks}
% \ingredient[2]{oz}{granulated sugar}
% \ingredient[6--8]{tbsp}{Marsala (or sherry)}
% \ingredient[\fr14]{oz}{gelatine}
% \ingredient[2]{tbsp}{cold water}
% In the top of a double boiler, combine the egg yolks 
% with sugar and Marsala, and whip the mixture over hot, but not 
% boiling, water until it thickens.  Stir in gelatine, softened in cold water 
% and dissolved over hot water.
% \ingredient[3]{tbsp}{brandy}
% \ingredient[\fr38]{pt}{double cream}
% Put the pan in a bowl of ice and stir the 
% zabaglione well until it is thick and free of bubbles.  When it is almost 
% cold, fold in brandy and whipped cream and pour into individual moulds.
% \freeform\rule{\textwidth}{0.05pt}\newpage
% \freeform\rule{\textwidth}{0.05pt}
% \ingredient[3]{}{egg yolks}
% \ingredient[1]{oz}{granulated sugar}
% \ingredient[3--4]{tbsp}{Marsala (or sherry)}
% \ingredient[1\fr12]{tbsp}{brandy}
% To make the sauce, combine egg yolks and sugar in the top of a double 
% saucepan.  Whisk mixture over hot, but not boiling, water until the
% sauce coats 
% the back of a spoon.  Stir in the Marsala and brandy.
% \newstep
% Chill the zabaglione, unmould it, and serve with the sauce immediately.
% \freeform\hrulefill
% \end{recipe}
% \end{center}\end{small}
%
% \section{Bugs, Issues, Features, \dots}
% \begin{itemize}
% \item{Method steps can't be split across pages.  This means you can get
% lots of empty white space at the bottom of pages, especially if you have 
% long methods.}
% \item{There may be alignment problems if the recipe fonts differ much in
% height.}
% \item{Formatting doesn't work very well when the ingredient quantity is 
% too wide for its box.}
% \item{There is no support for dual sets of quantities, for example  where two
% systems of measurement are used or for different numbers of servings.  
% You can write \verb|\ingredient{<4 oz>/<100 g>}{butter}|, or use
% |\Ingredient| but I don't think implementing commands such as 
% \verb|\ingredient[1]{oz}[25]{g}{butter}| would be worthwhile.}
% \end{itemize}
% Please e-mail me at \myemailaddress\ if you can help find or solve any 
% problems with this package.
% 
% \section{Change History}
% \begin{small}
% \begin{itemize}
% \item[\sl v0.5]Written---release on CTAN. 
% \item[\sl v0.6]Fixed a couple of vertical alignment problems.
%                Labelling of recipes for |\ref|. |\X| (times) macro.
%                Added different index and contents options, and corrected a
%                bug that sometimes gave the wrong page number.
%                If |recipe|'s |#4| is empty, don't leave a blank line.
%                The step number width can be changed but the recipe number
%                width varies.
% \item[\sl v0.7]Added the |\Ingredient| command for single-argument
%                ingredients.
% \end{itemize}
% \end{small}
%
% \StopEventually{}
% \newpage
% \setlength{\parindent}{0cm}
%
% \section{Identification section and initialisation}
% The package declaration follows the standard form.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{cuisine}[2014/06/26 v0.7 recipe typesetting]
%    \end{macrocode}
%
% We use the |nicefrac| package for ``nice'' fractions.
%    \begin{macrocode}
\RequirePackage{nicefrac}
%    \end{macrocode}
%
%^^A ------------------------------------------------
% \section{Counters, booleans and lengths}
%
% |r@cipenumber| is the recipe number counter.
%                  This could be made dependent on, say, the section number.
%    \begin{macrocode}
\newcounter{r@cipenumber}
%    \end{macrocode}
%
% \begin{macro}{\ResetRecipeCounter}
% The |\ResetRecipeCounter| macro resets the recipe number counter to 0.
%    \begin{macrocode}
\DeclareRobustCommand{\ResetRecipeCounter}{%
  \setcounter{r@cipenumber}{0}%
}
%    \end{macrocode}
% \end{macro}
%
% |st@pnumber| is the step counter within recipes.
%                  It is zeroed whenever the recipe counter is incremented.
%    \begin{macrocode}
\newcounter{st@pnumber}[r@cipenumber]  
%    \end{macrocode}
%
% |ingr@dnumber| is the ingredient counter within recipes and steps.
%                  It is zeroed whenever the step counter is incremented.
%    \begin{macrocode}
\newcounter{ingr@dnumber}[st@pnumber]  
%    \end{macrocode}
%
%\medskip
% |ifnumb@ring| determines whether or not recipe numbers are printed. 
%                  (Step numbers will always be printed.)
%    \begin{macrocode}
\newif\ifnumb@ring
%    \end{macrocode}
%
% |ifc@ntentsing| determines whether we are 
% writing the recipes to an contents file or not.
%    \begin{macrocode}
\newif\ifc@ntentsing
%    \end{macrocode}
%
% |ifind@xing| determines whether we are 
% writing the recipes to an index file or not.
%    \begin{macrocode}
\newif\ifind@xing
%    \end{macrocode}
%
% |iffr@eforming| determines whether or not we are in freeform mode.
%    \begin{macrocode}
\newif\iffr@eforming
%    \end{macrocode}
%
% |ifn@wpaging| determines whether or not the next step will be on a new
% page.
%    \begin{macrocode}
\newif\ifn@wpaging
%    \end{macrocode}
%
% |\R@cipeWidth| is the total width of the recipe.
%    \begin{macrocode}
\newlength{\R@cipeWidth}
%    \end{macrocode}
%
% The following are, respectively, the widths of the recipe number box, the 
% recipe title box, the recipe number-of-servings box, and the total of the
% recipe title and number-of-servings boxes.
%    \begin{macrocode}
\newlength{\R@cipeNumberWidth}
\newlength{\R@cipeTitleWidth}
\newlength{\R@cipeServingsWidth}
\newlength{\R@cipeTandSWidth}
%    \end{macrocode}
%
% This is the distance ingredient (etc.) paragraphs are outdented.
%    \begin{macrocode}
\newlength{\R@cipeOutdent}
%    \end{macrocode}
%
% These are the horizontal spaces between the quantity and units, and between 
% the unit and the ingredient.
%    \begin{macrocode}
\newlength{\R@cipeIngQUSpace}
\newlength{\R@cipeIngUISpace}
%    \end{macrocode}
%
% These are the vertical distances for the recipe title-to-rule adjustments 
% (usually negative).
%    \begin{macrocode}
\newlength{\R@cipeTitleVerticalAdjustTop}
\newlength{\R@cipeTitleVerticalAdjustBot}
%    \end{macrocode}
%
% These are the widths of the ingredient descriptors and combinations of
% them.
%    \begin{macrocode}
\newlength{\R@cipeIngredientWidth}
\newlength{\R@cipeQuantityWidth}
\newlength{\R@cipeUnitsWidth}
\newlength{\R@cipeQandUWidth}
\newlength{\R@cipeIandUWidth}
\newlength{\R@cipeIQUWidth}
\newlength{\R@cipeSingleIngWidth}
%    \end{macrocode}
%
% |\R@cipeMethodWidth| is the width of the method text.
%    \begin{macrocode}
\newlength{\R@cipeMethodWidth}
%    \end{macrocode}
%
% |\St@pNumberWidth| is the width of the step number and |\R@cipeStepWidth| is 
% the width of everything within a step.
%    \begin{macrocode}
\newlength{\St@pNumberWidth}
\newlength{\R@cipeStepWidth}
%    \end{macrocode}
%
%\medskip
% The following macros are to set the lengths defined above.
%
% \begin{macro}{\R@cipeMethodWidths}
% |\R@cipeMethodWidths| is to set the widths of the boxes/columns used in the
% recipe steps.
% There are four parameters:  |#1| is the step number width, |#2| is the
% ingredient width, |#3| the quantity width, |#4| the units width.  
% The other lengths below are deduced from these and |\R@cipeMethodWidth|.  
% The |0.5cm| values are to leave a little space between the columns.
%    \begin{macrocode}
\DeclareRobustCommand*{\R@cipeMethodWidths}[4]{%
  \setlength{\St@pNumberWidth}{#1}%
  \setlength{\R@cipeIngredientWidth}{#2}%
  \setlength{\R@cipeQuantityWidth}{#3}%
  \setlength{\R@cipeUnitsWidth}{#4}%
  \setlength{\R@cipeQandUWidth}{\R@cipeQuantityWidth}%
  \addtolength{\R@cipeQandUWidth}{\R@cipeUnitsWidth}%
  \setlength{\R@cipeIQUWidth}{\R@cipeQandUWidth}%
  \addtolength{\R@cipeIQUWidth}{\R@cipeIngredientWidth}%
  \addtolength{\R@cipeIQUWidth}{0.5cm}%
  \setlength{\R@cipeIandUWidth}{\R@cipeIQUWidth}%
  \addtolength{\R@cipeIandUWidth}{-\R@cipeQuantityWidth}%
  \setlength{\R@cipeStepWidth}{\R@cipeWidth}%
  \addtolength{\R@cipeStepWidth}{-\St@pNumberWidth}%
  \setlength{\R@cipeMethodWidth}{\R@cipeStepWidth}%
  \addtolength{\R@cipeMethodWidth}{-\R@cipeIngredientWidth}%
  \addtolength{\R@cipeMethodWidth}{-\R@cipeQandUWidth}%
  \addtolength{\R@cipeMethodWidth}{-0.5cm}%
  \setlength{\R@cipeSingleIngWidth}{\R@cipeIQUWidth}%
%    \end{macrocode}
%  Allow for the ingredient paragraph outdenting.
%    \begin{macrocode}
  \addtolength{\R@cipeIngredientWidth}{-\R@cipeOutdent}
  \addtolength{\R@cipeUnitsWidth}{-\R@cipeOutdent}
  \addtolength{\R@cipeQandUWidth}{-\R@cipeOutdent}
  \addtolength{\R@cipeSingleIngWidth}{-\R@cipeOutdent}
  \addtolength{\R@cipeSingleIngWidth}{-\R@cipeIngQUSpace}
  \addtolength{\R@cipeSingleIngWidth}{-\R@cipeIngUISpace}
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\R@cipeTitleWidths}
% |\R@cipeTitleWidths| is to set the widths of the boxes/columns used in
% the recipe title.
%   There are two parameters:  |#1| is the number of servings width.
% The title width is deduced from that.
%    \begin{macrocode}
\DeclareRobustCommand*{\R@cipeTitleWidths}[1]{%
  \setlength{\R@cipeServingsWidth}{#1}%
  \setlength{\R@cipeTitleWidth}{\R@cipeWidth}%
  \addtolength{\R@cipeTitleWidth}{-\R@cipeServingsWidth}%
  \setlength{\R@cipeTandSWidth}{\R@cipeServingsWidth}%
  \addtolength{\R@cipeTandSWidth}{\R@cipeTitleWidth}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\RecipeWidths}
% |\RecipeWidths| combines the above macros in a useable form.  There are six
% parameters:
% |#1| is the recipe width, |#2| the number of servings width, |#3| the step
% number width, |#4| the ingredient width, |#5| the quantity width, |#6| the
% units width.
%    \begin{macrocode}
\DeclareRobustCommand*{\RecipeWidths}[6]{%
  \setlength{\R@cipeWidth}{#1}%
  \R@cipeTitleWidths{#2}%
  \R@cipeMethodWidths{#3}{#4}{#5}{#6}%
}%
%    \end{macrocode}
% \end{macro}
%
%\medskip
% Now we set up the default values.
%     These appear to be reasonable for the LaTeX default page layout
%     (A4, portrait, one column, etc.)
%     I don't think the LaTeX default width is good for a recipe book though!
%    \begin{macrocode}
\setlength{\R@cipeOutdent}{0.3cm}%
\setlength{\R@cipeIngQUSpace}{0.1cm}%
\setlength{\R@cipeIngUISpace}{0.2cm}%
\setlength{\R@cipeTitleVerticalAdjustTop}{-0.25cm}
\setlength{\R@cipeTitleVerticalAdjustBot}{-0.25cm}
\RecipeWidths{\textwidth}{3cm}{0.8cm}{3.5cm}{1cm}{1.7cm}
%    \end{macrocode}
%
%^^A ------------------------------------------------
%
% \section{Fonts}
% This is where the default fonts are set up.
% \verb|\recipefont| is the default font for the other recipe fonts; thus
% the other fonts inherit from this but can be altered individually.
%    \begin{macrocode}
\newcommand*\recipefont{\normalfont}
\newcommand*\recipetitlefont{\recipefont}
\newcommand*\recipenumberfont{\recipefont}
\newcommand*\recipestepnumberfont{\recipefont}
\newcommand*\recipequantityfont{\recipefont}
\newcommand*\recipeunitfont{\recipefont}
\newcommand*\recipeingredientfont{\recipefont}
\newcommand*\recipemethodfont{\recipefont}
\newcommand*\recipeservingsfont{\recipefont}
\newcommand*\recipetimefont{\recipefont}
\newcommand*\recipefreeformfont{\recipefont}
%    \end{macrocode}
%
%
%^^A ------------------------------------------------
% \section{Boxes}
% |\st@pingrbox| is to hold the ingredients cumulatively as each |\ingredient|
% command is processed; |\st@pingrtmpbox| and |\titl@tmpbox| are used as
% temporary transfer boxes.
%    \begin{macrocode}
\newsavebox{\st@pingrbox}
\newsavebox{\st@pingrtmpbox}
\newsavebox{\titl@tmpbox}
%    \end{macrocode}
% This is used to hold a single ingredient as it is being processed:
%    \begin{macrocode}
\newsavebox{\st@pIQUbox}
%    \end{macrocode}
% This is to hold the method (or freeform) text for the step:
%    \begin{macrocode}
\newsavebox{\st@pmethodbox}
%    \end{macrocode}
%
% ^^A------------------------------------------------
% \section{Options}
%
% |nonumber| --- Should recipes be numbered?     (The default is yes.)
%    \begin{macrocode}
\DeclareOption{number}{\numb@ringtrue}
\DeclareOption{nonumber}{\numb@ringfalse}
%    \end{macrocode}
%
% |contents|  --- Should recipes be indexed to a file?      (The default is no.)
%    \begin{macrocode}
\DeclareOption{contents}{\c@ntentsingtrue}
\DeclareOption{nocontents}{\c@ntentsingfalse}
%    \end{macrocode}
%
% |index|  --- Should recipes be indexed to a file?      (The default is no.)
%    \begin{macrocode}
\DeclareOption{index}{\ind@xingtrue}
\DeclareOption{noindex}{\ind@xingfalse}
%    \end{macrocode}
%
% Process the options, using the defaults if necessary.
%    \begin{macrocode}
\ExecuteOptions{number,noindex,nocontents}
\ProcessOptions\relax
%    \end{macrocode}
%
%^^A ------------------------------------------------
% \section{The main macros}
% \subsection{Macros for displaying the steps and title}
%
%\begin{macro}{\Displ@ySt@p}
% |\Displ@ySt@p| displays the ingredients and method for the current step
%                  and resets things ready for the next step.
%    \begin{macrocode}
\DeclareRobustCommand{\Displ@ySt@p}{%
%    \end{macrocode}
% First, increment the step counter and put extra vertical space between steps.
% (But it isn't uniform yet, unfortunately.)
%    \begin{macrocode}
  \stepcounter{st@pnumber}%
%    \end{macrocode}
% Display this step.
%    \begin{macrocode}
  \makebox[\R@cipeWidth]{%
    \makebox[\St@pNumberWidth][l]{\recipestepnumberfont\arabic{st@pnumber}}%
    \usebox{\st@pingrbox}%
    \usebox{\st@pmethodbox}%
  }%
%    \end{macrocode}
% Finally, clear the step storage boxes for the next step.
%    \begin{macrocode}
  \savebox{\st@pingrbox}[\R@cipeIQUWidth]{}
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Fr@eFormStep}
% |\Fr@eFormStep| displays a free form description; it works in the same way
% as |\Displ@ySt@p|.
%    \begin{macrocode}
\DeclareRobustCommand{\Fr@eFormStep}{%
  \usebox{\st@pmethodbox}%
  \savebox{\st@pmethodbox}[\R@cipeMethodWidth]{}%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\DisplaySt@p}
%  This calls one of the two display routines above,
% depending on whether we are freeforming 
%  or not.
%    \begin{macrocode}
\DeclareRobustCommand{\DisplaySt@p}{%
  \iffr@eforming%
    \Fr@eFormStep%
  \else%
    \Displ@ySt@p%
  \fi%
  \ifn@wpaging%
    \recipen@wpage%
  \else%
    \vskip0.2cm%
  \fi%
  \n@wpagingfalse%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\r@cipetitle}
%  |\r@cipetitle| displays the recipe title construction, given the parameters
%  |#1| the title, |#2| the number of servings and |#3| the preparation time.
%
%    \begin{macrocode}
\DeclareRobustCommand{\r@cipetitle}[3]{%
%    \end{macrocode}
% The |\parskip| ensures that the distance between the rule and the text above
% and below does not change when the page's vertical glue ``sets''.
% The following displays the text line above the rule; the recipe number width
% is automatically determined here.
%    \begin{macrocode}
  \mbox{%
    \makebox[\R@cipeWidth][t]{%
      \parbox[t]{\R@cipeWidth}{%
        \ifnumb@ring%
          \savebox{\titl@tmpbox}{%
            {\recipenumberfont\arabic{r@cipenumber}\ \ }%
          }%  
          \setlength{\R@cipeNumberWidth}{\wd\titl@tmpbox}%
          \addtolength{\R@cipeTitleWidth}{-\R@cipeNumberWidth}%
          \addtolength{\R@cipeTandSWidth}{-\R@cipeNumberWidth}%
          \lineskip0pt\mbox{}\\[-\baselineskip]%
          \parbox[b]{\R@cipeNumberWidth}{%
            \rule{0pt}{\baselineskip}%
            \strut\usebox{\titl@tmpbox}%
            \strut%
          }%
          \makebox[\R@cipeTandSWidth][t]{%
            \parbox[t]{\R@cipeTandSWidth}{%
              \lineskip0pt\mbox{}\\[-\baselineskip]%
              \parbox[b]{\R@cipeTitleWidth}{%
                \rule{0pt}{\baselineskip}%
                \strut{\recipetitlefont #1}\strut\hfill}%
              \parbox[b]{\R@cipeServingsWidth}{%
                \strut{\hfill\recipeservingsfont #2}\strut}%
            }%
          }%
          \addtolength{\R@cipeTandSWidth}{\R@cipeNumberWidth}%
          \addtolength{\R@cipeTitleWidth}{\R@cipeNumberWidth}%
        \else%
          \lineskip0pt\mbox{}\\[-\baselineskip]%
          \parbox[b]{\R@cipeTitleWidth}{%
            \rule{0pt}{\baselineskip}%
            \strut{\recipetitlefont #1}\strut\hfill}%
          \parbox[b]{\R@cipeServingsWidth}{%
            \strut{\hfill\recipeservingsfont #2}\strut}%        
        \fi%
      }%
    }%    
  }\par%
%    \end{macrocode}
% Next we display the rule, being careful not to allow
% page breaks during the title, using the adjustments as specified above.
% (This is a bit vague and nasty...)
%    \begin{macrocode}
%%  \nopagebreak   
%%  \vspace{\R@cipeTitleVerticalAdjustTop}%
  \nopagebreak
  \rule[-\R@cipeTitleVerticalAdjustTop]{\R@cipeWidth}{0.4pt}\par%
  \nopagebreak
  \vskip\R@cipeTitleVerticalAdjustBot%
%%  \vspace{\R@cipeTitleVerticalAdjustBot}%
  \nopagebreak
%    \end{macrocode}
% Finally we display the text line below the rule if it isn't empty:
%    \begin{macrocode}
  \ifx\relax#3\relax%
  \else
    \makebox[\R@cipeWidth][r]{\recipetimefont #3}\par%
  \fi
  \nopagebreak
}%
%    \end{macrocode}
%\end{macro}
%
%
% \subsection{Macros for the method box}
% These macros are to input the method box |\st@pmethodbox|, and are hence
% called at the start and end of the method box, or equivalently the
% \emph{end} and \emph{start} of the ingredient (etc.) macros.
%
%\begin{macro}{\r@cipesloppy}
%  This is a version of \sloppy which doesn't cause problems with the 
%  definition!  (The \LaTeX\ definition has a problem where the empty box
%  detection in |\pr@ingred| fails.)
%    \begin{macrocode}
\def\r@cipesloppy{%
  \tolerance 9999%
  \emergencystretch 3em%
  \hfuzz.5pt%
  \vfuzz.5pt%
%    \end{macrocode}
%  This is not in |\sloppy|:  avoid warning on underfull boxes, which are
%  more common since the columns are very narrow.
%  This value may need to be adjusted...
%    \begin{macrocode}
  \hbadness 1500%   
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\pr@ingred}
%  This macro is called at the start of ingredients (that is, the 
% end of the method box).  It first ends the minipage--box which was started
% in the previous |\p@stingred|.
%    \begin{macrocode}
\DeclareRobustCommand{\pr@ingred}{%
  \endminipage\end{lrbox}%
%    \end{macrocode}
% Here we compare the width of the |\st@pmethodbox| with zero to determine
% whether anything was entered into it.
% (The idea for determining whether box is empty was from
% Donald Arseneau, |comp.text.tex|.)
%    \begin{macrocode}
  \ifdim\wd\st@pmethodbox=0in%
%    \PackageWarning{cuisine}{No text}%  % use for testing
  \else%
%    \PackageWarning{cuisine}{Method text}%
    \DisplaySt@p%
  \fi%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\p@stingred}
%  And this macro is called at the end of ingredients (the start of the method
%  box).
%
%  This is very odd.  Using |\begin{lrbox}|...|\end{lrbox}| isn't
%  supposed to work properly over an environment definition (and doesn't
%  seem to, either).  So we use |\lrbox|...|\endlrbox|.  But we want to nest
%  a |\minipage| inside this, which fails.  But it does work with 
%  |\begin{lrbox}\minipage|...|\endminipage\end{lrbox}|.
%
%  \centerline{WHY?!}
%
%  What happens, anyway, is that a new minipage--box is started.  Provided
%  the user doesn't put anything other than whitespace and comments between
%  this and the next |\pr@ingred| then the box will be empty.  This is how
%  |\p@stingred| knows whether to display the step or not when called by
%  |\ingr@dient|.
%    \begin{macrocode}
\DeclareRobustCommand{\p@stingred}{%
  \fr@eformingfalse%
  \begin{lrbox}{\st@pmethodbox}\minipage[t]{\R@cipeMethodWidth}%
  \recipemethodfont%
  \noindent%
  \ignorespaces%
  \r@cipesloppy%
}%
%    \end{macrocode}
%\end{macro}
%
%\subsection{Step terminating macros}
% These macros call |\pr@ingred| and |\p@stingred|, and 
% can (through |\pr@ingred|) cause the next step to be started.
%
%\begin{macro}{\m@thodend}
%  The |\m@thodend| command (which is |\newstep| in the environment) forces
%  a new step unless there is no method \textbf{and} no ingredient.
%    \begin{macrocode}
\DeclareRobustCommand{\m@thodend}{%
  \endminipage\end{lrbox}%
  \ifdim\wd\st@pmethodbox=0in%
    \ifnum\value{ingr@dnumber}>0%
%    \end{macrocode}
% In this case, the method box is empty so we put something in it to avoid
% problems with alignment.
%    \begin{macrocode}
      \savebox{\st@pmethodbox}[\R@cipeMethodWidth]{\mbox{}}%
      \DisplaySt@p%
    \fi%
  \else%  
    \DisplaySt@p%
  \fi%
  \p@stingred%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\r@cipen@wpage}
% |\r@cipen@wpage| is a macro which sets |\n@wpagingtrue|---so that the next
% step will appear on the next page---and then forces the next step.
%    \begin{macrocode}
\DeclareRobustCommand\r@cipen@wpage{\global\n@wpagingtrue\m@thodend}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\fr@eform}
%  |\fr@eform| is for freeform text,  like |\noalign| in tables.
% Again, as for |\m@thodend|, we want to force the new step unless there is 
% no method and no ingredient.
%    \begin{macrocode}
\DeclareRobustCommand{\fr@eform}{%
  \endminipage\end{lrbox}%
  \ifdim\wd\st@pmethodbox=0in%
    \ifnum\value{ingr@dnumber}>0%
      \savebox{\st@pmethodbox}[\R@cipeMethodWidth]{\mbox{}}%
       \DisplaySt@p%
    \fi%
  \else%  
    \DisplaySt@p%
  \fi% 
%    \end{macrocode}
% The rest is like |\p@stingred|:
%    \begin{macrocode}
  \fr@eformingtrue% 
  \begin{lrbox}{\st@pmethodbox}\minipage[t]{\R@cipeWidth}%
  \recipefreeformfont%
  \noindent%
  \ignorespaces%
  \r@cipesloppy%
}%
%    \end{macrocode}
% \end{macro}
%
%\begin{macro}{\ingr@dient}
%  The |\ingr@dient| command takes 3 parameters, one optional.  |#3| is the
%  ingredient.  If |#1| is non-blank then |#1| is the numerical quantity and 
% |#2| the unit of measure, otherwise |#2| is the quantity.  Start by ending the
% method box.
%    \begin{macrocode}
\DeclareRobustCommand{\ingr@dient}[3][]{%
  \pr@ingred%
%    \end{macrocode}
%
% The following is the main bit to typeset the ingredients list.
% (Thanks to Ulrike Fischer, |comp.text.tex|, for help with aligning box 
%  baselines.)
%
% This is a hack to see if |#1| is empty (Patrick Guio, |comp.text.tex|).
%    \begin{macrocode}
  \ifx\relax#1\relax%
%    \end{macrocode}
% If it is empty we typeset |#2| in the whole QandU width.  We align the top of
% the ingredient box with the bottom of the quantity box but have the
% baseline as the top line of the quantity box.  Use ragged right because the
% column is too narrow for flush right.
%    \begin{macrocode}
    \savebox{\st@pIQUbox}[\R@cipeIQUWidth][t]{%
      \parbox[t]{\R@cipeIQUWidth}{%
        \lineskip0pt\mbox{}\\[-\baselineskip]%
        \rule{\R@cipeOutdent}{0cm}%
        \parbox[b]{\R@cipeQandUWidth}{%
          \raggedright\recipeunitfont%
          \setlength{\parindent}{-\R@cipeOutdent}%
%    \end{macrocode}
% This sees whether the text is large enough to fit on one line, in which case
% it centres it; otherwise it formats it sensibly.
%
% Note: the |\hfill| matches another one elsewhere to centre the line.
%    \begin{macrocode}
          \savebox{\st@pingrtmpbox}{#2}%
          \ifdim\wd\st@pingrtmpbox>\R@cipeQandUWidth%
            \rule{0pt}{\baselineskip}%
            \strut #2\strut%
          \else%
            \noindent%
            \rule{0pt}{\baselineskip}%
            \strut #2\hfill\strut%
          \fi%
        }%
        \rule{\R@cipeIngUISpace}{0cm}%
        \rule{\R@cipeOutdent}{0cm}%
        \parbox[t]{\R@cipeIngredientWidth}{\raggedright%
          \recipeingredientfont%
          \setlength{\parindent}{-\R@cipeOutdent}%
          \strut #3\strut}%
      }%
    }%
  \else
%    \end{macrocode}
% If |#1| was not empty, typeset |#1| and |#2| separately.  First align the top of
% the ingredient box with the bottom of the unit box but have the
% baseline as the top line of the unit box; then repeat with that box below
% the quantity box.
%    \begin{macrocode}
    \savebox{\st@pingrtmpbox}[\R@cipeIandUWidth][t]{%
      \parbox[t]{\R@cipeIandUWidth}{%
        \lineskip0pt\mbox{}\\[-\baselineskip]%
        \rule{\R@cipeOutdent}{0cm}%
        \parbox[b]{\R@cipeUnitsWidth}{%
          \raggedright\recipeunitfont%
          \setlength{\parindent}{-\R@cipeOutdent}%
          \rule{0pt}{\baselineskip}%
          \strut #2\strut\hfill}%
        \rule{\R@cipeIngUISpace}{0cm}%
        \rule{\R@cipeOutdent}{0cm}%
        \parbox[t]{\R@cipeIngredientWidth}{%
          \raggedright\recipeingredientfont%
          \setlength{\parindent}{-\R@cipeOutdent}%
          \strut #3\strut}%
      }%
    }% 
    \savebox{\st@pIQUbox}[\R@cipeIQUWidth][t]{%
      \parbox[t]{\R@cipeIQUWidth}{%
        \lineskip0pt\mbox{}\\[-\baselineskip]%
        \parbox[b]{\R@cipeQuantityWidth}{\rule{0pt}{\baselineskip}%
          \hfill %
          \raggedright\recipequantityfont%
          \strut #1\strut%
          \rule{\R@cipeIngQUSpace}{0cm}}%
        \usebox{\st@pingrtmpbox}%
      }%
    }%
  \fi%
%    \end{macrocode}
% Use |\st@pingrtmpbox| as a temporary holding box.  The |\lineskip0pt|
% and the |\strut|s
% ensure that the ingredients' and the method text's baselines 
% are aligned correctly.
%    \begin{macrocode}
  \savebox{\st@pingrtmpbox}[\R@cipeIQUWidth][t]{\usebox{\st@pingrbox}}%
  \savebox{\st@pingrbox}[\R@cipeIQUWidth][t]{%
    \begin{minipage}[t]{\R@cipeIQUWidth}%
        \lineskip0pt%   
        \ifnum\value{ingr@dnumber}>0%
          \usebox{\st@pingrtmpbox}\par%
          \usebox{\st@pIQUbox}\strut%
        \else%
          \usebox{\st@pIQUbox}\strut%
        \fi%
    \end{minipage}%
  }%
%  \usebox{\st@pingrbox}    % For testing: show cumulative boxes.
  \stepcounter{ingr@dnumber}%
  \p@stingred%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\Ingr@dient}
%The |\Ingr@dient| command takes just one parameter.  It fits in the same 
%final box as |\ingr@dient| but is much simpler.  Start by ending the method
%box.
%    \begin{macrocode}
\DeclareRobustCommand{\Ingr@dient}[1]{%
  \pr@ingred%
%    \end{macrocode}
%
%We typeset |#1| in the single ingredient width, which is the IQU width minus
%the outdent. Use ragged right because the
%column is too narrow for flush right.
%    \begin{macrocode}
  \savebox{\st@pIQUbox}[\R@cipeSingleIngWidth][t]{%
    \parbox[t]{\R@cipeSingleIngWidth}{%
      \lineskip0pt\mbox{}\\[-\baselineskip]%
      \rule{\R@cipeOutdent}{0cm}%
      \parbox[t]{\R@cipeSingleIngWidth}{\raggedright%
        \recipeingredientfont%
        \setlength{\parindent}{-\R@cipeOutdent}%
        \strut #1\strut}%
    }%
  }%
%    \end{macrocode}
% Use |\st@pingrtmpbox| as a temporary holding box.  The |\lineskip0pt|
% and the |\strut|s
% ensure that the ingredients' and the method text's baselines 
% are aligned correctly.
%    \begin{macrocode}
  \savebox{\st@pingrtmpbox}[\R@cipeIQUWidth][t]{\usebox{\st@pingrbox}}%
  \savebox{\st@pingrbox}[\R@cipeIQUWidth][t]{%
    \begin{minipage}[t]{\R@cipeIQUWidth}%
        \lineskip0pt%   
        \ifnum\value{ingr@dnumber}>0%
          \usebox{\st@pingrtmpbox}\par%
          \usebox{\st@pIQUbox}\strut%
        \else%
          \usebox{\st@pIQUbox}\strut%
        \fi%
    \end{minipage}%
  }%
%  \usebox{\st@pingrbox}    % For testing: show cumulative boxes.
  \stepcounter{ingr@dnumber}%
  \p@stingred%
}%
%    \end{macrocode}
%\end{macro}
%
%^^A ------------------------------------------------
%\section{The recipe environment}
%\begin{environment}{recipe}
%This is the main environment in the package.  Its 3 parameters are |#2| is
%the recipe title, |#3| is the number of portions, and |#3| the preparation
%time.  Of course, |#3| and |#4| can be whatever you like but that is one way
%of using them.  |#1| is the label.
%    \begin{macrocode}
\newenvironment{recipe}[4][]{%
%    \end{macrocode}
% These are the things that are put at the start of the recipe environment.
% First, set things up.  Increment the recipe counter (which can be used in
% |\label|), make command aliases and empty the boxes.
% Note that |\label| is set through |#1|, {\bf not} |\label|.
%    \begin{macrocode}
  \refstepcounter{r@cipenumber}
  \ifx\relax#1\relax
  \else
    \label{#1}
  \fi
  \let\label\relax
  \let\newstep\m@thodend
  \let\recipen@wpage\newpage
  \let\newpage\r@cipen@wpage
  \let\0\d@grees
  \let\X\tim@s
  \let\degrees\d@grees
  \let\fr\fr@ction
  \let\ing\ingr@dient
  \let\ingredient\ingr@dient
  \let\Ing\Ingr@dient
  \let\Ingredient\Ingr@dient
  \let\freeform\fr@eform
  \n@wpagingfalse%
  \setlength{\parindent}{0pt}
  \savebox{\st@pingrbox}[\R@cipeIQUWidth]{}
  \savebox{\st@pmethodbox}[\R@cipeMethodWidth]{}
%    \end{macrocode}
% Make sure that the recipe is spaced appropriately from the preceding text
% and start a new page if necessary.  This is not part of |\r@cipetitle|
% because putting the break after |\addcontentsline| might yield the wrong
% page number.  The blank line below is intentional.
%    \begin{macrocode}

  \bigskip\medskip
  \pagebreak[0]
  \parskip0pt%
%    \end{macrocode}
% Next deal with the contents/index entry if we need to.  Again, the 
% |\nopagebreak| prevents the contents line occurring on the previous page.
%    \begin{macrocode}
  \ifc@ntentsing%
     \addcontentsline{toc}{subsection}{#2}%
  \fi%
  \ifind@xing%
     \index{#2 (\arabic{r@cipenumber})}%
  \fi%
  \nopagebreak%
%    \end{macrocode}
% Display the title and start the method box.
%    \begin{macrocode}
  \r@cipetitle{#2}{#3}{#4}
  \vskip0.2cm%
  \p@stingred%
}%
{% 
%    \end{macrocode}
% These are the things put at the end of recipes.  
% End the method box and deal with the last step.  Give a warning if the
% recipe is empty.
%  It is apparently not necessary to reset the earlier assignments and
%  |\parindent|.
%    \begin{macrocode}
  \pr@ingred%
  \ifnum\value{st@pnumber}=0%  then complain!
    \PackageWarning{cuisine}{The recipe did not have any steps}%
  \fi%
  
  \pagebreak[0]%  
  \medskip%
%    \end{macrocode}
% This prevents indentation problems after the end of the environment.
%    \begin{macrocode}
  \@endpetrue%
}%
%    \end{macrocode}
%\end{environment}
%
%
%^^A ------------------------------------------------
%\section{Miscellaneous useful macros}
%
% \begin{macro}{\d@grees}
%This is to typeset a degrees symbol.
%    \begin{macrocode}
\DeclareRobustCommand{\d@grees}{%
  ${}^\circ$%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\tim@s}
% This is to typeset a times symbol (like ${}\times\!$).
%    \begin{macrocode}
\DeclareRobustCommand{\tim@s}{%
  \relax${}\times{}$\relax%
}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\fr@ction}
% This is to typeset fractions, currently using package |nicefrac|.
%    \begin{macrocode}
%    \begin{macrocode}
\DeclareRobustCommand{\fr@ction}[2]{%
  \nicefrac#1#2%
}%
%    \end{macrocode}
%\end{macro}
%
%^^A ------------------------------------------------
%^^A That's it...
%
% \Finale
\endinput%
%^^A END OF FILE
%^^A ------------------------------------------------