Debian Codegraph @

texmf-dist/source/latex/cuisine/cuisine.dtx

raw
1 %\iffalse This is file `cuisine.dtx'
2 %%
3 %% Recipe typesetting package `cuisine' by Ben Cohen.
4 %% cuisine.dtx
5 %% Copyright 2000-2002, 2014 Ben Cohen
6 %
7 % This program may be distributed and/or modified under the
8 % conditions of the LaTeX Project Public License, either version 1.2
9 % of this license or (at your option) any later version.
10 % The latest version of this license is in
11 % http://www.latex-project.org/lppl.txt
12 % and version 1.2 or later is part of all distributions of LaTeX
13 % version 1999/12/01 or later.
14 %
15 % This program consists of the files cuisine.dtx and cuisine.ins
16 %
17 % $Id: cuisine.dtx,v 1.105 2014/06/26 20:12:05 ben Exp ben $
18 % ------------------------------------------------
19 %
20 %<*driver>
21 \documentclass{ltxdoc}
22 \usepackage[nonumber]{cuisine}
23 \GetFileInfo{cuisine.sty} % defines \filename, \filedate, \fileversion,
24 % \fileinfo from cuisine.sty
25 \begin{document}
26 \def\myemailaddress{\texttt{ben\[email protected]}}
27 \title{The \texttt{cuisine} package}
28 \author{Ben Cohen}
29 \date{\filedate, \fileversion}
30 \maketitle
31 \DocInput{cuisine.dtx}
32 \end{document}
33 %</driver>
34 %\fi
35 %
36 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 %
38 % \CheckSum{739}
39 %
40 % \begin{abstract}
41 % This package provides an environment for typesetting recipes in steps
42 % in which each ingredient is on the left of the page next to the
43 % method step where it is used.
44 % \end{abstract}
45 %
46 % \MakeShortVerb{\|}
47 % \section{Introduction}
48 % There appear to be two styles of typesetting recipes in general use. The
49 % more common (at least in recipe books in the U.K.)
50 % is where the ingredients appear at the top above the method,
51 % as in the class |macros/latex/contrib/other/recipe|. Another
52 % way is to have each ingredient next to the method step in which it appears,
53 % as in the package |macros/latex/contrib/supported/cooking|;
54 % the |cuisine| package also uses this style, but closer to the format in
55 % \textit{Practical Professional Cookery} by H.~L.\ Cracknell and R.~J.\
56 % Kaufmann.
57 %
58 % \section{Usage}
59 % The package is loaded using the header |\usepackage{cuisine}|; the
60 % available options are:
61 % \begin{itemize}
62 % \item{|number|}\ \ Recipes will be numbered sequentially to the left of the
63 % recipe title. (This is the
64 % default.) The recipe \emph{steps} will always be numbered.
65 % \item{|nonumber|}\ \ Recipes will not be numbered.
66 % \item{|index|}\ \ Recipe titles will be written to the index for the
67 % document.
68 % \item{|noindex|}\ \ Recipe titles will not be written to the document
69 % index.
70 % (This is the default.)
71 % \item{|contents|}\ \ Recipe titles will be written to the contents for the
72 % document.
73 % \item{|nocontents|}\ \ Recipe titles will not be written to the document
74 % contents.
75 % (This is the default.)
76 % \end{itemize}
77 % You will need the package |nicefrac|;
78 % it comes
79 % with current versions of te\TeX\ and is also
80 % available from CTAN as part of the package |units| in
81 % |macros/latex/|\hskip0cm|contrib/supported/|\hskip0cm|units|.
82 %
83 %
84 % \medskip
85 % \DescribeEnv{recipe}
86 % Each recipe is set out in a |recipe| environment. The three
87 % parameters are the title, and two recipe description fields---it is assumed
88 % that they are used for the number of servings and the preparation time, for
89 % example:
90 % \begin{quote}
91 % |\begin{recipe}{|\textit{Title}|}|%
92 % |{|\textit{Number of servings}|}|%
93 % |{|\textit{Preparation time}|}|
94 % \\$\vdots$\\|\end{recipe}|
95 % \end{quote}
96 % There is no reason why the descriptive fields cannot be used for other
97 % things (such as the number of calories).
98 %
99 % \medskip
100 % \DescribeMacro{\ingredient}
101 % \DescribeMacro{\ing}
102 % Within the environment, you type in method details directly, and you
103 % type the ingredients using |\ingredient| or the shorter version |\ing|
104 % \textit{before} the method step beside which you want the ingredient to
105 % appear. A new method step is started whenever there is method text before
106 % an |\ingredient|. Two consecutive |\ingredient|
107 % declarations will appear next to the same method step.
108 %
109 % The |\ingredient| command is used as follows:
110 % \begin{quote}
111 % |\ingredient{|\textit{Quantity}|}|%
112 % |{|\textit{Ingredient}|}|
113 % \end{quote}
114 % There is an optional first parameter which allows you to separate the
115 % numerical quantity from the name of the unit of measurement:
116 % \begin{quote}
117 % |\ingredient[|\textit{Numerical quantity}|]|%
118 % |{|\textit{Unit of measurement}|}|%
119 % |{|\textit{Ingredient}|}|
120 % \end{quote}
121 % Examples include:
122 % \begin{quote}
123 % |\ingredient{a pinch}{salt}|\\
124 % |\ingredient[4]{oz}{sugar}|
125 % \end{quote}
126 %
127 % \medskip
128 % \DescribeMacro{\Ingredient}
129 % \DescribeMacro{\Ing}
130 % There is an alternative way to specify ingredients using a single
131 % description for both the quantity and the ingredient, as follows:
132 % \begin{quote}
133 % |\Ingredient{|\textit{Ingredient and quantity}|}|
134 % \end{quote}
135 % This can be used where describing awkward descriptions of units. It would
136 % also be preferable if you simply don't like the appearance of separating
137 % units from ingredients as required by |\ingredient|. (My taste has
138 % apparently changed over the last decade and a half!) For example:
139 % \begin{quote}
140 % |\Ingredient{zest and juice of 2 lemons}|\\
141 % |\Ingredient{Worcestershire sauce, to taste}|\\
142 % \end{quote}
143 %
144 %
145 % \medskip
146 % \DescribeMacro{\fr}
147 % Within the recipe you can use |\fr| to typeset fractions using
148 % |\fr12| to get \nicefrac12, or |\fr{11}{12}| to typeset \nicefrac{11}{12}.
149 % If the numerator or denominator of the fraction is more than one digit long
150 % then you will need to enclose it in braces (otherwise they are optional).
151 %
152 % \DescribeMacro{\degrees}
153 % \DescribeMacro{\0}
154 % \DescribeMacro{\X}
155 % \DescribeMacro{\%}
156 % A degree symbol can be obtained using |\degrees| or the shorter form |\0|;
157 % for example |120\0| gives 120${}^\circ$.
158 % A times symbol, ${}\times{}$, can be obtained using |\X|.
159 % As is usual with \LaTeX, to obtain a percent sign, \%, you must use |\%|
160 % since |%| on its own starts a comment.
161 %
162 %
163 % \section{More advanced usage}
164 % The |cuisine| package has been designed so that it is easy to vary the
165 % widths of the columns. \LaTeX\ has very wide margins by default
166 % so the text width is very narrow which may be unsuitable for
167 % typesetting recipes using this package. (It might be worth looking at the
168 % KOMA-Script classes in
169 % |macros/latex/|\hskip0pt|contrib/supported/|\hskip0pt|koma-script/| as an
170 % alternative to the standard \LaTeX\ classes.)
171 %
172 % \DescribeMacro{\RecipeWidths}
173 % The |\RecipeWidths| command is designed to be used in conjunction with the
174 % \LaTeX\ commands for changing the page layout. It is used as follows:
175 % \begin{quote}
176 % |\RecipeWidths{|\textit{Total recipe width}|}|%
177 % |{|\textit{Number of servings width}|}|%
178 % |{|\textit{Step number width}|}|%
179 % |{|\textit{Ingredient width}|}|%
180 % |{|\textit{Quantity width}|}|%
181 % |{|\textit{Units width}|}|
182 % \end{quote}
183 %
184 % \medskip
185 % \DescribeMacro{\ResetRecipeCounter}
186 % The |\ResetRecipeCounter| command will reset the recipe counter so that
187 % subsequent recipes are numbered from 1.
188 %
189 % \medskip
190 % \DescribeMacro{\newstep}
191 % Within the recipe environment, to force a new step if you do not want
192 % to declare any ingredients, use the
193 % |\newstep| command. (A |\newstep| command with no preceding ingredient or
194 % method text will be ignored to prevent completely empty steps from
195 % appearing.)
196 %
197 % \DescribeMacro{\newpage}
198 % |\newpage| ends the current step (as for |\newstep|) but also tells the
199 % environment that the next step will appear on
200 % the next page.
201 % It is not normally necessary to use this command since page breaking after
202 % each method step will be done automatically by \LaTeX\ as necessary.
203 % Page breaks can only
204 % occur between method steps; method steps will not be split across pages.
205 % (Consequently, it may be advisable to keep method steps fairly short.)
206 %
207 % \medskip
208 % \DescribeMacro{\freeform}
209 % To typeset text across the whole width of the recipe instead of just the
210 % width of the method, use the |\freeform| command. This is equivalent to
211 % |\noalign| in tables. Freeform text is not given a step number.
212 %
213 % \medskip
214 % The recipe environment has an optional first parameter with which you can
215 % assign a label to a recipe.
216 % \begin{quote}
217 % |\begin{recipe}[|\textit{Label}|]{|\textit{Title}|}|%
218 % |{|\textit{Servings}|}|%
219 % |{|\textit{Preparation time}|}|
220 % \\$\vdots$\\|\end{recipe}|
221 % \end{quote}
222 % |\pageref| and |\ref| then refer to the recipe page number
223 % and recipe number respectively of the recipe with that label. For example,
224 % the label in the recipe below will make |\ref{Zabaglione}| give recipe
225 % number \ref{Zabaglione}. (Note that you cannot use |\label| for this
226 % purpose within the environment because it breaks the formatting.)
227 %
228 % \section{Fonts}
229 % The fonts used in the different parts of a recipe can be altered by
230 % changing the definition of the following macros; this should be done
231 % using, for example, \verb|\renewcommand*{\recipetitlefont}{\sffamily}|.
232 %
233 % \begin{tabular}{ll}
234 % \verb|\recipefont|&The default font used for the fonts below\\
235 % \verb|\recipetitlefont|&The font for the recipe title\\
236 % \verb|\recipeservingsfont|&The font for the number of servings\\
237 % \verb|\recipetimefont|&The font for the preparation time\\
238 % \verb|\recipenumberfont|&The font for the recipe number\\
239 % \verb|\recipestepnumberfont|&The font for each step number\\
240 % \verb|\recipequantityfont|&The font for the numerical quantity\\
241 % \verb|\recipeunitfont|&The font for the unit of measurement\\
242 % & (or descriptive quantity)\\
243 % \verb|\recipeingredientfont|&The font for the ingredient\\
244 % \verb|\recipemethodfont|&The font for the method details\\
245 % \verb|\recipefreeformfont|&The font for freeform descriptions\\
246 % \end{tabular}
247 %
248 % \section{Examples}
249 % \subsection{A simple example}
250 % There is only whitespace between the first three
251 % ingredients, so they are used for the first step with
252 % the method text which follows. (Had
253 % there been text before the first ingredient, that text would become the first
254 % step and the heating instruction would be the second step.) The fourth
255 % |\ingredient| signals the end of the method text and starts a new step. The
256 % final |\end{recipe}| finishes that step.
257 % \medskip
258 %
259 % \begin{small}\noindent
260 % |\begin{recipe}{Yorkshire Pudding}{4 portions}{1\fr12 hours}|\\
261 % |\ingredient[\fr12]{pt}{milk}|\\
262 % |\ingredient[2]{oz}{butter}|\\
263 % |\ingredient[5]{oz}{self-raising flour}|\\
264 % |Heat the milk and butter until nearly boiling. Add flour and allow to|\\
265 % |seeth over.|\\
266 % |\ingredient[3]{}{eggs}|\\
267 % |\ingredient{to taste}{salt and pepper}|\\
268 % |Add the remaining eggs and whisk again. Cook at 220\0C for about 1 hour.|\\
269 % |\end{recipe}|
270 % \end{small}
271 % \medskip
272 %
273 % \begin{recipe}{Yorkshire Pudding}{4 portions}{1\fr12 hours}
274 % \ingredient[\fr12]{pt}{milk}
275 % \ingredient[2]{oz}{butter}
276 % \ingredient[5]{oz}{self-raising flour}
277 % Heat the milk and butter until nearly boiling. Add flour and
278 % allow to seeth over.
279 % \ingredient[3]{}{eggs}
280 % \ingredient{to taste}{salt and pepper}
281 % Add the remaining eggs and whisk again. Cook at 220\0C
282 % for about 1 hour.
283 % \end{recipe}
284 %
285 % \bigskip
286 % The recipe below is the same but using the single-argument |\Ingredient|
287 % command. As you can see, the alignment is different from that of
288 % |\ingredient| and mixing them probably won't produce a pleasing output.
289 % If you are using only |\Ingredient| then the ingredients column can probably
290 % be made narrower (remember that this is still the sum of the quantity, unit
291 % and ingredient widths).
292 % \begin{recipe}{Yorkshire Pudding}{4 portions}{1\fr12 hours}
293 % \Ingredient{\fr12 pt milk}
294 % \Ingredient{2 oz butter}
295 % \Ingredient{5 oz self-raising flour}
296 % Heat the milk and butter until nearly boiling. Add flour and
297 % allow to seeth over.
298 % \Ingredient{3 eggs}
299 % \Ingredient{salt and pepper, to taste}
300 % Add the remaining eggs and whisk again. Cook at 220\0C
301 % for about 1 hour.
302 % \end{recipe}
303 %
304 % \bigskip
305 %
306 % \subsection{A more complex example}
307 % We can change the widths of the columns using, for example,
308 % \begin{quote}
309 % |\RecipeWidths{.75\textwidth}{3cm}{0.5cm}{1.75cm}{.75cm}{.75cm}|
310 % \end{quote}
311 % \noindent and the |small| environment to produce a different layout.
312 % We can also change the fonts, for example:
313 % \begin{quote}
314 % |\renewcommand*{\recipetitlefont}{\large\bfseries\sffamily}|\\
315 % |\renewcommand*{\recipenumberfont}{\large\bfseries\sffamily}|\\
316 % |\renewcommand*{\recipequantityfont}{\sffamily\bfseries}|\\
317 % |\renewcommand*{\recipeunitfont}{\sffamily}|\\
318 % |\renewcommand*{\recipeingredientfont}{\sffamily}|\\
319 % |\renewcommand*{\recipefreeformfont}{\itshape}|
320 % \end{quote}
321 %
322 % The example below demostrates the |\newstep| and |\newpage| commands, and
323 % also how to use |\freeform| to create freeform text. |\freeform| can also
324 % be used to create rules in the same way as when using |\noalign| in tables.
325 % In this case, recipe numbering has been turned on, and the |small|
326 % environment is being used. Note the label declaration
327 % ``Zabaglione''.
328 %
329 % \medskip
330 % \begin{small}\noindent
331 % |\begin{recipe}[Zabaglione]{Zabaglione alla Marsala}{4 Portions}{\fr12 hour}|\\
332 % |\freeform This is a well-known Italian recipe which is |\\
333 % |great for piling on the calories.|\\
334 % |\ingredient[6]{}{egg yolks}|\\
335 % |\ingredient[2]{oz}{granulated sugar}|\\
336 % |\ingredient[6--8]{tbsp}{Marsala (or sherry)}|\\
337 % |\ingredient[\fr14]{oz}{gelatine}|\\
338 % |\ingredient[2]{tbsp}{cold water}|\\
339 % |In the top of a double boiler, combine the egg yolks with sugar and|\\
340 % |Marsala, and whip the mixture over hot, but not boiling, water until it|\\
341 % |thickens. Stir in gelatine, softened in cold water and dissolved over hot|\\
342 % |water.|\\
343 % |\ingredient[3]{tbsp}{brandy}|\\
344 % |\ingredient[\fr38]{pt}{double cream}|\\
345 % |Put the pan in a bowl of ice and stir the |\\
346 % |zabaglione well until it is thick and free of bubbles. When it is almost |\\
347 % |cold, fold in brandy and whipped cream and pour into individual moulds.|\\
348 % |\freeform\rule{\textwidth}{0.05pt}\newpage|\\
349 % |\freeform\rule{\textwidth}{0.05pt}|\\
350 % |\ingredient[3]{}{egg yolks}|\\
351 % |\ingredient[1]{oz}{granulated sugar}|\\
352 % |\ingredient[3--4]{tbsp}{Marsala (or sherry)}|\\
353 % |\ingredient[1\fr12]{tbsp}{brandy}|\\
354 % |To make the sauce, combine egg yolks and sugar in the top of a double |\\
355 % |saucepan. Whisk mixture over hot, but not boiling, water until the|\\
356 % |sauce coats |\\
357 % |the back of a spoon. Stir in the Marsala and brandy.|\\
358 % |\newstep|\\
359 % |Chill the zabaglione, unmould it, and serve with the sauce immediately.|\\
360 % |\freeform\hrulefill|\\
361 % |\end{recipe}|
362 % \medskip
363 % \begin{center}
364 % \renewcommand*{\recipetitlefont}{\large\bfseries\sffamily}
365 % \renewcommand*{\recipenumberfont}{\large\bfseries\sffamily}
366 % \renewcommand*{\recipequantityfont}{\sffamily\bfseries}
367 % \renewcommand*{\recipeunitfont}{\sffamily}
368 % \renewcommand*{\recipeingredientfont}{\sffamily}
369 % \renewcommand*{\recipefreeformfont}{\itshape}
370 % \RecipeWidths{.75\textwidth}{3cm}{0.5cm}{1.75cm}{.75cm}{.75cm}
371 % \makeatletter\numb@ringtrue\makeatother ^^A Cheap trick
372 % \ResetRecipeCounter
373 %
374 % \begin{recipe}[Zabaglione]{Zabaglione alla Marsala}{4 Portions}{\fr12 hour}
375 % \freeform This is a well-known Italian recipe which is
376 % great for piling on the calories.
377 % \ingredient[6]{}{egg yolks}
378 % \ingredient[2]{oz}{granulated sugar}
379 % \ingredient[6--8]{tbsp}{Marsala (or sherry)}
380 % \ingredient[\fr14]{oz}{gelatine}
381 % \ingredient[2]{tbsp}{cold water}
382 % In the top of a double boiler, combine the egg yolks
383 % with sugar and Marsala, and whip the mixture over hot, but not
384 % boiling, water until it thickens. Stir in gelatine, softened in cold water
385 % and dissolved over hot water.
386 % \ingredient[3]{tbsp}{brandy}
387 % \ingredient[\fr38]{pt}{double cream}
388 % Put the pan in a bowl of ice and stir the
389 % zabaglione well until it is thick and free of bubbles. When it is almost
390 % cold, fold in brandy and whipped cream and pour into individual moulds.
391 % \freeform\rule{\textwidth}{0.05pt}\newpage
392 % \freeform\rule{\textwidth}{0.05pt}
393 % \ingredient[3]{}{egg yolks}
394 % \ingredient[1]{oz}{granulated sugar}
395 % \ingredient[3--4]{tbsp}{Marsala (or sherry)}
396 % \ingredient[1\fr12]{tbsp}{brandy}
397 % To make the sauce, combine egg yolks and sugar in the top of a double
398 % saucepan. Whisk mixture over hot, but not boiling, water until the
399 % sauce coats
400 % the back of a spoon. Stir in the Marsala and brandy.
401 % \newstep
402 % Chill the zabaglione, unmould it, and serve with the sauce immediately.
403 % \freeform\hrulefill
404 % \end{recipe}
405 % \end{center}\end{small}
406 %
407 % \section{Bugs, Issues, Features, \dots}
408 % \begin{itemize}
409 % \item{Method steps can't be split across pages. This means you can get
410 % lots of empty white space at the bottom of pages, especially if you have
411 % long methods.}
412 % \item{There may be alignment problems if the recipe fonts differ much in
413 % height.}
414 % \item{Formatting doesn't work very well when the ingredient quantity is
415 % too wide for its box.}
416 % \item{There is no support for dual sets of quantities, for example where two
417 % systems of measurement are used or for different numbers of servings.
418 % You can write \verb|\ingredient{<4 oz>/<100 g>}{butter}|, or use
419 % |\Ingredient| but I don't think implementing commands such as
420 % \verb|\ingredient[1]{oz}[25]{g}{butter}| would be worthwhile.}
421 % \end{itemize}
422 % Please e-mail me at \myemailaddress\ if you can help find or solve any
423 % problems with this package.
424 %
425 % \section{Change History}
426 % \begin{small}
427 % \begin{itemize}
428 % \item[\sl v0.5]Written---release on CTAN.
429 % \item[\sl v0.6]Fixed a couple of vertical alignment problems.
430 % Labelling of recipes for |\ref|. |\X| (times) macro.
431 % Added different index and contents options, and corrected a
432 % bug that sometimes gave the wrong page number.
433 % If |recipe|'s |#4| is empty, don't leave a blank line.
434 % The step number width can be changed but the recipe number
435 % width varies.
436 % \item[\sl v0.7]Added the |\Ingredient| command for single-argument
437 % ingredients.
438 % \end{itemize}
439 % \end{small}
440 %
441 % \StopEventually{}
442 % \newpage
443 % \setlength{\parindent}{0cm}
444 %
445 % \section{Identification section and initialisation}
446 % The package declaration follows the standard form.
447 % \begin{macrocode}
448 \NeedsTeXFormat{LaTeX2e}
449 \ProvidesPackage{cuisine}[2014/06/26 v0.7 recipe typesetting]
450 % \end{macrocode}
451 %
452 % We use the |nicefrac| package for ``nice'' fractions.
453 % \begin{macrocode}
454 \RequirePackage{nicefrac}
455 % \end{macrocode}
456 %
457 %^^A ------------------------------------------------
458 % \section{Counters, booleans and lengths}
459 %
460 % |r@cipenumber| is the recipe number counter.
461 % This could be made dependent on, say, the section number.
462 % \begin{macrocode}
463 \newcounter{r@cipenumber}
464 % \end{macrocode}
465 %
466 % \begin{macro}{\ResetRecipeCounter}
467 % The |\ResetRecipeCounter| macro resets the recipe number counter to 0.
468 % \begin{macrocode}
469 \DeclareRobustCommand{\ResetRecipeCounter}{%
470 \setcounter{r@cipenumber}{0}%
471 }
472 % \end{macrocode}
473 % \end{macro}
474 %
475 % |st@pnumber| is the step counter within recipes.
476 % It is zeroed whenever the recipe counter is incremented.
477 % \begin{macrocode}
478 \newcounter{st@pnumber}[r@cipenumber]
479 % \end{macrocode}
480 %
481 % |ingr@dnumber| is the ingredient counter within recipes and steps.
482 % It is zeroed whenever the step counter is incremented.
483 % \begin{macrocode}
484 \newcounter{ingr@dnumber}[st@pnumber]
485 % \end{macrocode}
486 %
487 %\medskip
488 % |ifnumb@ring| determines whether or not recipe numbers are printed.
489 % (Step numbers will always be printed.)
490 % \begin{macrocode}
491 \newif\ifnumb@ring
492 % \end{macrocode}
493 %
494 % |ifc@ntentsing| determines whether we are
495 % writing the recipes to an contents file or not.
496 % \begin{macrocode}
497 \newif\ifc@ntentsing
498 % \end{macrocode}
499 %
500 % |ifind@xing| determines whether we are
501 % writing the recipes to an index file or not.
502 % \begin{macrocode}
503 \newif\ifind@xing
504 % \end{macrocode}
505 %
506 % |iffr@eforming| determines whether or not we are in freeform mode.
507 % \begin{macrocode}
508 \newif\iffr@eforming
509 % \end{macrocode}
510 %
511 % |ifn@wpaging| determines whether or not the next step will be on a new
512 % page.
513 % \begin{macrocode}
514 \newif\ifn@wpaging
515 % \end{macrocode}
516 %
517 % |\R@cipeWidth| is the total width of the recipe.
518 % \begin{macrocode}
519 \newlength{\R@cipeWidth}
520 % \end{macrocode}
521 %
522 % The following are, respectively, the widths of the recipe number box, the
523 % recipe title box, the recipe number-of-servings box, and the total of the
524 % recipe title and number-of-servings boxes.
525 % \begin{macrocode}
526 \newlength{\R@cipeNumberWidth}
527 \newlength{\R@cipeTitleWidth}
528 \newlength{\R@cipeServingsWidth}
529 \newlength{\R@cipeTandSWidth}
530 % \end{macrocode}
531 %
532 % This is the distance ingredient (etc.) paragraphs are outdented.
533 % \begin{macrocode}
534 \newlength{\R@cipeOutdent}
535 % \end{macrocode}
536 %
537 % These are the horizontal spaces between the quantity and units, and between
538 % the unit and the ingredient.
539 % \begin{macrocode}
540 \newlength{\R@cipeIngQUSpace}
541 \newlength{\R@cipeIngUISpace}
542 % \end{macrocode}
543 %
544 % These are the vertical distances for the recipe title-to-rule adjustments
545 % (usually negative).
546 % \begin{macrocode}
547 \newlength{\R@cipeTitleVerticalAdjustTop}
548 \newlength{\R@cipeTitleVerticalAdjustBot}
549 % \end{macrocode}
550 %
551 % These are the widths of the ingredient descriptors and combinations of
552 % them.
553 % \begin{macrocode}
554 \newlength{\R@cipeIngredientWidth}
555 \newlength{\R@cipeQuantityWidth}
556 \newlength{\R@cipeUnitsWidth}
557 \newlength{\R@cipeQandUWidth}
558 \newlength{\R@cipeIandUWidth}
559 \newlength{\R@cipeIQUWidth}
560 \newlength{\R@cipeSingleIngWidth}
561 % \end{macrocode}
562 %
563 % |\R@cipeMethodWidth| is the width of the method text.
564 % \begin{macrocode}
565 \newlength{\R@cipeMethodWidth}
566 % \end{macrocode}
567 %
568 % |\St@pNumberWidth| is the width of the step number and |\R@cipeStepWidth| is
569 % the width of everything within a step.
570 % \begin{macrocode}
571 \newlength{\St@pNumberWidth}
572 \newlength{\R@cipeStepWidth}
573 % \end{macrocode}
574 %
575 %\medskip
576 % The following macros are to set the lengths defined above.
577 %
578 % \begin{macro}{\R@cipeMethodWidths}
579 % |\R@cipeMethodWidths| is to set the widths of the boxes/columns used in the
580 % recipe steps.
581 % There are four parameters: |#1| is the step number width, |#2| is the
582 % ingredient width, |#3| the quantity width, |#4| the units width.
583 % The other lengths below are deduced from these and |\R@cipeMethodWidth|.
584 % The |0.5cm| values are to leave a little space between the columns.
585 % \begin{macrocode}
586 \DeclareRobustCommand*{\R@cipeMethodWidths}[4]{%
587 \setlength{\St@pNumberWidth}{#1}%
588 \setlength{\R@cipeIngredientWidth}{#2}%
589 \setlength{\R@cipeQuantityWidth}{#3}%
590 \setlength{\R@cipeUnitsWidth}{#4}%
591 \setlength{\R@cipeQandUWidth}{\R@cipeQuantityWidth}%
592 \addtolength{\R@cipeQandUWidth}{\R@cipeUnitsWidth}%
593 \setlength{\R@cipeIQUWidth}{\R@cipeQandUWidth}%
594 \addtolength{\R@cipeIQUWidth}{\R@cipeIngredientWidth}%
595 \addtolength{\R@cipeIQUWidth}{0.5cm}%
596 \setlength{\R@cipeIandUWidth}{\R@cipeIQUWidth}%
597 \addtolength{\R@cipeIandUWidth}{-\R@cipeQuantityWidth}%
598 \setlength{\R@cipeStepWidth}{\R@cipeWidth}%
599 \addtolength{\R@cipeStepWidth}{-\St@pNumberWidth}%
600 \setlength{\R@cipeMethodWidth}{\R@cipeStepWidth}%
601 \addtolength{\R@cipeMethodWidth}{-\R@cipeIngredientWidth}%
602 \addtolength{\R@cipeMethodWidth}{-\R@cipeQandUWidth}%
603 \addtolength{\R@cipeMethodWidth}{-0.5cm}%
604 \setlength{\R@cipeSingleIngWidth}{\R@cipeIQUWidth}%
605 % \end{macrocode}
606 % Allow for the ingredient paragraph outdenting.
607 % \begin{macrocode}
608 \addtolength{\R@cipeIngredientWidth}{-\R@cipeOutdent}
609 \addtolength{\R@cipeUnitsWidth}{-\R@cipeOutdent}
610 \addtolength{\R@cipeQandUWidth}{-\R@cipeOutdent}
611 \addtolength{\R@cipeSingleIngWidth}{-\R@cipeOutdent}
612 \addtolength{\R@cipeSingleIngWidth}{-\R@cipeIngQUSpace}
613 \addtolength{\R@cipeSingleIngWidth}{-\R@cipeIngUISpace}
614 }%
615 % \end{macrocode}
616 % \end{macro}
617 %
618 % \begin{macro}{\R@cipeTitleWidths}
619 % |\R@cipeTitleWidths| is to set the widths of the boxes/columns used in
620 % the recipe title.
621 % There are two parameters: |#1| is the number of servings width.
622 % The title width is deduced from that.
623 % \begin{macrocode}
624 \DeclareRobustCommand*{\R@cipeTitleWidths}[1]{%
625 \setlength{\R@cipeServingsWidth}{#1}%
626 \setlength{\R@cipeTitleWidth}{\R@cipeWidth}%
627 \addtolength{\R@cipeTitleWidth}{-\R@cipeServingsWidth}%
628 \setlength{\R@cipeTandSWidth}{\R@cipeServingsWidth}%
629 \addtolength{\R@cipeTandSWidth}{\R@cipeTitleWidth}%
630 }
631 % \end{macrocode}
632 % \end{macro}
633 %
634 % \begin{macro}{\RecipeWidths}
635 % |\RecipeWidths| combines the above macros in a useable form. There are six
636 % parameters:
637 % |#1| is the recipe width, |#2| the number of servings width, |#3| the step
638 % number width, |#4| the ingredient width, |#5| the quantity width, |#6| the
639 % units width.
640 % \begin{macrocode}
641 \DeclareRobustCommand*{\RecipeWidths}[6]{%
642 \setlength{\R@cipeWidth}{#1}%
643 \R@cipeTitleWidths{#2}%
644 \R@cipeMethodWidths{#3}{#4}{#5}{#6}%
645 }%
646 % \end{macrocode}
647 % \end{macro}
648 %
649 %\medskip
650 % Now we set up the default values.
651 % These appear to be reasonable for the LaTeX default page layout
652 % (A4, portrait, one column, etc.)
653 % I don't think the LaTeX default width is good for a recipe book though!
654 % \begin{macrocode}
655 \setlength{\R@cipeOutdent}{0.3cm}%
656 \setlength{\R@cipeIngQUSpace}{0.1cm}%
657 \setlength{\R@cipeIngUISpace}{0.2cm}%
658 \setlength{\R@cipeTitleVerticalAdjustTop}{-0.25cm}
659 \setlength{\R@cipeTitleVerticalAdjustBot}{-0.25cm}
660 \RecipeWidths{\textwidth}{3cm}{0.8cm}{3.5cm}{1cm}{1.7cm}
661 % \end{macrocode}
662 %
663 %^^A ------------------------------------------------
664 %
665 % \section{Fonts}
666 % This is where the default fonts are set up.
667 % \verb|\recipefont| is the default font for the other recipe fonts; thus
668 % the other fonts inherit from this but can be altered individually.
669 % \begin{macrocode}
670 \newcommand*\recipefont{\normalfont}
671 \newcommand*\recipetitlefont{\recipefont}
672 \newcommand*\recipenumberfont{\recipefont}
673 \newcommand*\recipestepnumberfont{\recipefont}
674 \newcommand*\recipequantityfont{\recipefont}
675 \newcommand*\recipeunitfont{\recipefont}
676 \newcommand*\recipeingredientfont{\recipefont}
677 \newcommand*\recipemethodfont{\recipefont}
678 \newcommand*\recipeservingsfont{\recipefont}
679 \newcommand*\recipetimefont{\recipefont}
680 \newcommand*\recipefreeformfont{\recipefont}
681 % \end{macrocode}
682 %
683 %
684 %^^A ------------------------------------------------
685 % \section{Boxes}
686 % |\st@pingrbox| is to hold the ingredients cumulatively as each |\ingredient|
687 % command is processed; |\st@pingrtmpbox| and |\titl@tmpbox| are used as
688 % temporary transfer boxes.
689 % \begin{macrocode}
690 \newsavebox{\st@pingrbox}
691 \newsavebox{\st@pingrtmpbox}
692 \newsavebox{\titl@tmpbox}
693 % \end{macrocode}
694 % This is used to hold a single ingredient as it is being processed:
695 % \begin{macrocode}
696 \newsavebox{\st@pIQUbox}
697 % \end{macrocode}
698 % This is to hold the method (or freeform) text for the step:
699 % \begin{macrocode}
700 \newsavebox{\st@pmethodbox}
701 % \end{macrocode}
702 %
703 % ^^A------------------------------------------------
704 % \section{Options}
705 %
706 % |nonumber| --- Should recipes be numbered? (The default is yes.)
707 % \begin{macrocode}
708 \DeclareOption{number}{\numb@ringtrue}
709 \DeclareOption{nonumber}{\numb@ringfalse}
710 % \end{macrocode}
711 %
712 % |contents| --- Should recipes be indexed to a file? (The default is no.)
713 % \begin{macrocode}
714 \DeclareOption{contents}{\c@ntentsingtrue}
715 \DeclareOption{nocontents}{\c@ntentsingfalse}
716 % \end{macrocode}
717 %
718 % |index| --- Should recipes be indexed to a file? (The default is no.)
719 % \begin{macrocode}
720 \DeclareOption{index}{\ind@xingtrue}
721 \DeclareOption{noindex}{\ind@xingfalse}
722 % \end{macrocode}
723 %
724 % Process the options, using the defaults if necessary.
725 % \begin{macrocode}
726 \ExecuteOptions{number,noindex,nocontents}
727 \ProcessOptions\relax
728 % \end{macrocode}
729 %
730 %^^A ------------------------------------------------
731 % \section{The main macros}
732 % \subsection{Macros for displaying the steps and title}
733 %
734 %\begin{macro}{\Displ@ySt@p}
735 % |\Displ@ySt@p| displays the ingredients and method for the current step
736 % and resets things ready for the next step.
737 % \begin{macrocode}
738 \DeclareRobustCommand{\Displ@ySt@p}{%
739 % \end{macrocode}
740 % First, increment the step counter and put extra vertical space between steps.
741 % (But it isn't uniform yet, unfortunately.)
742 % \begin{macrocode}
743 \stepcounter{st@pnumber}%
744 % \end{macrocode}
745 % Display this step.
746 % \begin{macrocode}
747 \makebox[\R@cipeWidth]{%
748 \makebox[\St@pNumberWidth][l]{\recipestepnumberfont\arabic{st@pnumber}}%
749 \usebox{\st@pingrbox}%
750 \usebox{\st@pmethodbox}%
751 }%
752 % \end{macrocode}
753 % Finally, clear the step storage boxes for the next step.
754 % \begin{macrocode}
755 \savebox{\st@pingrbox}[\R@cipeIQUWidth]{}
756 }%
757 % \end{macrocode}
758 %\end{macro}
759 %
760 %\begin{macro}{\Fr@eFormStep}
761 % |\Fr@eFormStep| displays a free form description; it works in the same way
762 % as |\Displ@ySt@p|.
763 % \begin{macrocode}
764 \DeclareRobustCommand{\Fr@eFormStep}{%
765 \usebox{\st@pmethodbox}%
766 \savebox{\st@pmethodbox}[\R@cipeMethodWidth]{}%
767 }%
768 % \end{macrocode}
769 %\end{macro}
770 %
771 %\begin{macro}{\DisplaySt@p}
772 % This calls one of the two display routines above,
773 % depending on whether we are freeforming
774 % or not.
775 % \begin{macrocode}
776 \DeclareRobustCommand{\DisplaySt@p}{%
777 \iffr@eforming%
778 \Fr@eFormStep%
779 \else%
780 \Displ@ySt@p%
781 \fi%
782 \ifn@wpaging%
783 \recipen@wpage%
784 \else%
785 \vskip0.2cm%
786 \fi%
787 \n@wpagingfalse%
788 }%
789 % \end{macrocode}
790 %\end{macro}
791 %
792 %\begin{macro}{\r@cipetitle}
793 % |\r@cipetitle| displays the recipe title construction, given the parameters
794 % |#1| the title, |#2| the number of servings and |#3| the preparation time.
795 %
796 % \begin{macrocode}
797 \DeclareRobustCommand{\r@cipetitle}[3]{%
798 % \end{macrocode}
799 % The |\parskip| ensures that the distance between the rule and the text above
800 % and below does not change when the page's vertical glue ``sets''.
801 % The following displays the text line above the rule; the recipe number width
802 % is automatically determined here.
803 % \begin{macrocode}
804 \mbox{%
805 \makebox[\R@cipeWidth][t]{%
806 \parbox[t]{\R@cipeWidth}{%
807 \ifnumb@ring%
808 \savebox{\titl@tmpbox}{%
809 {\recipenumberfont\arabic{r@cipenumber}\ \ }%
810 }%
811 \setlength{\R@cipeNumberWidth}{\wd\titl@tmpbox}%
812 \addtolength{\R@cipeTitleWidth}{-\R@cipeNumberWidth}%
813 \addtolength{\R@cipeTandSWidth}{-\R@cipeNumberWidth}%
814 \lineskip0pt\mbox{}\\[-\baselineskip]%
815 \parbox[b]{\R@cipeNumberWidth}{%
816 \rule{0pt}{\baselineskip}%
817 \strut\usebox{\titl@tmpbox}%
818 \strut%
819 }%
820 \makebox[\R@cipeTandSWidth][t]{%
821 \parbox[t]{\R@cipeTandSWidth}{%
822 \lineskip0pt\mbox{}\\[-\baselineskip]%
823 \parbox[b]{\R@cipeTitleWidth}{%
824 \rule{0pt}{\baselineskip}%
825 \strut{\recipetitlefont #1}\strut\hfill}%
826 \parbox[b]{\R@cipeServingsWidth}{%
827 \strut{\hfill\recipeservingsfont #2}\strut}%
828 }%
829 }%
830 \addtolength{\R@cipeTandSWidth}{\R@cipeNumberWidth}%
831 \addtolength{\R@cipeTitleWidth}{\R@cipeNumberWidth}%
832 \else%
833 \lineskip0pt\mbox{}\\[-\baselineskip]%
834 \parbox[b]{\R@cipeTitleWidth}{%
835 \rule{0pt}{\baselineskip}%
836 \strut{\recipetitlefont #1}\strut\hfill}%
837 \parbox[b]{\R@cipeServingsWidth}{%
838 \strut{\hfill\recipeservingsfont #2}\strut}%
839 \fi%
840 }%
841 }%
842 }\par%
843 % \end{macrocode}
844 % Next we display the rule, being careful not to allow
845 % page breaks during the title, using the adjustments as specified above.
846 % (This is a bit vague and nasty...)
847 % \begin{macrocode}
848 %% \nopagebreak
849 %% \vspace{\R@cipeTitleVerticalAdjustTop}%
850 \nopagebreak
851 \rule[-\R@cipeTitleVerticalAdjustTop]{\R@cipeWidth}{0.4pt}\par%
852 \nopagebreak
853 \vskip\R@cipeTitleVerticalAdjustBot%
854 %% \vspace{\R@cipeTitleVerticalAdjustBot}%
855 \nopagebreak
856 % \end{macrocode}
857 % Finally we display the text line below the rule if it isn't empty:
858 % \begin{macrocode}
859 \ifx\relax#3\relax%
860 \else
861 \makebox[\R@cipeWidth][r]{\recipetimefont #3}\par%
862 \fi
863 \nopagebreak
864 }%
865 % \end{macrocode}
866 %\end{macro}
867 %
868 %
869 % \subsection{Macros for the method box}
870 % These macros are to input the method box |\st@pmethodbox|, and are hence
871 % called at the start and end of the method box, or equivalently the
872 % \emph{end} and \emph{start} of the ingredient (etc.) macros.
873 %
874 %\begin{macro}{\r@cipesloppy}
875 % This is a version of \sloppy which doesn't cause problems with the
876 % definition! (The \LaTeX\ definition has a problem where the empty box
877 % detection in |\pr@ingred| fails.)
878 % \begin{macrocode}
879 \def\r@cipesloppy{%
880 \tolerance 9999%
881 \emergencystretch 3em%
882 \hfuzz.5pt%
883 \vfuzz.5pt%
884 % \end{macrocode}
885 % This is not in |\sloppy|: avoid warning on underfull boxes, which are
886 % more common since the columns are very narrow.
887 % This value may need to be adjusted...
888 % \begin{macrocode}
889 \hbadness 1500%
890 }%
891 % \end{macrocode}
892 %\end{macro}
893 %
894 %\begin{macro}{\pr@ingred}
895 % This macro is called at the start of ingredients (that is, the
896 % end of the method box). It first ends the minipage--box which was started
897 % in the previous |\p@stingred|.
898 % \begin{macrocode}
899 \DeclareRobustCommand{\pr@ingred}{%
900 \endminipage\end{lrbox}%
901 % \end{macrocode}
902 % Here we compare the width of the |\st@pmethodbox| with zero to determine
903 % whether anything was entered into it.
904 % (The idea for determining whether box is empty was from
905 % Donald Arseneau, |comp.text.tex|.)
906 % \begin{macrocode}
907 \ifdim\wd\st@pmethodbox=0in%
908 % \PackageWarning{cuisine}{No text}% % use for testing
909 \else%
910 % \PackageWarning{cuisine}{Method text}%
911 \DisplaySt@p%
912 \fi%
913 }%
914 % \end{macrocode}
915 %\end{macro}
916 %
917 %\begin{macro}{\p@stingred}
918 % And this macro is called at the end of ingredients (the start of the method
919 % box).
920 %
921 % This is very odd. Using |\begin{lrbox}|...|\end{lrbox}| isn't
922 % supposed to work properly over an environment definition (and doesn't
923 % seem to, either). So we use |\lrbox|...|\endlrbox|. But we want to nest
924 % a |\minipage| inside this, which fails. But it does work with
925 % |\begin{lrbox}\minipage|...|\endminipage\end{lrbox}|.
926 %
927 % \centerline{WHY?!}
928 %
929 % What happens, anyway, is that a new minipage--box is started. Provided
930 % the user doesn't put anything other than whitespace and comments between
931 % this and the next |\pr@ingred| then the box will be empty. This is how
932 % |\p@stingred| knows whether to display the step or not when called by
933 % |\ingr@dient|.
934 % \begin{macrocode}
935 \DeclareRobustCommand{\p@stingred}{%
936 \fr@eformingfalse%
937 \begin{lrbox}{\st@pmethodbox}\minipage[t]{\R@cipeMethodWidth}%
938 \recipemethodfont%
939 \noindent%
940 \ignorespaces%
941 \r@cipesloppy%
942 }%
943 % \end{macrocode}
944 %\end{macro}
945 %
946 %\subsection{Step terminating macros}
947 % These macros call |\pr@ingred| and |\p@stingred|, and
948 % can (through |\pr@ingred|) cause the next step to be started.
949 %
950 %\begin{macro}{\m@thodend}
951 % The |\m@thodend| command (which is |\newstep| in the environment) forces
952 % a new step unless there is no method \textbf{and} no ingredient.
953 % \begin{macrocode}
954 \DeclareRobustCommand{\m@thodend}{%
955 \endminipage\end{lrbox}%
956 \ifdim\wd\st@pmethodbox=0in%
957 \ifnum\value{ingr@dnumber}>0%
958 % \end{macrocode}
959 % In this case, the method box is empty so we put something in it to avoid
960 % problems with alignment.
961 % \begin{macrocode}
962 \savebox{\st@pmethodbox}[\R@cipeMethodWidth]{\mbox{}}%
963 \DisplaySt@p%
964 \fi%
965 \else%
966 \DisplaySt@p%
967 \fi%
968 \p@stingred%
969 }%
970 % \end{macrocode}
971 %\end{macro}
972 %
973 %\begin{macro}{\r@cipen@wpage}
974 % |\r@cipen@wpage| is a macro which sets |\n@wpagingtrue|---so that the next
975 % step will appear on the next page---and then forces the next step.
976 % \begin{macrocode}
977 \DeclareRobustCommand\r@cipen@wpage{\global\n@wpagingtrue\m@thodend}
978 % \end{macrocode}
979 %\end{macro}
980 %
981 %\begin{macro}{\fr@eform}
982 % |\fr@eform| is for freeform text, like |\noalign| in tables.
983 % Again, as for |\m@thodend|, we want to force the new step unless there is
984 % no method and no ingredient.
985 % \begin{macrocode}
986 \DeclareRobustCommand{\fr@eform}{%
987 \endminipage\end{lrbox}%
988 \ifdim\wd\st@pmethodbox=0in%
989 \ifnum\value{ingr@dnumber}>0%
990 \savebox{\st@pmethodbox}[\R@cipeMethodWidth]{\mbox{}}%
991 \DisplaySt@p%
992 \fi%
993 \else%
994 \DisplaySt@p%
995 \fi%
996 % \end{macrocode}
997 % The rest is like |\p@stingred|:
998 % \begin{macrocode}
999 \fr@eformingtrue%
1000 \begin{lrbox}{\st@pmethodbox}\minipage[t]{\R@cipeWidth}%
1001 \recipefreeformfont%
1002 \noindent%
1003 \ignorespaces%
1004 \r@cipesloppy%
1005 }%
1006 % \end{macrocode}
1007 % \end{macro}
1008 %
1009 %\begin{macro}{\ingr@dient}
1010 % The |\ingr@dient| command takes 3 parameters, one optional. |#3| is the
1011 % ingredient. If |#1| is non-blank then |#1| is the numerical quantity and
1012 % |#2| the unit of measure, otherwise |#2| is the quantity. Start by ending the
1013 % method box.
1014 % \begin{macrocode}
1015 \DeclareRobustCommand{\ingr@dient}[3][]{%
1016 \pr@ingred%
1017 % \end{macrocode}
1018 %
1019 % The following is the main bit to typeset the ingredients list.
1020 % (Thanks to Ulrike Fischer, |comp.text.tex|, for help with aligning box
1021 % baselines.)
1022 %
1023 % This is a hack to see if |#1| is empty (Patrick Guio, |comp.text.tex|).
1024 % \begin{macrocode}
1025 \ifx\relax#1\relax%
1026 % \end{macrocode}
1027 % If it is empty we typeset |#2| in the whole QandU width. We align the top of
1028 % the ingredient box with the bottom of the quantity box but have the
1029 % baseline as the top line of the quantity box. Use ragged right because the
1030 % column is too narrow for flush right.
1031 % \begin{macrocode}
1032 \savebox{\st@pIQUbox}[\R@cipeIQUWidth][t]{%
1033 \parbox[t]{\R@cipeIQUWidth}{%
1034 \lineskip0pt\mbox{}\\[-\baselineskip]%
1035 \rule{\R@cipeOutdent}{0cm}%
1036 \parbox[b]{\R@cipeQandUWidth}{%
1037 \raggedright\recipeunitfont%
1038 \setlength{\parindent}{-\R@cipeOutdent}%
1039 % \end{macrocode}
1040 % This sees whether the text is large enough to fit on one line, in which case
1041 % it centres it; otherwise it formats it sensibly.
1042 %
1043 % Note: the |\hfill| matches another one elsewhere to centre the line.
1044 % \begin{macrocode}
1045 \savebox{\st@pingrtmpbox}{#2}%
1046 \ifdim\wd\st@pingrtmpbox>\R@cipeQandUWidth%
1047 \rule{0pt}{\baselineskip}%
1048 \strut #2\strut%
1049 \else%
1050 \noindent%
1051 \rule{0pt}{\baselineskip}%
1052 \strut #2\hfill\strut%
1053 \fi%
1054 }%
1055 \rule{\R@cipeIngUISpace}{0cm}%
1056 \rule{\R@cipeOutdent}{0cm}%
1057 \parbox[t]{\R@cipeIngredientWidth}{\raggedright%
1058 \recipeingredientfont%
1059 \setlength{\parindent}{-\R@cipeOutdent}%
1060 \strut #3\strut}%
1061 }%
1062 }%
1063 \else
1064 % \end{macrocode}
1065 % If |#1| was not empty, typeset |#1| and |#2| separately. First align the top of
1066 % the ingredient box with the bottom of the unit box but have the
1067 % baseline as the top line of the unit box; then repeat with that box below
1068 % the quantity box.
1069 % \begin{macrocode}
1070 \savebox{\st@pingrtmpbox}[\R@cipeIandUWidth][t]{%
1071 \parbox[t]{\R@cipeIandUWidth}{%
1072 \lineskip0pt\mbox{}\\[-\baselineskip]%
1073 \rule{\R@cipeOutdent}{0cm}%
1074 \parbox[b]{\R@cipeUnitsWidth}{%
1075 \raggedright\recipeunitfont%
1076 \setlength{\parindent}{-\R@cipeOutdent}%
1077 \rule{0pt}{\baselineskip}%
1078 \strut #2\strut\hfill}%
1079 \rule{\R@cipeIngUISpace}{0cm}%
1080 \rule{\R@cipeOutdent}{0cm}%
1081 \parbox[t]{\R@cipeIngredientWidth}{%
1082 \raggedright\recipeingredientfont%
1083 \setlength{\parindent}{-\R@cipeOutdent}%
1084 \strut #3\strut}%
1085 }%
1086 }%
1087 \savebox{\st@pIQUbox}[\R@cipeIQUWidth][t]{%
1088 \parbox[t]{\R@cipeIQUWidth}{%
1089 \lineskip0pt\mbox{}\\[-\baselineskip]%
1090 \parbox[b]{\R@cipeQuantityWidth}{\rule{0pt}{\baselineskip}%
1091 \hfill %
1092 \raggedright\recipequantityfont%
1093 \strut #1\strut%
1094 \rule{\R@cipeIngQUSpace}{0cm}}%
1095 \usebox{\st@pingrtmpbox}%
1096 }%
1097 }%
1098 \fi%
1099 % \end{macrocode}
1100 % Use |\st@pingrtmpbox| as a temporary holding box. The |\lineskip0pt|
1101 % and the |\strut|s
1102 % ensure that the ingredients' and the method text's baselines
1103 % are aligned correctly.
1104 % \begin{macrocode}
1105 \savebox{\st@pingrtmpbox}[\R@cipeIQUWidth][t]{\usebox{\st@pingrbox}}%
1106 \savebox{\st@pingrbox}[\R@cipeIQUWidth][t]{%
1107 \begin{minipage}[t]{\R@cipeIQUWidth}%
1108 \lineskip0pt%
1109 \ifnum\value{ingr@dnumber}>0%
1110 \usebox{\st@pingrtmpbox}\par%
1111 \usebox{\st@pIQUbox}\strut%
1112 \else%
1113 \usebox{\st@pIQUbox}\strut%
1114 \fi%
1115 \end{minipage}%
1116 }%
1117 % \usebox{\st@pingrbox} % For testing: show cumulative boxes.
1118 \stepcounter{ingr@dnumber}%
1119 \p@stingred%
1120 }%
1121 % \end{macrocode}
1122 %\end{macro}
1123 %
1124 %\begin{macro}{\Ingr@dient}
1125 %The |\Ingr@dient| command takes just one parameter. It fits in the same
1126 %final box as |\ingr@dient| but is much simpler. Start by ending the method
1127 %box.
1128 % \begin{macrocode}
1129 \DeclareRobustCommand{\Ingr@dient}[1]{%
1130 \pr@ingred%
1131 % \end{macrocode}
1132 %
1133 %We typeset |#1| in the single ingredient width, which is the IQU width minus
1134 %the outdent. Use ragged right because the
1135 %column is too narrow for flush right.
1136 % \begin{macrocode}
1137 \savebox{\st@pIQUbox}[\R@cipeSingleIngWidth][t]{%
1138 \parbox[t]{\R@cipeSingleIngWidth}{%
1139 \lineskip0pt\mbox{}\\[-\baselineskip]%
1140 \rule{\R@cipeOutdent}{0cm}%
1141 \parbox[t]{\R@cipeSingleIngWidth}{\raggedright%
1142 \recipeingredientfont%
1143 \setlength{\parindent}{-\R@cipeOutdent}%
1144 \strut #1\strut}%
1145 }%
1146 }%
1147 % \end{macrocode}
1148 % Use |\st@pingrtmpbox| as a temporary holding box. The |\lineskip0pt|
1149 % and the |\strut|s
1150 % ensure that the ingredients' and the method text's baselines
1151 % are aligned correctly.
1152 % \begin{macrocode}
1153 \savebox{\st@pingrtmpbox}[\R@cipeIQUWidth][t]{\usebox{\st@pingrbox}}%
1154 \savebox{\st@pingrbox}[\R@cipeIQUWidth][t]{%
1155 \begin{minipage}[t]{\R@cipeIQUWidth}%
1156 \lineskip0pt%
1157 \ifnum\value{ingr@dnumber}>0%
1158 \usebox{\st@pingrtmpbox}\par%
1159 \usebox{\st@pIQUbox}\strut%
1160 \else%
1161 \usebox{\st@pIQUbox}\strut%
1162 \fi%
1163 \end{minipage}%
1164 }%
1165 % \usebox{\st@pingrbox} % For testing: show cumulative boxes.
1166 \stepcounter{ingr@dnumber}%
1167 \p@stingred%
1168 }%
1169 % \end{macrocode}
1170 %\end{macro}
1171 %
1172 %^^A ------------------------------------------------
1173 %\section{The recipe environment}
1174 %\begin{environment}{recipe}
1175 %This is the main environment in the package. Its 3 parameters are |#2| is
1176 %the recipe title, |#3| is the number of portions, and |#3| the preparation
1177 %time. Of course, |#3| and |#4| can be whatever you like but that is one way
1178 %of using them. |#1| is the label.
1179 % \begin{macrocode}
1180 \newenvironment{recipe}[4][]{%
1181 % \end{macrocode}
1182 % These are the things that are put at the start of the recipe environment.
1183 % First, set things up. Increment the recipe counter (which can be used in
1184 % |\label|), make command aliases and empty the boxes.
1185 % Note that |\label| is set through |#1|, {\bf not} |\label|.
1186 % \begin{macrocode}
1187 \refstepcounter{r@cipenumber}
1188 \ifx\relax#1\relax
1189 \else
1190 \label{#1}
1191 \fi
1192 \let\label\relax
1193 \let\newstep\m@thodend
1194 \let\recipen@wpage\newpage
1195 \let\newpage\r@cipen@wpage
1196 \let\0\d@grees
1197 \let\X\tim@s
1198 \let\degrees\d@grees
1199 \let\fr\fr@ction
1200 \let\ing\ingr@dient
1201 \let\ingredient\ingr@dient
1202 \let\Ing\Ingr@dient
1203 \let\Ingredient\Ingr@dient
1204 \let\freeform\fr@eform
1205 \n@wpagingfalse%
1206 \setlength{\parindent}{0pt}
1207 \savebox{\st@pingrbox}[\R@cipeIQUWidth]{}
1208 \savebox{\st@pmethodbox}[\R@cipeMethodWidth]{}
1209 % \end{macrocode}
1210 % Make sure that the recipe is spaced appropriately from the preceding text
1211 % and start a new page if necessary. This is not part of |\r@cipetitle|
1212 % because putting the break after |\addcontentsline| might yield the wrong
1213 % page number. The blank line below is intentional.
1214 % \begin{macrocode}
1215
1216 \bigskip\medskip
1217 \pagebreak[0]
1218 \parskip0pt%
1219 % \end{macrocode}
1220 % Next deal with the contents/index entry if we need to. Again, the
1221 % |\nopagebreak| prevents the contents line occurring on the previous page.
1222 % \begin{macrocode}
1223 \ifc@ntentsing%
1224 \addcontentsline{toc}{subsection}{#2}%
1225 \fi%
1226 \ifind@xing%
1227 \index{#2 (\arabic{r@cipenumber})}%
1228 \fi%
1229 \nopagebreak%
1230 % \end{macrocode}
1231 % Display the title and start the method box.
1232 % \begin{macrocode}
1233 \r@cipetitle{#2}{#3}{#4}
1234 \vskip0.2cm%
1235 \p@stingred%
1236 }%
1237 {%
1238 % \end{macrocode}
1239 % These are the things put at the end of recipes.
1240 % End the method box and deal with the last step. Give a warning if the
1241 % recipe is empty.
1242 % It is apparently not necessary to reset the earlier assignments and
1243 % |\parindent|.
1244 % \begin{macrocode}
1245 \pr@ingred%
1246 \ifnum\value{st@pnumber}=0% then complain!
1247 \PackageWarning{cuisine}{The recipe did not have any steps}%
1248 \fi%
1249
1250 \pagebreak[0]%
1251 \medskip%
1252 % \end{macrocode}
1253 % This prevents indentation problems after the end of the environment.
1254 % \begin{macrocode}
1255 \@endpetrue%
1256 }%
1257 % \end{macrocode}
1258 %\end{environment}
1259 %
1260 %
1261 %^^A ------------------------------------------------
1262 %\section{Miscellaneous useful macros}
1263 %
1264 % \begin{macro}{\d@grees}
1265 %This is to typeset a degrees symbol.
1266 % \begin{macrocode}
1267 \DeclareRobustCommand{\d@grees}{%
1268 ${}^\circ$%
1269 }%
1270 % \end{macrocode}
1271 %\end{macro}
1272 %
1273 %\begin{macro}{\tim@s}
1274 % This is to typeset a times symbol (like ${}\times\!$).
1275 % \begin{macrocode}
1276 \DeclareRobustCommand{\tim@s}{%
1277 \relax${}\times{}$\relax%
1278 }%
1279 % \end{macrocode}
1280 %\end{macro}
1281 %
1282 %\begin{macro}{\fr@ction}
1283 % This is to typeset fractions, currently using package |nicefrac|.
1284 % \begin{macrocode}
1285 % \begin{macrocode}
1286 \DeclareRobustCommand{\fr@ction}[2]{%
1287 \nicefrac#1#2%
1288 }%
1289 % \end{macrocode}
1290 %\end{macro}
1291 %
1292 %^^A ------------------------------------------------
1293 %^^A That's it...
1294 %
1295 % \Finale
1296 \endinput%
1297 %^^A END OF FILE
1298 %^^A ------------------------------------------------