2024-08-08 12:24:57 -05:00
\documentclass { article}
\usepackage { fancyhdr,wrapfig,xcolor,graphicx,xparse,lmodern,cooking-units}
\renewcommand * \familydefault { \sfdefault } % Force the sans-serif version of any font used
\usepackage [%
papersize={ 5.5in,8.5in} ,
2024-08-16 23:28:14 -05:00
margin=0.6in,
2024-08-08 12:24:57 -05:00
top=0.75in,
bottom=0.75in
]{ geometry}
2024-08-14 19:07:16 -05:00
\usepackage [%
unicode=true,
bookmarks=true,
bookmarksnumbered=false,
bookmarksopen=false,
breaklinks=false,
pdfborder={ 0 0 1} ,
backref=section,
colorlinks=false
2024-08-15 20:05:27 -05:00
]{ hyperref}
2024-08-08 12:24:57 -05:00
2024-08-16 23:28:14 -05:00
2024-08-14 22:20:50 -05:00
% have to define a cup cause the cooking-units writer is german and doesn't understand the flawed american way to measure ingredients.
2024-08-08 12:24:57 -05:00
\declarecookingunit { cup}
\cudefinename { English}
{
{ cup} { cup} [cups]
2024-08-15 20:05:27 -05:00
{ oz} { ounce} [ounces] % lol, the plural isn't right
2024-08-08 12:24:57 -05:00
}
2024-08-19 22:58:34 -05:00
\cuaddtokeychain
{
{ ml} { 240} % this unit already exists
{ cup} { 1} % 1 (US Legal) cup is 240ml. We're not converting to oz cause that would require implementing fluid ounces, which is outside the scope of this project. Maybe I'll do good on making a PR for the package.
}
2024-08-23 23:23:08 -05:00
\cuaddtokeychain
{
{ ml} { 30}
{ oz} { 1}
}
2024-08-19 22:58:34 -05:00
\cuaddtounitgroup { volume} { cup}
2024-08-14 19:07:16 -05:00
\cusetup { use-phrases=true}
2024-08-23 23:23:08 -05:00
\cusetoptionfor { g,ml} { round-precision=0} % rounds grams to whole numbers, I don't care *that* much
2024-08-08 12:24:57 -05:00
2024-08-14 22:20:50 -05:00
% Removing the numbers from the sections & sub-sections
\setcounter { secnumdepth} { 0}
2024-08-08 12:24:57 -05:00
\newcounter { stepnum}
\makeatletter
2024-08-14 22:20:50 -05:00
\def \plus { \texttt { +} \hspace { .3em} }
\def \minus { \texttt { -} \hspace { .3em} }
2024-08-08 12:24:57 -05:00
%% From Donald Arseneau. Add after the wrapping text. Whew!
\def \wrapfill { % Just glad it works.
2024-09-20 15:27:15 -05:00
\par
\ifx \parshape \WF @fudgeparshape
\nobreak
\ifnum \c @WF@wrappedlines>\@ ne
\advance \c @WF@wrappedlines\m @ne
\vskip \c @WF@wrappedlines\baselineskip
\global \c @WF@wrappedlines\z @
\fi
\allowbreak
\WF @finale
\fi
2024-08-08 12:24:57 -05:00
}
%% Used for the headnote and in \showit
%% If the text is small it is placed on one line;
%% otherwise it is put into a raggedright paragraph.
\long \def \testoneline #1{ %
\sbox \@ tempboxa{ #1} %
\ifdim \wd \@ tempboxa <0.75\linewidth
\begingroup
\itshape
#1\par
\endgroup
\else
\parbox { 0.75\linewidth } { \raggedright \itshape #1} %
\par
\fi
}
2024-09-20 15:27:15 -05:00
\title { Recipes}
\author { David \& Alissa Daily}
\date { \tiny { last updated \today } }
2024-08-08 12:24:57 -05:00
%% Borrowed from book.cls
2024-08-15 20:05:27 -05:00
\newif \if @mainmatter \@ mainmattertrue
2024-08-08 12:24:57 -05:00
\newcommand \frontmatter { %
\cleardoublepage
\@ mainmatterfalse
\pagenumbering { roman}
2024-08-15 20:05:27 -05:00
\tableofcontents
\section * { Legend}
Vegetarian: \vegetarian \\
Gluten Free: \glutenfree \\
Freeze: \freeze \\
2024-08-19 22:58:34 -05:00
%Dessert: \dessert \\ why would you need a Dessert tag if there's a section for it???
2024-08-16 23:28:14 -05:00
Meal Prep: \mealprep
2024-08-15 20:05:27 -05:00
}
2024-08-08 12:24:57 -05:00
\newcommand \mainmatter { %
\cleardoublepage
\@ mainmattertrue
\pagenumbering { arabic} }
\makeatother
%% Vary the colors at will
\definecolor { vegcolor} { rgb} { 0,0.5,0.2}
\colorlet { gfcolor} { brown}
\definecolor { frzcolor} { rgb} { 0,0.8,0.8}
\definecolor { dessertcolor} { rgb} { 0.5,0.2,0.1}
2024-08-16 23:28:14 -05:00
\definecolor { mealprepcolor} { rgb} { 0.5,0.5,0.6}
2024-08-08 12:24:57 -05:00
%% Thanks to alephzero for the excellent start:
2024-09-20 15:27:15 -05:00
%% #1 [optional headnote]; #2 Title of recipe; #3 [optional initial instructions]
2024-08-08 12:24:57 -05:00
\NewDocumentCommand { \recipe } { o m o} { %
\setcounter { stepnum} { 0} %
\newpage
\thispagestyle { fancy}
\lhead { } %
\chead { } %
\rhead { } %
\lfoot { } %
\rfoot { } %
2024-08-14 22:20:50 -05:00
\subsection { #2} %
2024-08-08 12:24:57 -05:00
\IfNoValueF { #1} { \begin { center} \testoneline { #1} \end { center} }
\IfNoValueF { #3} { \noindent \emph { #3} \par \medskip }
}
2024-08-15 13:48:30 -05:00
2024-08-08 12:24:57 -05:00
\newcommand { \serves } [2][Serves]{ %
\chead { #1 #2} }
\newcommand { \dishtype } [1]{ %
\rhead { #1} %
}
\newcommand { \dishother } [1]{ %
\lhead { #1} %
}
\newcommand { \vegetarian } { %
{ \large \color { vegcolor} \textbf { V} } %
}
\newcommand { \glutenfree } { %
{ \large \color { gfcolor} \textbf { GF} } %
}
\newcommand { \freeze } { %
{ \large \color { frzcolor} \textbf { F} } %
}
\newcommand { \dessert } { %
{ \large \color { dessertcolor} \textbf { D} } %
}
2024-08-16 23:28:14 -05:00
\newcommand { \mealprep } { %
{ \large \color { mealprepcolor} \textbf { MP} } %
2024-08-08 12:24:57 -05:00
}
2024-08-15 20:05:27 -05:00
2024-08-08 12:24:57 -05:00
%% Optional arguments for alternate names for these:
\newcommand { \preptime } [2][Prep time]{ %
\lfoot { #1: #2} %
}
\newcommand { \cooktime } [2][Cook time]{ %
\rfoot { #1: #2} %
}
%% Optional argument is the width of the graphic, default = 1in
\newcommand { \showpic } [3][1in]{ %
\begin { center}
\bigskip
\includegraphics [width=#1] { #2} %
\par
\medskip
\testoneline { #3} %
\par
\end { center} %
}
\NewDocumentEnvironment { step} { } { %
\parindent 0pt
\leftskip 0pt
\begin { minipage} { \textwidth }
\begin { wrapfigure} { r} { 0pt}
\kern -0.5em
\vrule width 1pt\enskip
\begin { minipage} { 0.5\textwidth }
\leftskip =1.5em
\parindent =-1.5em
\parskip =0.25em
\obeylines
} { %
\wrapfill
\end { minipage}
\medskip
}
\NewDocumentCommand { \method } { } { %
\end { minipage}
\end { wrapfigure}
\rightskip 0pt plus 2em
\parskip 0.25em
\everypar ={ \llap { \stepcounter { stepnum} \hbox to 1.5em{ \thestepnum .\hfill } } }
}
\pagestyle { plain}
\setlength { \intextsep } { 0pt}
2024-08-15 13:48:30 -05:00
% Different layout for Drinks that adds an hline at the end of a recipe, no serving amounts, no prep/cook time, no letters in the corner
%% #1 [optional headnote]; #2 Title of recipe; #3 [Initial instructions]
\NewDocumentCommand { \drink } { o m o} { %
\setcounter { stepnum} { 0} %
\thispagestyle { fancy}
\lhead { } %
\chead { } %
\rhead { } %
\lfoot { } %
\rfoot { } %
2024-08-15 20:05:27 -05:00
\renewcommand { \headrulewidth } { 0pt}
2024-08-15 13:48:30 -05:00
\subsection { #2} %
\IfNoValueF { #1} { \begin { center} \testoneline { #1} \end { center} }
\IfNoValueF { #3} { \noindent \emph { #3} \par \medskip }
}
\NewDocumentCommand { \drinkspace } { } { %
\par
\bigskip
\filbreak
\hrulefill
\smallskip
}
\NewDocumentEnvironment { drstep} { } { %
\parindent 0pt
\leftskip 0pt
\begin { minipage} { \textwidth }
\begin { wrapfigure} { r} { 0pt}
\kern -0.5em
\vrule width 1pt\enskip
\begin { minipage} { 0.5\textwidth }
\leftskip =1.5em
\parindent =-1.5em
\parskip =0.25em
\obeylines
} { %
\wrapfill
\end { minipage}
\medskip
}
\NewDocumentCommand { \drmethod } { } { %
\end { minipage}
\end { wrapfigure}
\rightskip 0pt plus 2em
\parskip 0.25em
\everypar ={ \llap { \stepcounter { stepnum} \hbox to 1.5em{ \thestepnum .\hfill } } }
}
2024-08-08 12:24:57 -05:00
\begin { document}
\fontfamily { lmss} \selectfont
2024-08-15 20:05:27 -05:00
\pagenumbering { gobble}
\maketitle
2024-08-08 12:24:57 -05:00
\frontmatter
\mainmatter
\input { orderedrecipes.tex}
\end { document}