From 27475d0962b08c48ad7b8b994507a7563b7830dc Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 27 Jun 2014 22:02:22 +0000 Subject: cuisine (27jun14) git-svn-id: svn://tug.org/texlive/trunk@34453 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/cuisine/cuisine.sty | 182 ++++++++++++++++++------ 1 file changed, 136 insertions(+), 46 deletions(-) (limited to 'Master/texmf-dist/tex/latex/cuisine') diff --git a/Master/texmf-dist/tex/latex/cuisine/cuisine.sty b/Master/texmf-dist/tex/latex/cuisine/cuisine.sty index e7cf8a8a35a..68f32fd7cb6 100644 --- a/Master/texmf-dist/tex/latex/cuisine/cuisine.sty +++ b/Master/texmf-dist/tex/latex/cuisine/cuisine.sty @@ -23,9 +23,9 @@ %% %% Recipe typesetting package `cuisine' by Ben Cohen. %% cuisine.dtx -%% Copyright 2000 Ben Cohen +%% Copyright 2000-2002, 2014 Ben Cohen \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{cuisine}[2000/08/01 v0.5 recipe typesetting] +\ProvidesPackage{cuisine}[2014/06/26 v0.7 recipe typesetting] \RequirePackage{nicefrac} \newcounter{r@cipenumber} \DeclareRobustCommand{\ResetRecipeCounter}{% @@ -34,6 +34,7 @@ \newcounter{st@pnumber}[r@cipenumber] \newcounter{ingr@dnumber}[st@pnumber] \newif\ifnumb@ring +\newif\ifc@ntentsing \newif\ifind@xing \newif\iffr@eforming \newif\ifn@wpaging @@ -43,6 +44,8 @@ \newlength{\R@cipeServingsWidth} \newlength{\R@cipeTandSWidth} \newlength{\R@cipeOutdent} +\newlength{\R@cipeIngQUSpace} +\newlength{\R@cipeIngUISpace} \newlength{\R@cipeTitleVerticalAdjustTop} \newlength{\R@cipeTitleVerticalAdjustBot} \newlength{\R@cipeIngredientWidth} @@ -51,12 +54,15 @@ \newlength{\R@cipeQandUWidth} \newlength{\R@cipeIandUWidth} \newlength{\R@cipeIQUWidth} +\newlength{\R@cipeSingleIngWidth} \newlength{\R@cipeMethodWidth} +\newlength{\St@pNumberWidth} \newlength{\R@cipeStepWidth} -\DeclareRobustCommand*{\R@cipeMethodWidths}[3]{% - \setlength{\R@cipeIngredientWidth}{#1}% - \setlength{\R@cipeQuantityWidth}{#2}% - \setlength{\R@cipeUnitsWidth}{#3}% +\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}% @@ -65,35 +71,37 @@ \setlength{\R@cipeIandUWidth}{\R@cipeIQUWidth}% \addtolength{\R@cipeIandUWidth}{-\R@cipeQuantityWidth}% \setlength{\R@cipeStepWidth}{\R@cipeWidth}% - \addtolength{\R@cipeStepWidth}{-\R@cipeNumberWidth}% + \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}% \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} }% -\DeclareRobustCommand*{\R@cipeTitleWidths}[2]{% - \setlength{\R@cipeNumberWidth}{#1}% - \setlength{\R@cipeServingsWidth}{#2}% +\DeclareRobustCommand*{\R@cipeTitleWidths}[1]{% + \setlength{\R@cipeServingsWidth}{#1}% \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}% + \R@cipeTitleWidths{#2}% + \R@cipeMethodWidths{#3}{#4}{#5}{#6}% }% \setlength{\R@cipeOutdent}{0.3cm}% +\setlength{\R@cipeIngQUSpace}{0.1cm}% +\setlength{\R@cipeIngUISpace}{0.2cm}% \setlength{\R@cipeTitleVerticalAdjustTop}{-0.25cm} -\setlength{\R@cipeTitleVerticalAdjustBot}{-0.04cm} -\RecipeWidths{\textwidth}{0.8cm}{3cm}{3.5cm}{1cm}{1.7cm} +\setlength{\R@cipeTitleVerticalAdjustBot}{-0.25cm} +\RecipeWidths{\textwidth}{3cm}{0.8cm}{3.5cm}{1cm}{1.7cm} \newcommand*\recipefont{\normalfont} \newcommand*\recipetitlefont{\recipefont} \newcommand*\recipenumberfont{\recipefont} @@ -107,18 +115,21 @@ \newcommand*\recipefreeformfont{\recipefont} \newsavebox{\st@pingrbox} \newsavebox{\st@pingrtmpbox} +\newsavebox{\titl@tmpbox} \newsavebox{\st@pIQUbox} \newsavebox{\st@pmethodbox} \DeclareOption{number}{\numb@ringtrue} \DeclareOption{nonumber}{\numb@ringfalse} +\DeclareOption{contents}{\c@ntentsingtrue} +\DeclareOption{nocontents}{\c@ntentsingfalse} \DeclareOption{index}{\ind@xingtrue} \DeclareOption{noindex}{\ind@xingfalse} -\ExecuteOptions{number,noindex} +\ExecuteOptions{number,noindex,nocontents} \ProcessOptions\relax \DeclareRobustCommand{\Displ@ySt@p}{% \stepcounter{st@pnumber}% \makebox[\R@cipeWidth]{% - \makebox[\R@cipeNumberWidth][l]{\recipestepnumberfont\arabic{st@pnumber}}% + \makebox[\St@pNumberWidth][l]{\recipestepnumberfont\arabic{st@pnumber}}% \usebox{\st@pingrbox}% \usebox{\st@pmethodbox}% }% @@ -141,28 +152,58 @@ \fi% \n@wpagingfalse% }% -\DeclareRobustCommand{\r@cipetitle}[3]{ - - \bigskip - \pagebreak[0] +\DeclareRobustCommand{\r@cipetitle}[3]{% \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}% + \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% +%% \nopagebreak +%% \vspace{\R@cipeTitleVerticalAdjustTop}% \nopagebreak - \vspace{\R@cipeTitleVerticalAdjustTop}% - \nopagebreak - \rule{\R@cipeWidth}{0.4pt}\par% + \rule[-\R@cipeTitleVerticalAdjustTop]{\R@cipeWidth}{0.4pt}\par% \nopagebreak - \vspace{\R@cipeTitleVerticalAdjustBot}% + \vskip\R@cipeTitleVerticalAdjustBot% +%% \vspace{\R@cipeTitleVerticalAdjustBot}% \nopagebreak - \makebox[\R@cipeWidth][r]{\recipetimefont #3}\par% + \ifx\relax#3\relax% + \else + \makebox[\R@cipeWidth][r]{\recipetimefont #3}\par% + \fi \nopagebreak }% \def\r@cipesloppy{% @@ -237,7 +278,7 @@ \strut #2\hfill\strut% \fi% }% - \rule{0.2cm}{0cm}% + \rule{\R@cipeIngUISpace}{0cm}% \rule{\R@cipeOutdent}{0cm}% \parbox[t]{\R@cipeIngredientWidth}{\raggedright% \recipeingredientfont% @@ -255,7 +296,7 @@ \setlength{\parindent}{-\R@cipeOutdent}% \rule{0pt}{\baselineskip}% \strut #2\strut\hfill}% - \rule{0.2cm}{0cm}% + \rule{\R@cipeIngUISpace}{0cm}% \rule{\R@cipeOutdent}{0cm}% \parbox[t]{\R@cipeIngredientWidth}{% \raggedright\recipeingredientfont% @@ -270,7 +311,7 @@ \hfill % \raggedright\recipequantityfont% \strut #1\strut% - \rule{0.1cm}{0cm}}% + \rule{\R@cipeIngQUSpace}{0cm}}% \usebox{\st@pingrtmpbox}% }% }% @@ -278,34 +319,80 @@ \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% - \usebox{\st@pIQUbox}\strut% \end{minipage}% }% \stepcounter{ingr@dnumber}% \p@stingred% }% -\newenvironment{recipe}[3]{% - \stepcounter{r@cipenumber} +\DeclareRobustCommand{\Ingr@dient}[1]{% + \pr@ingred% + \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}% + }% + }% + \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}% + }% + \stepcounter{ingr@dnumber}% + \p@stingred% +}% +\newenvironment{recipe}[4][]{% + \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]{} - \ifind@xing - \addcontentsline{toc}{subsection}{#1} - \fi - \r@cipetitle{#1}{#2}{#3} + + \bigskip\medskip + \pagebreak[0] + \parskip0pt% + \ifc@ntentsing% + \addcontentsline{toc}{subsection}{#2}% + \fi% + \ifind@xing% + \index{#2 (\arabic{r@cipenumber})}% + \fi% + \nopagebreak% + \r@cipetitle{#2}{#3}{#4} \vskip0.2cm% \p@stingred% }% @@ -322,6 +409,9 @@ \DeclareRobustCommand{\d@grees}{% ${}^\circ$% }% +\DeclareRobustCommand{\tim@s}{% + \relax${}\times{}$\relax% +}% \DeclareRobustCommand{\fr@ction}[2]{% \nicefrac#1#2% }% -- cgit v1.2.3