TransWikia.com

An Aesthetically Pleasing Recipe Book Template

TeX - LaTeX Asked by PercyF2519 on June 12, 2021

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:

enter image description here

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}

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}{%
    newpagelhead{}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][Largeemph{Ingredients}]{%
    emph{#1}}
newcommand{instructions}[1][Largeemph{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.

Answered by alephzero on June 12, 2021

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

newifif@mainmatter @mainmattertrue

%% Borrowed from book.cls
newcommandfrontmatter{%
    cleardoublepage
  @mainmatterfalse
  pagenumbering{roman}}
newcommandmainmatter{%
    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.75linewidth}{raggedrightitshape#1}%
        end{center}
    fi
}
newcommand{serves}[2][Serves]{%
    chead{#1 #2}}
newcommand{vegetarian}{%
    rhead{largecolor{vegcolor}textbf{V}}}
newcommand{freeze}{%
    lhead{largecolor{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}Largetextbf{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}Largetextbf{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}

enter image description here

Answered by sgmoye on June 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP