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