cookbook/recipe.cls

70 lines
1.5 KiB
TeX

%
% Copyright 2016 (c) Anna Schumaker.
%
\ProvidesClass{recipe}
\LoadClass[letterpaper]{letter}
\RequirePackage[top=1in,bottom=1in,left=1in,right=1in]{geometry}
\RequirePackage{multicol}
\RequirePackage{newcent}
\RequirePackage{ragged2e}
\pagestyle{empty}
% Macros for setting recipe variables
\newcommand{\recipeName}[1] {\def\recipe@name{#1}}
\newcommand{\recipeServes}[1] {\def\recipe@serves{#1}}
\newcommand{\recipeServingSize}[1] {\def\recipe@servingsize{#1}}
% Preformatted fractions
\newcommand{\half} {\(\mathbf{\frac{1}{2}}\)\ }
\newcommand{\quarter} {\(\mathbf{\frac{1}{4}}\)\ }
\newcommand{\eighth} {\(\mathbf{\frac{1}{8}}\)\ }
\newcommand{\section}[1]
{
\hfill\flushleft{\Large{\textbf{#1:}}}
}
% Extend the \begin{document} command
\AtBeginDocument
{
\centering{
\Huge{\textbf{\recipe@name}} \\
\LARGE{\em{Serves: \textbf{\recipe@serves}, %
serving size: \textbf{\recipe@servingsize}}}
} \\
}
% Add an environment and commands for ingredients
\newenvironment{ingredients}
{
\section{Ingredients}
\begin{multicols}{2}
\begin{itemize}
}
{
\end{itemize}
\end{multicols}
}
\newcommand{\addIngredient}[2] {\large{\item{\textbf{#1} #2}}}
\newcommand{\addIngredientName}[1] {\large{\item{#1}}}
% Add an environment and commands for steps
\newenvironment{steps}
{
\section{Steps}
\begin{enumerate}
\setlength\itemsep{1em}
}
{
\end{enumerate}
}
\newcommand{\addStep}[1] {\large{\item{#1}}}
\newcommand{\ingredient}[1] {\underline{\smash{#1}}}