1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- \ProvidesPackage{recipe}[2020/01/30 Recipe Typesetting for OpenCookbook]
- \ProcessOptions\relax
- \RequirePackage{etoolbox}
- \RequirePackage{nicefrac}
- \RequirePackage{booktabs}
- \RequirePackage{changepage}
- \RequirePackage{xspace}
- \newcommand\half{\nicefrac{1}{2}\xspace}
- \newcommand\quarter{\nicefrac{1}{4}\xspace}
- \newcommand\third{\nicefrac{1}{3}\xspace}
- \newcommand\twothirds{\nicefrac{2}{3}\xspace}
- \newcommand\threequarters{\nicefrac{3}{4}\xspace}
- \newcommand\recipe@ingredient[2]{#1 & #2 \\}
- \newcommand\recipe@serving[1]{\ifblank{#1}{}{\textit{#1 servings}}}
- \newcommand\recipe@contributor[1]{\ifblank{#1}{}{Courtesy of #1}}
- \newcommand\recipe@majorstep[1]{\par\smallskip\textbf{#1}\par}
- \newenvironment{recipe}[3]{%
- \bigskip%
- \begin{adjustwidth}{4em}{4em}%
- \let\majorstep=\recipe@majorstep
- \centerline{\textbf{#1}}%
- \recipe@contributor{#2}\hfill\recipe@serving{#3}\\
- \smallskip%
- \newenvironment{note}{\textit{Note:}}{}
- \newenvironment{ingredients}{%
- \smallskip%
- \begin{center}%
- \let\ingredient=\recipe@ingredient
- \begin{tabular}{lr}
- \toprule%
- }{%
- \bottomrule%
- \end{tabular}%
- \end{center}%
- \smallskip%
- }%
- }{%
- \end{adjustwidth}%
- \bigskip%
- }
- \endinput
|