recettes/cuisine2.sty
2010-08-21 14:18:56 +02:00

356 lines
10 KiB
TeX

%%
%% This is file `cuisine.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% cuisine.dtx
%%
%% IMPORTANT NOTICE:
%%
%% For the copyright see the source file.
%%
%% Any modified versions of this file must be renamed
%% with new filenames distinct from cuisine.sty.
%%
%% For distribution of the original source see the terms
%% for copying and modification in the file cuisine.dtx.
%%
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%
%% Recipe typesetting package `cuisine' by Ben Cohen.
%% cuisine.dtx
%% Copyright 2000 Ben Cohen
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{cuisine}[2000/08/01 v0.5 recipe typesetting]
\RequirePackage{nicefrac}
\newcounter{r@cipenumber}
\DeclareRobustCommand{\ResetRecipeCounter}{%
\setcounter{r@cipenumber}{0}%
}
\newcounter{st@pnumber}[r@cipenumber]
\newcounter{ingr@dnumber}[st@pnumber]
\newif\ifnumb@ring
\newif\ifind@xing
\newif\iffr@eforming
\newif\ifn@wpaging
\newif\ifstepnumb@ring
\newlength{\R@cipeWidth}
\newlength{\R@cipeNumberWidth}
\newlength{\R@cipeTitleWidth}
\newlength{\R@cipeServingsWidth}
\newlength{\R@cipeTandSWidth}
\newlength{\R@cipeOutdent}
\newlength{\R@cipeTitleVerticalAdjustTop}
\newlength{\R@cipeTitleVerticalAdjustBot}
\newlength{\R@cipeIngredientWidth}
\newlength{\R@cipeQuantityWidth}
\newlength{\R@cipeUnitsWidth}
\newlength{\R@cipeQandUWidth}
\newlength{\R@cipeIandUWidth}
\newlength{\R@cipeIQUWidth}
\newlength{\R@cipeMethodWidth}
\newlength{\R@cipeStepWidth}
\DeclareRobustCommand*{\R@cipeMethodWidths}[3]{%
\setlength{\R@cipeIngredientWidth}{#1}%
\setlength{\R@cipeQuantityWidth}{#2}%
\setlength{\R@cipeUnitsWidth}{#3}%
\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}{-\R@cipeNumberWidth}%
\setlength{\R@cipeMethodWidth}{\R@cipeStepWidth}%
\addtolength{\R@cipeMethodWidth}{-\R@cipeIngredientWidth}%
\addtolength{\R@cipeMethodWidth}{-\R@cipeQandUWidth}%
\addtolength{\R@cipeMethodWidth}{-0.5cm}%
\addtolength{\R@cipeIngredientWidth}{-\R@cipeOutdent}
\addtolength{\R@cipeUnitsWidth}{-\R@cipeOutdent}
\addtolength{\R@cipeQandUWidth}{-\R@cipeOutdent}
}%
\DeclareRobustCommand*{\R@cipeTitleWidths}[2]{%
\setlength{\R@cipeNumberWidth}{#1}%
\setlength{\R@cipeServingsWidth}{#2}%
\setlength{\R@cipeTitleWidth}{\R@cipeWidth}%
\addtolength{\R@cipeTitleWidth}{-\R@cipeNumberWidth}%
\addtolength{\R@cipeTitleWidth}{-\R@cipeServingsWidth}%
\setlength{\R@cipeTandSWidth}{\R@cipeServingsWidth}%
\addtolength{\R@cipeTandSWidth}{\R@cipeTitleWidth}%
\R@cipeMethodWidths{\R@cipeIngredientWidth}{\R@cipeQuantityWidth}%
{\R@cipeUnitsWidth}%
}
\DeclareRobustCommand*{\RecipeWidths}[6]{%
\setlength{\R@cipeWidth}{#1}%
\R@cipeTitleWidths{#2}{#3}%
\R@cipeMethodWidths{#4}{#5}{#6}%
}%
\setlength{\R@cipeOutdent}{0.3cm}%
\setlength{\R@cipeTitleVerticalAdjustTop}{-0.25cm}
\setlength{\R@cipeTitleVerticalAdjustBot}{-0.04cm}
\RecipeWidths{\textwidth}{0cm}{3cm}{2.5cm}{1cm}{1.5cm}
\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}
\newsavebox{\st@pingrbox}
\newsavebox{\st@pingrtmpbox}
\newsavebox{\st@pIQUbox}
\newsavebox{\st@pmethodbox}
\DeclareOption{number}{\numb@ringtrue}
\DeclareOption{nonumber}{\numb@ringfalse}
\DeclareOption{index}{\ind@xingtrue}
\DeclareOption{noindex}{\ind@xingfalse}
\DeclareOption{stepnumber}{\stepnumb@ringtrue}
\DeclareOption{nostepnumber}{\stepnumb@ringfalse}
\ExecuteOptions{nonumber,noindex,stepnumber}
\ProcessOptions\relax
\DeclareRobustCommand{\Displ@ySt@p}{%
\stepcounter{st@pnumber}%
\makebox[\R@cipeWidth]{%
\ifstepnumb@ring%
\makebox[\R@cipeNumberWidth][l]{\recipestepnumberfont\arabic{st@pnumber}}%
\else%
\makebox[\R@cipeNumberWidth][l]{}%
\fi%
\usebox{\st@pingrbox}%
\usebox{\st@pmethodbox}%
}%
\savebox{\st@pingrbox}[\R@cipeIQUWidth]{}
}%
\DeclareRobustCommand{\Fr@eFormStep}{%
\usebox{\st@pmethodbox}%
\savebox{\st@pmethodbox}[\R@cipeMethodWidth]{}%
}%
\DeclareRobustCommand{\DisplaySt@p}{%
\iffr@eforming%
\Fr@eFormStep%
\else%
\Displ@ySt@p%
\fi%
\ifn@wpaging%
\recipen@wpage%
\else%
\vskip0.2cm%
\fi%
\n@wpagingfalse%
}%
\DeclareRobustCommand{\r@cipetitle}[3]{
\bigskip
\pagebreak[0]
\mbox{%
\ifnumb@ring%
\makebox[\R@cipeNumberWidth][l]{\recipenumberfont\arabic{r@cipenumber}}%
\parbox[b]{\R@cipeTitleWidth}{\recipetitlefont #1}%
\else%
\parbox[b]{\R@cipeTitleWidth}{\recipetitlefont #1}%
\makebox[\R@cipeNumberWidth]{}%
\fi%
\parbox[b]{\R@cipeServingsWidth}{\hfill\recipeservingsfont #2}%
}\par%
\nopagebreak
\vspace{\R@cipeTitleVerticalAdjustTop}%
\nopagebreak
\rule{\R@cipeWidth}{0.4pt}\par%
\nopagebreak
\vspace{\R@cipeTitleVerticalAdjustBot}%
\nopagebreak
\makebox[\R@cipeWidth][r]{\recipetimefont #3}\par%
\nopagebreak
}%
\def\r@cipesloppy{%
\tolerance 9999%
\emergencystretch 3em%
\hfuzz.5pt%
\vfuzz.5pt%
\hbadness 1500%
}%
\DeclareRobustCommand{\pr@ingred}{%
\endminipage\end{lrbox}%
\ifdim\wd\st@pmethodbox=0in%
\else%
\DisplaySt@p%
\fi%
}%
\DeclareRobustCommand{\p@stingred}{%
\fr@eformingfalse%
\begin{lrbox}{\st@pmethodbox}\minipage[t]{\R@cipeMethodWidth}%
\recipemethodfont%
\noindent%
\ignorespaces%
\r@cipesloppy%
}%
\DeclareRobustCommand{\m@thodend}{%
\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%
\p@stingred%
}%
\DeclareRobustCommand\r@cipen@wpage{\global\n@wpagingtrue\m@thodend}
\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%
\fr@eformingtrue%
\begin{lrbox}{\st@pmethodbox}\minipage[t]{\R@cipeWidth}%
\recipefreeformfont%
\noindent%
\ignorespaces%
\r@cipesloppy%
}%
\DeclareRobustCommand{\conseil}{%
\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%
\fr@eformingtrue%
\begin{lrbox}{\st@pmethodbox}\minipage[t]{\R@cipeWidth}%
\recipefreeformfont%
\paragraph{Conseil :} \hfill \\%
\noindent%
\ignorespaces%
\r@cipesloppy%
}%
\DeclareRobustCommand{\ingr@dient}[3][]{%
\pr@ingred%
\ifx\relax#1\relax%
\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}%
\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{0.2cm}{0cm}%
\rule{\R@cipeOutdent}{0cm}%
\parbox[t]{\R@cipeIngredientWidth}{\raggedright%
\recipeingredientfont%
\setlength{\parindent}{-\R@cipeOutdent}%
\strut #3\strut}%
}%
}%
\else
\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{0.2cm}{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{0.1cm}{0cm}}%
\usebox{\st@pingrtmpbox}%
}%
}%
\fi%
\savebox{\st@pingrtmpbox}[\R@cipeIQUWidth][t]{\usebox{\st@pingrbox}}%
\savebox{\st@pingrbox}[\R@cipeIQUWidth][t]{%
\begin{minipage}[t]{\R@cipeIQUWidth}%
\ifnum\value{ingr@dnumber}>0%
\usebox{\st@pingrtmpbox}\par%
\fi%
\usebox{\st@pIQUbox}\strut%
\end{minipage}%
}%
\stepcounter{ingr@dnumber}%
\p@stingred%
}%
\newenvironment{recipe}[3]{%
\stepcounter{r@cipenumber}
\let\newstep\m@thodend
\let\recipen@wpage\newpage
\let\newpage\r@cipen@wpage
\let\0\d@grees
\let\degrees\d@grees
\let\fr\fr@ction
\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]{}
\ifind@xing
\addcontentsline{toc}{subsection}{#1}
\fi
\r@cipetitle{#1}{#2}{#3}
\vskip0.2cm%
\p@stingred%
}%
{%
\pr@ingred%
\ifnum\value{st@pnumber}=0% then complain!
\PackageWarning{cuisine}{The recipe did not have any steps}%
\fi%
\pagebreak[0]%
\medskip%
\@endpetrue%
}%
\DeclareRobustCommand{\d@grees}{%
${}^\circ$%
}%
\DeclareRobustCommand{\fr@ction}[2]{%
\nicefrac#1#2%
}%
\endinput%
\endinput
%%
%% End of file `cuisine.sty'.