summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/recipecard
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2007-11-17 21:14:03 +0000
committerNorbert Preining <preining@logic.at>2007-11-17 21:14:03 +0000
commit8725f9d03c7654847c581a92ed26ba3b2b0e7307 (patch)
tree74c82c4f96f27970a511bc56e40e4a45733818b5 /Master/texmf-dist/source/latex/recipecard
parent2ca3bfab7a3cc13c71b0a3ec7875ae77ebfbb6af (diff)
new package recipecard -> latexextra
git-svn-id: svn://tug.org/texlive/trunk@5491 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/recipecard')
-rw-r--r--Master/texmf-dist/source/latex/recipecard/recipecard.dtx667
1 files changed, 667 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/recipecard/recipecard.dtx b/Master/texmf-dist/source/latex/recipecard/recipecard.dtx
new file mode 100644
index 00000000000..961131441cb
--- /dev/null
+++ b/Master/texmf-dist/source/latex/recipecard/recipecard.dtx
@@ -0,0 +1,667 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2005 by Ben Reish %
+% This file 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.
+%
+% \fi
+% \iffalse
+%<*driver>
+\ProvidesFile{recipecard.dtx}
+%</driver>
+%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+%<class>\ProvidesClass{recipecard}
+%<*class>
+[2006/10/03 v2.0 Recipecard Class typesets recipes to fit note
+cards]
+%</class>
+%<*batchfile>
+\begingroup
+\input docstrip.tex
+\keepsilent \preamble This is a generated file. Copyright (C) 2005
+by Ben Reish This file 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.
+\endpreamble
+\generate{\file{recipecard.cls}{\from{recipecard.dtx}{class}}}
+\Msg{*********************************************************}
+\Msg{*} \Msg{* To finish the installation you have to move the}
+\Msg{* following file into a directory searched by TeX:} \Msg{*}
+\Msg{* \space\space recipecard.cls} \Msg{*} \Msg{* To produce the
+documentation run the file recipecard.dtx} \Msg{* through LaTeX.}
+\Msg{*} \Msg{* Happy TeXing!}
+\Msg{*********************************************************}
+\endgroup
+%</batchfile>
+%
+%<*driver>
+\documentclass{ltxdoc}
+\EnableCrossrefs \CodelineIndex \RecordChanges
+\begin{document}
+\DocInput{recipecard.dtx}
+\end{document}
+%</driver>
+% \fi
+% \CheckSum{391}
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<%
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+%
+% \changes{v1.0}{2005/12/21}{Initial version}
+%
+% \GetFileInfo{recipecard.dtx}
+%
+% \DoNotIndex{\section,\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ ,\@ne,\advance}
+% \DoNotIndex{\begingroup,\catcode,\closein,\closeout,\day,\def,\edef,\else,\empty}
+% \DoNotIndex{\(,\),\and,\begin,\bfseries,\end,\expandafter,\par,\geometry}
+% \DoNotIndex{\hbox,\hspace,\ifthenelse,\newcommand,\or,\pagetotal,\raggedright}
+% \DoNotIndex{\setcounter,\setlength,\string,\the,\typeout,\value}
+%
+% \title{The \textsf{recipecard} class\thanks{This document
+% corresponds to \textsf{recipecard.dtx}~\fileversion,
+% dated \filedate.}}
+% \author{Ben Reish \\ \texttt{ben.reish@alumni.oc.edu}}
+%
+% \maketitle
+%
+% \begin{abstract}
+% The point of this package is to typeset recipes. I tried \textsf{cooking.sty}
+% and did not like the results so I am making my own.
+% \texttt{Recipecard} is an alternate method for typesetting recipes.
+% Created by Ben Reish \copyright{}2005
+% \end{abstract}
+%
+% \changes{v1.6}{2006/7/21}{Added more verbage to the explanations of
+% how the code operates.}
+% \changes{v1.7}{2006/9/7}{Added sections and subsections to class documentation.}
+% \changes{v2.0}{2006/9/11}{Added table of contents to first page.}
+%
+% \tableofcontents
+%
+% \section{Introduction}
+% For those who yearn to have typed note cards for their recipes,
+% \textsf{recipecard}\ has been created. The user can print out
+% his or her recipes in this class and then cut the pages along the
+% box outlines for pieces that will fit on a notecard. Hopefully,
+% multiple dimensions of note cards will be accommodated. This class
+% is based on the \textsf{article}\ class. This class is issued
+% under the \LaTeXe\ Project Public License.
+%
+% The |recipecard| class was created to look like a recipe card. The
+% card begins with a title and across from the title is the number
+% of servings the recipe makes. Then comes three columns of ingredients
+% if there are enough ingredients and depending on the number
+% of ingredients per column, which can be changed from recipe to
+% recipe. After the ingredients comes the instructions on making
+% the recipe. Finally, if the user has used the |\cookingtime| and
+% |\cooktemp| commands, those two are below the instructions.
+%
+% \setlength{\unitlength}{1mm} \vspace{5pt} \hspace{3cm}
+% \begin{picture}(50,30)
+% \put(0,0){\framebox(50,30){}}
+% \put(1,28.5){\dashbox{.5}(25,1){title}}
+% \put(42,28.5){\dashbox{.5}(7,1){}}
+% \multiput(1,22)(16,0){3}{\dashbox{.5}(15,6){}}
+% \put(7.5,21.5){\line(1,0){35}}
+% \put(1,9){\dashbox{.5}(48,12){instructions}}
+% \multiput(1,7.5)(38,0){2}{\dashbox{.5}(10,1){}}
+% \end{picture}
+%
+% \changes{v1.53}{2006/7/21}{Added figure to help describe the%
+% layout of the recipe card.}
+%
+% \section{Usage}
+%
+% \subsection{Class Options}
+% The |recipecard| class has three Class Options which can be selected
+% at the |\DocumentClass| statement. Each option tells the class
+% what size the card output will be. The options are: |fivebysevn|
+% (5 inches by 7 inches), |fourbysix| (4 inches by 6 inches), and
+% |threebyfive| (3 inches by 5 inches). The |fivebysevn| option is intended
+% for use with 5 inch by 7 inch note cards and places two note cards
+% per page. The |fourbysix| option is intended for use with 4 inch
+% by 6 inch note cards and places two note cards per page. The
+% |threebyfive| option is intended for use with 3 inch by 5 inch
+% note cards and places two note cards per page. Originally, the
+% code should have been able to place four 3 inch by 5 inch note
+% cards per page, but that just did not work. One other thing that
+% did not work is the ability to automatically break long recipes
+% onto separate note cards. That is something that the user will
+% have to take care of when the recipe prints.
+%
+% The default option is the |fivebyseven| option. A sample
+% |\Documentclass| statement might look like:
+% |\documentclass[fourbysix]{recipecard}|.
+%
+% \subsection{User Commands}
+%
+% \DescribeMacro{\ingredient}
+% The |\ingredient| \marg{ingredient} command adds an ingredient
+% to the next recipe. It is used before the |recipe| environment
+% because the list it is creating is printed at the beginning of
+% the next instance of the |recipe| environment.
+%
+% \DescribeMacro{\changeingrdlistnum}
+% The |\changeingrdlistnum| \marg{num} command will change the
+% number of ingredients per column to \meta{num}. The user
+% can create his or her own command to shorten up the command
+% name. It should be used before the instance of the |recipe|
+% environment that it is supposed to change. The user can make use
+% of this command as often as he or she likes. The command will
+% change all the following instances of the |recipe| environment
+% as well. For a more uniform look to the printed card, the user
+% should divide the number of ingredients per recipe by 3 and round up.
+%
+% \DescribeEnv{recipe}
+% The |recipe| environment is the staging area for each recipe.
+% Use it to group all the information about each recipe into
+% one area. Its call out looks like: |\begin{recipe}| \marg{title}
+% \marg{servings} \ldots |\end{recipe}|. The instructions for
+% making the recipe go in between the |\begin| and |\end|
+% commands. The |\cooktemp| and |\cookingtime| commands go in
+% with the instructions.
+%
+% \DescribeMacro{\cooktemp}
+% The |\cooktemp| \marg{temp} \marg{deg}\ macro adds a cooking
+% temperature to the card. The \meta{temp} is the numerical
+% temperature. The \meta{deg}\ is the units. Put
+% `C' in for \meta{deg} for Celsius or `F' for Fahrenheit. For
+% example, if the user wanted 350\textsuperscript{$\circ$}
+% Fahrenheit for the cooking temperature, the command would
+% look like: |\cooktemp{350}{F}|
+%
+% \DescribeMacro{\cookingtime}
+% The |\cookingtime| \marg{time} command adds a bold face
+% ``Cook Time: \meta{time}'' to the bottom of the card.
+%
+% \StopEventually{\PrintIndex}
+%
+% \section{Implementation}
+%
+% \subsection{Class Definition}
+% \begin{macrocode}
+\RequirePackage{calc,ifthen,boxedminipage}
+% \end{macrocode}
+% The user will need the |calc|, |ifthen|, |geometry|, and
+% |boxedminipage| packages for the |recipecard| class to
+% operate correctly. These should be available with the user's
+% distribution of \LaTeXe\ or from \emph{CTAN} at \textsc{www.ctan.org}.
+%
+% The |geometry| package is used because it seems easier than
+% attempting to use the old style layout commands.
+%
+% After requiring the |geometry| package, the code creates new boolean
+% variables and token registers for use later in the class.
+% \begin{macrocode}
+\RequirePackage[letterpaper,noheadfoot]{geometry} %showframe
+\newboolean{fiveseven} \newboolean{foursix} \newboolean{threefive}
+\newtoks{\@ta} \newtoks{\@tb} \newtoks{\@listone} \newtoks\@listtwo
+\newtoks\@listthree \def\@nil{}
+
+\renewcommand{\normalsize}{\fontsize{10pt}{12pt}\usefont{T1}{ptm}{m}{n}%
+ \selectfont}
+% \end{macrocode}
+% These commands are general specifications needed by any class.
+% First, select the default font. Then set up the page layout
+% in general. After that, create a couple of length dimensions
+% so that each size of notecard can have its own height and
+% width of the ingredient columns.
+% \begin{macrocode}
+\setlength{\textwidth}{7in} \setlength{\textheight}{10.25in}
+\setlength{\paperwidth}{8.5in} \setlength{\paperheight}{11in}
+\newlength{\@ingredientlist} \newlength{\@cardheight}
+\newcommand{\textdegree}{\textsuperscript{$\circ$}}
+% \end{macrocode}
+% The |\textdegree| command is needed for the |\cooktemp| command
+% which will be described later. It is made available to the user
+% at any point in the class by defining a command for it.
+%
+% \subsection{Options}
+% Next, the class-specific options are defined.
+% \begin{macrocode}
+\DeclareOption{fivebyseven}{\geometry{%
+ body={7in,10.25in},left=.75in}% centering,right=.75in
+ \setlength{\@ingredientlist}{2in} \setlength{\@cardheight}{5in}%
+ \setboolean{fiveseven}{true}}
+% \end{macrocode}
+% The |fivebyseven| option resets the page layout so that
+% two 5~inch by 7~inch notecards can be placed on the front
+% of one page. There is a little extra space so that the
+% user can cut the pieces out without harming either notecard.
+% This option sets the \meta{\@cardheight} to 5~inches and the
+% ingredient list column width, \meta{\@ingredientlist}, to 2~inches.
+% Finally, it sets the |fiveseven| boolean to true so that
+% any other things the class might need on a size specific
+% basis can be set inside an |if| statement later as necessary.
+% \begin{macrocode}
+\DeclareOption{fourbysix}{\geometry{%
+ body={6in,8.15in},left=.75in}%right=1.75in
+ \setlength\@ingredientlist{1.75in}%
+ \setlength\@cardheight{4in} \setboolean{foursix}{true}}
+% \end{macrocode}
+% The |fourbysix| option resets the page layout so that
+% two 4~inch by 6~inch notecards can be placed on the front
+% of one page. There is a little extra space so that the
+% user can cut the pieces out without harming either notecard.
+% This option sets the \meta{\@cardheight} to 4~inches and the
+% ingredient list column width, \meta{\@ingredientlist}, to 1.75~inches.
+% Finally, it sets the |foursix| boolean to true so that
+% any other things the class might need on a size specific
+% basis can be set inside an |if| statement later as necessary.
+% \begin{macrocode}
+\DeclareOption{threebyfive}{\geometry{%
+ landscape,body={10.25in,6.25in},left=.375in}%,right=.375in
+ \setlength\@ingredientlist{1.5in}%
+ \setlength\@cardheight{3in} \setboolean{threefive}{true}}
+% \end{macrocode}
+% The |threebyfive| option resets the page layout so that
+% four 3~inch by 5~inch notecards can be placed on the front
+% of one page. There is a little extra space so that the
+% user can cut the pieces out without harming either notecard.
+% This option sets the \meta{\@cardheight} to 3~inches and the
+% ingredient list column width, \meta{\@ingredientlist}, to 1.5~inches.
+% Finally, it sets the |threefive| boolean to true so that
+% any other things the class might need on a size specific
+% basis can be set inside an |if| statement later as necessary.
+% Note: The class does not print four 3'' by 5'' notecards to
+% the page. It only gets two to the page.
+% \begin{macrocode}
+\DeclareOption{nothing}{\relax}
+
+\DeclareOption*{\typeout{What's \CurrentOption?}}
+
+\ExecuteOptions{fivebyseven,nothing}
+
+\ProcessOptions\relax
+% \end{macrocode}
+% Once the options are defined, the class must be given a default
+% option to use if none is specified by the user. In this case,
+% the |fivebyseven| option is chosen.
+% \begin{macrocode}
+
+% \end{macrocode}
+% \subsection{User Commands}
+% The following commands are used to fill in the recipe cards' information.
+% \begin{macro}{\ingredient}
+% The |\ingredient| command is used to define the list of ingredients
+% in the recipe. It is the user-friendly way to add an ingredient.
+% It uses a counter, \meta{ingred@cnt}, to keep track of how many ingredients
+% have been added. The counter is used later. Then the command calls
+% |\@ddtoNgrList| and passes its argument off to that command. The argument
+% of this command can be any length, but remember that it will be wrapped
+% to the next line if it is too long because of the width of the
+% ingredient columns.
+% \begin{macrocode}
+\newcounter{ingred@cnt}\setcounter{ingred@cnt}{0}
+\newcommand{\ingredient}[1]{%
+ \stepcounter{ingred@cnt}
+ \@ddtoNgrdList{#1}
+ %\typeout{\string\ingredient{#1}}
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\changeingrdlistnum}
+% The |\changeingrdlistnum| macro allows the user to
+% modify the number of ingredients listed vertically
+% before the class switches to the next column of
+% ingredients. The default value is 7. The number
+% of rows in the ingredient list columns is stored in
+% the \meta{ingred@list} counter.
+% \changes{v1.2}{2006/1/19}{Added the ability to
+% manipulate how many rows are in each column of the
+% ingredients list.}
+% \begin{macrocode}
+\newcounter{ingred@list} \setcounter{ingred@list}{7}
+\newcommand{\changeingrdlistnum}[1]{%
+ \setcounter{ingred@list}{#1}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{environment}{recipe}
+% The |recipe|
+% environment has several things going on. First, the class creates
+% the card width dimension, \meta{@cardwidth}. Depending on the
+% size of cards the user wants at the |\documentclass|
+% instance, the length of \meta{@cardwidth} is different. Any other
+% global settings that change due to the size of the card are to be
+% implemented here. Then the class creates several lengths and a
+% save box called |\@reccardbox| to be used with the |\begin{lrbox}|
+% command. The boolean variables set during the options section of
+% the class come into play here.
+% \changes{v1.3}{2006/1/17}{Added support for 5x7
+% notecards.} \changes{v1.5}{2006/2/6}{Added support
+% for 4x6 and 3x5 notecards.} \changes{v1.52}{2006/7/28}{Fixed a bug
+% in the 3x5 notecard display that was dropping the third list of
+% ingredients to the bottom of the first list. Also added an indent
+% to paragraphs in the instructions section of the recipe environment.}
+% \begin{macrocode}
+\newdimen{\@cardwidth}
+\ifthenelse{\boolean{fiveseven}}{\setlength\@cardwidth{7in}}{}
+\ifthenelse{\boolean{foursix}}{\setlength\@cardwidth{6in}}{}
+\ifthenelse{\boolean{threefive}}{\setlength\@cardwidth{5in}%
+ \changeingrdlistnum{4}
+ \renewcommand{\normalsize}{\fontsize{8pt}{10pt}%
+ \usefont{T1}{ptm}{m}{n}\selectfont}}{}
+% \end{macrocode}
+% For the 3~inch by 5~inch card, the font needs to be smaller to help
+% fit the same amount of information on the card. The |\normalsize| command
+% is renewed to allow the smaller font.
+% \begin{macrocode}
+\newsavebox{\@reccardbox} \newdimen{\@reccardh} \newdimen{\@rectemp}
+\newdimen{\@hruleoffset} \newdimen{\@rectempa}
+\newdimen{\@rectempb} \newdimen{\@rectempc} \newdimen{\BR@recd}
+\setlength\@rectemp{\@cardheight-2\fboxsep-2\fboxrule-17pt}
+\setlength{\@hruleoffset}{(\@cardwidth-2\fboxsep-2\fboxrule-.714\@cardwidth)/2}
+% \end{macrocode}
+% The code sets the length of \meta{@rectemp} to the height of the card minus two
+% times the separation distance for a framed box minus two times the
+% thickness of the framed box line minus seventeen points for the title
+% font. The \meta{@hruleoffset} length is the distance needed to center the
+% horizontal rule that goes below the ingredients and above the instructions.
+% \begin{macrocode}
+\newenvironment{recipe}[2]{%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \ifthenelse{\equal{#2}{\@empty}}{\def\@recserv{}}%
+ {\def\@recserv{Serves: #2}}
+ \def\@rectitle{#1 \raggedright}
+% \end{macrocode}
+% The author assumes that one would enter a title for each recipe
+% so the most likely unused argument would be the second one which is the
+% number of serving the recipe makes. The code checks to see if the
+% second argument is empty. If it is the code defines the internal
+% command, |\@recserv| to be empty. If the it is not empty, the code
+% defines |\@recserv| as ``Serves: \meta{servings}.'' Then the code
+% defines the internal command |\@rectitle| as the first argument of
+% |recipe| environment, \meta{title} and applies the |\raggedright|
+% command so that \LaTeX\ does not try to stretch the title all the
+% way across the card.
+%
+% Then the code checks the second and third ingredient lists,
+% |\@listtwo| and |\@listthree|, for emptiness. The code assumes
+% that there will be at least one or two ingredients per recipe and
+% therefore does not check the first list. If either is empty,
+% the code enters a blank list |\item| command into the empty list to
+% avoid an error when \LaTeX\ processes an empty ingredient list token
+% in a list environment.
+%
+% \begin{macrocode}
+ \ifthenelse{\equal{\the\@listtwo}{\@empty}}{\@listtwo={\item {}}}{}
+ \ifthenelse{\equal{\the\@listthree}{\@empty}}{\@listthree={\item {}}}{}
+% \end{macrocode}
+% Next, the code begins an |lrbox| environment which is like a |\savebox|,
+% but as an environment, it can have more than just static text put in
+% it. This is used so that the whole card in its entirety (title,
+% ingredients, instructions, cooking times and temperatures) can be placed
+% in a |\boxedminipage| command in the ending of the |recipe| environment.
+% The |\boxedminipage| command creates the outline for the card for cutting
+% purposes.
+%
+% Inside the |lrbox|, the code starts a |minipage| environment which
+% will contain all the text on the card. Its width is the card width
+% minus twice the thickness of the line that surrounds the |boxedminipage|
+% minus twice the separation distance between the line and the inside text.
+%
+% Then the code changes the font for the title and servings; then places
+% the title with a horizontal fill white space between it and the number of
+% servings; and then switches back to normal font.
+% \begin{macrocode}
+ \begin{lrbox}{\@reccardbox}
+ \begin{minipage}[t]{\@cardwidth-2\fboxsep-2\fboxrule}
+ \noindent\fontsize{14.4}{17} \usefont{T1}{pzc}{mb}{it}%
+ \@rectitle\hspace{\fill}\@recserv\normalsize\normalfont\par
+% \end{macrocode}
+% Here begins three separate |minipage| instances; one for each list of
+% ingredients. The first and second |minipage| instances are separated with
+% a 3 point space, as are the second and third |minipage| instances. Each
+% |minipage| is \meta{@ingredientlist} wide which is set depending
+% upon the size of card the user is wanting.
+%
+% Inside each of the three |minipage| instances is a |\begin{list}| command.
+% This command defines a |list| environment that better meets the needs
+% of the |recipecard| class. The \meta{leftmargin} distance indents the text by
+% $\frac{1}{4}$ inch which makes the text that is word wrapped to the next
+% line indent a noticeable amount. The \meta{itemindent} pulls the first line of
+% each item back out to the edge of the line instead of being indented in
+% a $\frac{1}{4}$ inch. The code also adds a |\raggedright| command to
+% the end of the |list| definition which causes \LaTeX\ to not try to stretch
+% the text of the item across the whole line. After the |list| is defined,
+% the contents of |\@listone| are placed in the |list| environment and the
+% environment is closed.
+% \begin{macrocode}
+ \begin{minipage}[t]{\@ingredientlist}
+ \begin{list}{}{\setlength\leftmargin{.25in}%
+ \setlength\itemindent{-.25in}\raggedright}\the\@listone%
+ \end{list}\end{minipage}
+ \typeout{first box}
+ \hspace{3pt plus 0pt minus 6pt}
+ \begin{minipage}[t]{\@ingredientlist}
+ \begin{list}{}{\setlength\leftmargin{.25in}%
+ \setlength\itemindent{-.25in}\raggedright}\the\@listtwo%
+ \end{list}\end{minipage}
+ \typeout{second box}
+ \hspace{3pt plus 0pt minus 6pt}
+ \begin{minipage}[t]{\@ingredientlist}
+ \begin{list}{}{\setlength\leftmargin{.25in}%
+ \setlength\itemindent{-.25in}\raggedright}\the\@listthree%
+ \end{list}\end{minipage}
+ \typeout{third box}
+ \hspace{\fill}
+ \par
+% \end{macrocode}
+% Following the three lists of ingredients, the code skips 3 points vertically and
+% then skips the value of \meta{@hruleoffset} horizontally. Then the code places a line
+% down to separate the ingredients from the instructions. Next, the code skips
+% 3 points vertically before starting the instructions.
+%
+% The |\everypar| token is expanded at the beginning of each new paragraph.
+% This code places a 1em space (\rule[-.5pt]{.5pt}{.8ex}\rule[-.5pt]{1em}%
+% {.5pt}\rule[-.5pt]{.5pt}{.8ex}) indent at the start each paragraph.
+% Because of this, to obtain a fully left aligned sentence or statement,
+% the user will need to use a command like: |\hspace{-1em}|.
+% \begin{macrocode}
+ \vspace{3pt} \hspace{\@hruleoffset}%
+ \rule{.714\@cardwidth}{0.7pt}%
+ \par\vspace{3pt} \hspace{1em}%
+ \everypar={\hspace{1em}}
+ }{%
+% \end{macrocode}
+% Here begins the commands that are executed at the end of the user-entered
+% text. The code places |\@cooktime| and |\@cooktemp| at the bottom
+% left and right, respectively, of the instructions. Then the code ends the overall
+% |minipage| and |lrbox|.
+% \begin{macrocode}
+ \par \noindent \@cooktime \hspace{\fill} \@cooktemp%\par
+ \end{minipage}\end{lrbox}
+ \vspace{-.25in} \hspace{-21pt}
+% \end{macrocode}
+% Here the code inserts the contents of the |lrbox|, |\@reccardbox|, into
+% a boxed minipage. Then the clean up code starts. Zero the counter, empty
+% the list tokens, and empty the cooking commands. The cooking commands
+% use a global definition because they are placed inside the |recipe| environment,
+% which causes the changes made inside the environment to be reset when the
+% environment ends. The global definition steps out of the environment and
+% makes the changes so that they do not reset when the environment closes.
+% \begin{macrocode}
+ \begin{boxedminipage}[t]{\@cardwidth}%
+ \rule[-\@rectemp]{0pt}{\@rectemp} \hspace{-4pt}
+ \usebox{\@reccardbox}%
+ \end{boxedminipage}
+ \ifthenelse{\boolean{threefive}}{\hspace{.5ex}}{\par\vspace{.35in}}
+ \setcounter{ingred@cnt}{0}%
+ \@listone={}
+ \@listtwo={}
+ \@listthree={}
+ \gdef\@cooktime{} \gdef\@cooktemp{}
+ \everypar={}
+ %\typeout{\string\pagetotal\space\the\pagetotal}
+ %\typeout{\string\@listone\space`\the\@listone'}
+ }
+% \end{macrocode}
+% \end{environment}
+% \begin{macro}{\cookingtime}
+% The |\cookingtime| \marg{time}\ macro adds a cook time
+% to the card. This command uses an internal command, |\@cooktime|, to
+% place text on the recipe card. The |recipe| environment has the
+% internal command called out right after the instructions which causes
+% |\@cooktime| to be expanded whether or not the user has used |\cookingtime|.
+% If the user has not used |\cookingtime|, then the |\@cooktime| command
+% expands to an empty space. If he or she has used it, then |\@cooktime|
+% is defined as ``Cook Time: \meta{time}'' which is expanded when the
+% |recipe| environment calls the |\@cooktime| command. The |\hspace{-1em}|
+% is because this command is always at the left of the new paragraph, which
+% because of the |\everypar| command in the |recipe| environment, has a
+% 1em indent before it. The negative one here moves the text back up to
+% the edge. The author wanted the cook time to stand out so the bold face
+% font was used.
+% \changes{v1.3}{2006/1/19}{Added the cook time
+% to the card.}
+% \begin{macrocode}
+\def\@cooktime{}
+\newcommand{\cookingtime}[1]{%
+ \def\@cooktime{\hbox{\hspace{-1em}\bfseries Cook Time: #1}}
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\cooktemp}
+% The |\cooktemp| command uses an internal command, |\@cooktemp|
+% to insert the cooking temperature into the recipe. As with |\@cooktime|,
+% |\@cooktemp| is called by the |recipe| environment regardless of
+% it being empty or not. Again, the author wanted the cooking
+% temperature to stand out so the code uses the bold font.
+% \changes{v1.3}{2006/1/19}{Added the cooking temperature
+% to the card.}
+% \begin{macrocode}
+\def\@cooktemp{}
+\newcommand{\cooktemp}[2]{%
+ \def\@cooktemp{\hbox{\bfseries %
+ Temperature: #1\textdegree\hspace{-1.5pt}#2}}
+}
+% \end{macrocode}
+% \end{macro}
+% \subsection{Non-User Commands}
+% Here are the commands that only the class may call. These commands
+% help to hide and safeguard the inner workings of the class.
+% \begin{macro}{\@ddtoNgrdList}
+% The |\@ddtoNgrdList| \marg{ingredient}\ adds the
+% latest ingredient to one of the token lists for
+% the printout of the recipe card. This is an internal
+% function and is not user friendly. It calculates
+% which column to put the current ingredient into
+% using the number of ingredients listed so far and
+% the maximum number allowed in each column.
+% \changes{v1.2}{2006/1/19}{Implemented the ability
+% to change how many rows were in each column of
+% the ingredients list.}
+% \begin{macrocode}
+\newcounter{@tempa}\newcounter{@tempb} \newcounter{@tempc}
+\newcommand{\@ddtoNgrdList}[1]{%
+ \setcounter{@tempa}{\theingred@list+1}%
+ \setcounter{@tempb}{2*\theingred@list+1}%
+ \setcounter{@tempc}{3*\theingred@list+1}%
+% \end{macrocode}
+% After initializing the limit numbers for the columns of
+% ingredients, decide what column (1, 2, or 3) to put the
+% latest ingredient into. If this is the first time through
+% the sequence, clear the lists.
+% \begin{macrocode}
+ \ifthenelse{\value{ingred@cnt}=1}{%
+ \@ta={} \@listone={} \@listtwo={} \@listthree={}%
+ }{}
+ \ifthenelse{\value{ingred@cnt}<\value{@tempa}}{%
+ %\typeout{\string\@listone :\space\the\@listone}
+ \expandafter\@ta\expandafter=%
+ \expandafter{\the\@listone \item #1}
+ \@listone=\@ta}{%
+ \ifthenelse{\(\value{ingred@cnt}>\value{@tempa}%
+ \or \value{ingred@cnt}=\value{@tempa}%
+ \)\and\value{ingred@cnt}<\value{@tempb}}{%
+% \end{macrocode}
+% This if statement states, ``if the value of \meta{ingred@cnt} is greater
+% than the value of \meta{@tempa} (which is the number of ingredients per
+% column plus one) or equal to the value of \meta{@tempa}'' and ``the value
+% of \meta{ingred@cnt} is less than the value of \meta{@tempb} (which is the
+% number of ingredients per column times two plus one).'' If the
+% previous is true the code then evaluates the following statement.
+% \begin{macrocode}
+ \expandafter\@ta\expandafter=%
+ \expandafter{\the\@listtwo \item #1}
+% \end{macrocode}
+% The |\expandafter|'s skip the following token, so the previous statement,
+% on the first time through reads ``|\the\@listtwo|'' which expands to the
+% contents of |\@listtwo| and then returns to the beginning of the statement.
+% Then the code reads back through the statement. It has used the
+% |\expandafter|'s so they are not there for the second reading of the
+% statement. The second time through, the statement reads,
+% ``|\@ta={\item| \meta{ingredient1} |... \item | (now it inputs the contents
+% of the first argument of the command).'' Now |\@ta| is the whole of
+% |\@listtwo| plus the statement, ``|\item| \meta{ingredient5}'' (for example).
+% Lastly, the code sets |\@listtwo| to the value of |\@ta|.
+% \begin{macrocode}
+ \@listtwo=\@ta}{%
+ \ifthenelse{\(\value{ingred@cnt}>\value{@tempb}%
+ \or \value{ingred@cnt}=\value{@tempb}\)\and%
+ \value{ingred@cnt}<\value{@tempc}}{%
+ \expandafter\@ta\expandafter=%
+ \expandafter{\the\@listthree \item #1}
+ \@listthree=\@ta}{%
+% \end{macrocode}
+% The first two columns are pretty self-explanatory. If the
+% ingredient counter (\meta{ingred@cnt}) is greater than the
+% number of items per column (\meta{ingred@list}) times 3, then an
+% error is necessary. To continue processing, the class adds the
+% offending item to the last column any way but puts out an error.
+% As noted in the error message, the way around the error is to use
+% |\changeingrdlistnum| command to change the number of ingredients
+% allowed per column.
+% \begin{macrocode}
+ \ifthenelse{\(\value{ingred@cnt}>\value{@tempc}%
+ \or\value{ingred@cnt}=\value{@tempc}\)}{%
+ \setcounter{ingred@cnt}{2}
+ \expandafter\@ta\expandafter=%
+ \expandafter{\the\@listthree \item #1}
+ \@listthree=\@ta}{%
+ \ClassError{recipecard}{More than \the@tempc\space ingredients for
+ one recipe card}{Unfortunately, the card
+ design only allows for three columns of a total of
+ \the@tempc\space ingredients. Hint: change the value of
+ \string\changeingrdlistnum.
+ Congratulations! You have used more ingredients
+ than this Class was designed for.}
+ }
+ }
+ }
+ }
+ %\typeout{ingred@cnt\space\theingred@cnt}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \Finale
+\endinput