# An Aesthetically Pleasing Recipe Book Template

I have been trying to create a good looking recipe book for a while using ShareLaTeX. I have tried using cookybooky and cuisine packages but I don't seem to be able to get them to work. I want each page to have:

1. The title of the recipe and to have that title placed in the contents page.
2. Symbols to denote:

(a) whether or not the meal is freezable;

(b) whether or not it is vegetarian;

(c) how long it takes to make (preparation and cooking time);

(d) how many people it serves.

3. The ingredient list to

(a) have its own subtitle;

(b) have the option for a subsubtitle for things like marinades etc;

(c) be arranged as: number measurement ingredient (preparation).

4. The instructions (again with its own subtitle) with the option to put "Preheat the oven to x degrees" between "Instructions" and the first instruction.

5. The option to add an image to each recipe of the same size in the same place.

At the moment, a typical recipe looks like this:

I am mostly happy with the way it looks (although some colour might be nice). However, I have done it all 'by hand' so it is a lot of work to ensure all the recipes have the same formatting.

Is it possible to make such a template?

My code for the above recipe:

\newpage
\section{Raspberry Chocolate Tiramisu}
\lhead{}\chead{Serves 4}\rhead{V}
\lfoot{Prep time:}\rfoot{Cook time:}
\begin{multicols}{2}
{\Large Instructions}
\begin{itemize}
\item 100ml Double Strength Coffee
\item 400g Raspberries (blitzed)
\item 200g Mascarpone
\item 2 tbsp Sweetener
\item 1 tsp Vanilla Extract
\item 700g Vanilla Yogurt
\item 15g Dark Chocolate (finely grated)
\end{itemize}
\columnbreak
\textit{For the Crumble Mixture}:
\begin{itemize}
\item 80g Wholemeal Flour
\item 80g Plain Flour
\item 80g Butter (diced)
\item 70g Demerara Sugar
\end{itemize}
\end{multicols}
{\Large Instructions}\\
Preheat the over to Gas Mark 4, Electric $180^\circ$C, Fan $160^\circ$C.
\begin{enumerate}
\item Stir the two kinds of flour together in a bowl, add the butter and rub it into the flour. When the mixture looks like breadcrumbs, mix in the brown sugar. Lay the mixture on a shallow baking tray and bake for 25-30 minutes until golden brown. Leave on the side to cool.
\item Mix together the mascarpone, sweetener, vanilla extract, and three quarters of the chocolate. Put half the crumble mixture in each of the glasses and pour over half the quark mixture along with half the raspberries.
\item Put the other half of the crumble mixture on top, followed by the remaining quark mixture and raspberries. Sprinkle over the last of the chocolate. Chill for 3 hours before serving.
\end{enumerate}

• Could you share your code, so we try to see how it can be improved? – Bernard Apr 23 '17 at 13:47
• To sum it up, you got all the ingredients now, but don't know how to write the recipe to make it look the same next time. – Johannes_B Apr 23 '17 at 14:03
• Related/duplicate A cookbook in LaTeX?. – Alan Munn Apr 23 '17 at 17:03
• As historical interest/curiosity, you may like to see how Knuth made a recipe book. – ShreevatsaR Apr 23 '17 at 22:18

## 2 Answers

The first step I would take would be to define some macros to capture the semantics of your recipe, instead of the LateX syntax.

After you have done that, you can start to tweak the format of each semantic item (applying color, etc) independently of editing the content of the recipes.

This isn't complete (and in any case, I don't know exactly what you want the book to look like!) but it runs, and gives the basic idea.

\documentclass{article}
\usepackage{fancyhdr}
\usepackage{multicol}

% Your "recipes.sty" package starts here:
\newcommand{\recipe}{%
\newpage\lhead{}\chead{}\rhead{}\lfoot{}\rfoot{}\section}
\newcommand{\serves}[1]{%
\chead{Serves #1}}
\newcommand{\vegetarian}{%
\rhead{V}}
\newcommand{\preptime}[1]{%
\lfoot{Prep time: #1}}
\newcommand{\cooktime}[1]{%
\rfoot{Cook time: #1}}
\newcommand{\ingredients}[1][\Large\emph{Ingredients}]{%
\emph{#1}\\}
\newcommand{\instructions}[1][\Large\emph{Instructions}]{%
\emph{#1}\\}
\newcommand{\temp}[1]{%
$#1^\circ$C}

\pagestyle{fancy}
% End of "recipes.sty"

\begin{document}
\recipe{Raspberry Chocolate Tiramisu}
\serves{4}
\vegetarian

\begin{multicols}{2}
\ingredients
\begin{itemize}
\item 100ml Double Strength Coffee
\item 400g Raspberries (blitzed)
\item 200g Mascarpone
\item 2 tbsp Sweetener
\item 1 tsp Vanilla Extract
\item 700g Vanilla Yogurt
\item 15g Dark Chocolate (finely grated)
\end{itemize}
\columnbreak
\ingredients[For the Crumble Mixture:]
\begin{itemize}
\item 80g Wholemeal Flour
\item 80g Plain Flour
\item 80g Butter (diced)
\item 70g Demerara Sugar
\end{itemize}
\end{multicols}

\instructions
Preheat the over to Gas Mark 4, Electric \temp{180}, Fan \temp{160}.
\begin{enumerate}
\item Stir the two kinds of flour together in a bowl, add the butter and rub it into the flour. When the mixture looks like breadcrumbs, mix in the brown sugar. Lay the mixture on a shallow baking tray and bake for 25--30 minutes until golden brown. Leave on the side to cool.
\item Mix together the mascarpone, sweetener, vanilla extract, and three quarters of the chocolate. Put half the crumble mixture in each of the glasses and pour over half the quark mixture along with half the raspberries.
\item Put the other half of the crumble mixture on top, followed by the remaining quark mixture and raspberries. Sprinkle over the last of the chocolate. Chill for 3 hours before serving.
\end{enumerate}

\end{document}


Note the way the \instructions and \ingredients macros have optional arguments. With no argument, they automatically create the default text "Instructions" and "Ingredients". With an argument in square brackets, you can overwrite that, as in "For the Crumble Mixture:", etc.

• Would be nice to post one or two examples outputs. – Dr. Manuel Kuehner Apr 23 '17 at 14:33
• @Dr.ManuelKuehner The output from the example looks fairly ugly, since we don't know what packages and fonts the OP was using - but it's easy to cut-and-paste it and run it. – alephzero Apr 23 '17 at 14:39

Thanks to @alephzero for making this a real LaTeX project. That is to say, concentrating on the semantics of the recipe as opposed to LaTeX markup.

To that end, I prefer clean and uncluttered input and output. I have used \obeylines to emulate list environments without their attendant markup. I have also used a bit of color to indicate some possibilities. I have included comments in my very simple code which should show the way. Computer Modern would not be my choice, but I don't know what your TeXing environment is so did not want to make any untoward assumptions. I would keep ornamentation at a minimum (rules and such) to assist in making the presentation of the recipe as clear as possible. Bon appetit.

Later:

I have supplied some missing %. In addition I have supplied the possibility of a headnote as an optional argument to \recipe. In addition, for my own benefit, I have enlisted the aid of geometry.sty to produce 5.5in-by-8.5in output. That, of course, can be changed to suit.

Still later:

I should also point out that this creates a TOC using \frontmatter and \backmatter from book.cls. Kind of like peanuts: you can't eat just one...

\documentclass{article}
\usepackage{fancyhdr}
\usepackage{multicol}
\usepackage[%
%a5paper,
papersize={5.5in,8.5in},
margin=0.75in,
top=0.75in,
bottom=0.75in,
%twoside
]{geometry}

\usepackage{xcolor}
\usepackage{graphicx}

\raggedcolumns
\setlength{\multicolsep}{0pt}
\setlength{\columnseprule}{1pt}

\makeatletter

\newif\if@mainmatter \@mainmattertrue

%% Borrowed from book.cls
\newcommand\frontmatter{%
\cleardoublepage
\@mainmatterfalse
\pagenumbering{roman}}
\newcommand\mainmatter{%
\cleardoublepage
\@mainmattertrue
\pagenumbering{arabic}}
\makeatother

%% Vary the colors at will

\definecolor{vegcolor}{rgb}{0,0.5,0.2}
\definecolor{frzcolor}{rgb}{0,0,1}

% Your "recipes.sty" package starts here:
%% Thanks to alephzero for the excellent start:

\newcommand{\recipe}[2][]{%
\newpage
\lhead{}%
\chead{}%
\rhead{}%
\lfoot{}%
\rfoot{}%
\section{#2}%
\if###1##%
\else
\begin{center}
\parbox{0.75\linewidth}{\raggedright\itshape#1}%
\end{center}
\fi
}
\newcommand{\serves}[2][Serves]{%
\chead{#1 #2}}
\newcommand{\vegetarian}{%
\rhead{\large\color{vegcolor}\textbf{V}}}
\newcommand{\freeze}{%
\lhead{\large\color{frzcolor}\textbf{F}}}
%% Optional arguments for alternate names for these:
\newcommand{\preptime}[2][Prep time]{%
\lfoot{#1: #2}%
}
\newcommand{\cooktime}[2][Cook time]{%
\rfoot{#1: #2}%
}
\newcommand{\temp}[1]{%
$#1^\circ$C}
%% Optional argument is the width of the graphic, default = 1in
\newcommand{\showit}[3][1in]{%
\begin{center}
\bigskip
\includegraphics[width=#1]{#2}%
\par
\medskip
\emph{#3}
\par
\end{center}%
}

%% Optional argument for a  heading within the ingredients section
\newcommand{\ingredients}[1][]{%
\if###1##%
{\color{red}\Large\textbf{Ingredients}}%
\else
\emph{#1}%
\fi
}

%% Use \obeylines to minimize markup
\newenvironment{ingreds}{%
\parindent0pt
\noindent
\ingredients
\par
\smallskip
\begin{multicols}{2}
\leftskip1em
\rightskip0pt plus 3em
\parskip=0.25em
\obeylines
\everypar={\hangindent2em}
}{%
\end{multicols}%
\medskip
}

\newcounter{stepnum}

%% Optional argument for an italicized pre-step
%% Also use obeylines to minimize markup here as well
\newenvironment{method}[1][]{%
\setcounter{stepnum}{0}
\noindent
{\color{red}\Large\textbf{Instructions}}%
\par
\smallskip
\if###1##%
\else
\noindent
\emph{#1}
\par
\fi
\begingroup
\parindent0pt
\parskip0.25em
\leftskip2em
\everypar={\llap{\stepcounter{stepnum}\hbox to2em{\thestepnum.\hfill}}}
}{%
\par
\endgroup}

\pagestyle{fancy}
% End of "recipes.sty"

\begin{document}

\frontmatter
\tableofcontents

\mainmatter

\recipe[This is a simple headnote that describes the product for the user. A simple but elegant dessert.]{Raspberry Chocolate Tiramisu}
\serves{4}
\preptime{1 hour}
\cooktime[Chill time]{11/2 hours}
\vegetarian
\freeze
\begin{ingreds}
100ml Double Strength Coffee
400g Raspberries (blitzed)
200g Mascarpone
2 tbsp Sweetener
1 tsp Vanilla Extract
700g Vanilla Yogurt
15g Dark Chocolate (finely grated) and a really long one
\columnbreak
\ingredients[For the Crumble Mixture:]
80g Wholemeal Flour
80g Plain Flour
80g Butter (diced)
70g Demerara Sugar
\end{ingreds}

\begin{method}[Preheat the oven to Gas Mark 4, Electric \temp{180}, Fan \temp{160}.]
Stir the two kinds of flour together in a bowl, add the butter and rub it into the flour. When the mixture looks like breadcrumbs, mix in the brown sugar. Lay the mixture on a shallow baking tray and bake for 25--30 minutes until golden brown. Leave on the side to cool.

Mix together the mascarpone, sweetener, vanilla extract, and three quarters of the chocolate. Put half the crumble mixture in each of the glasses and pour over half the quark mixture along with half the raspberries.

Put the other half of the crumble mixture on top, followed by the remaining quark mixture and raspberries. Sprinkle over the last of the chocolate. Chill for 3 hours before serving.
\end {method}

\showit[1.25in]{example-image-b}{This is a picture}

\end{document}


• hi there. nice. but "ingredients" is slightly indented. that can be gotten rid of by adding a % at the end of the line \if###1## in the definition of \ingredients. (haven't figured out why the same line in the method definition doesn't result in a similar problem, but ...) – barbara beeton Apr 23 '17 at 20:49
• Yes, I discovered that some time ago, and is fixed in my copy. I am making several changes and will post the finished result soonish. – sgmoye Apr 23 '17 at 21:02
• you should make it a package. i'd use it, and willingly share a few recipes for examples. – barbara beeton Apr 23 '17 at 21:10
• This should get you started: In the \recipe macro, immediately after \newpage insert the line \thispagestyle{fancy}. Immediately before \begin{document}, change \pagestyle{fancy} to \pagestyle{plain}. Also recommend taking a close look at the documentation for fancyhdr. – sgmoye Dec 14 '20 at 12:00
• @Coolcrab Well, as they say in showbiz, just spell my name right! Glad this works for you. – sgmoye Dec 16 '20 at 14:52