\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}, % replace whole line with just "a5paper," to switch to A5 margin=15mm, top=20mm, bottom=20mm ]{geometry} \usepackage[% unicode=true, bookmarks=true, bookmarksnumbered=false, bookmarksopen=false, breaklinks=false, pdfborder={0 0 1}, backref=section, colorlinks=false ]{hyperref} % have to define a cup cause the cooking-units writer is german and doesn't understand the flawed american way to measure ingredients. \declarecookingunit{cup} \cudefinename {English} { {cup} {cup}[cups] {oz} {ounce}[ounces] % lol, the plural isn't right } \cuaddtokeychain { {ml} {240} % this unit already exists {cup} {1} % 1 (US Legal) cup is 240ml. We're not doing ounces cause that would require implementing fluid ounces and all sorts of stupid stuff, which is outside the scope of this project. Maybe I'll do good on making a PR for the package. } \cuaddtounitgroup{volume}{cup} \cusetup{use-phrases=true} \cusetoptionfor{g,ml}{round-precision=0} % rounds grams to whole numbers, I don't care *that* much % Removing the numbers from the sections & sub-sections \setcounter{secnumdepth}{0} \newcounter{stepnum} \makeatletter \def\plus{\texttt{+}\hspace{.3em}} \def\minus{\texttt{-}\hspace{.3em}} %% From Donald Arseneau. Add after the wrapping text. Whew! \def\wrapfill{% Just glad it works. \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 } %% 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 } \title{Recipes} \author{David \& Alissa Daily} \date{\tiny{last updated \today}} %% Borrowed from book.cls \newif\if@mainmatter \@mainmattertrue \newcommand\frontmatter{% \cleardoublepage \@mainmatterfalse \pagenumbering{roman} \tableofcontents \section*{Legend} Vegetarian: \vegetarian \\ Gluten Free: \glutenfree \\ Freeze: \freeze \\ %Dessert: \dessert \\ removing these from the code below is too big of a hassle, so I'mma just leave them for later use %Meal Prep: \mealprep made this a section instead } \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} \definecolor{mealprepcolor}{rgb}{0.5,0.5,0.6} %% Thanks to alephzero for the excellent start: %% #1 [optional headnote]; #2 Title of recipe; #3 [optional initial instructions] \NewDocumentCommand{\recipe}{o m o}{% \setcounter{stepnum}{0}% \newpage \thispagestyle{fancy} \lhead{}% \chead{}% \rhead{}% \lfoot{}% \rfoot{}% \subsection{#2}% \IfNoValueF{#1}{\begin{center}\testoneline{#1}\end{center}} \IfNoValueF{#3}{\noindent\emph{#3}\par\medskip} } \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}}% } \newcommand{\mealprep}{% {\large\color{mealprepcolor}\textbf{MP}}% } %% 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}{}{% \parindent0pt \leftskip0pt \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} \rightskip0pt plus 2em \parskip0.25em \everypar={\llap{\stepcounter{stepnum}\hbox to 1.5em{\thestepnum.\hfill}}} } \pagestyle{plain} \setlength{\intextsep}{0pt} % 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{}% \renewcommand{\headrulewidth}{0pt} \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}{}{% \parindent0pt \leftskip0pt \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} \rightskip0pt plus 2em \parskip0.25em \everypar={\llap{\stepcounter{stepnum}\hbox to 1.5em{\thestepnum.\hfill}}} } \begin{document} \fontfamily{lmss}\selectfont \pagenumbering{gobble} \maketitle \frontmatter \mainmatter \input{orderedrecipes.tex} \end{document}