LaTeX forum ⇒ Graphics, Figures & TablesCustom Environment for special Recipe Layout

Information and discussion about graphics, figures & tables in LaTeX documents.
professorbell
Posts: 6
Joined: Fri Apr 12, 2013 4:46 am

Custom Environment for special Recipe Layout

Postby professorbell » Sun Aug 04, 2013 11:58 am

There is a pretty nice website called "Cooking for Engineers". That formats recipes as follows.

recipe-sample.png
recipe-sample.png (45.91 KiB) Viewed 1995 times

I personally think that this style is excellent, and like to store my own kitchen and lab related recipes in the same format. I usually just draw out the table by hand in a notebook but this is time consuming and annoying when one decides to make modifications after the fact. I would prefer to use \LaTeX to compile a PDF with all of my recipes nicely organized and sectioned.

The solution using the {tabular} environment is passable but clunky and unintuitive (i.e. hard to just sit down and type...) and it feels a bit like a hack:
  1. \subsection*{Crepes}
  2.  
  3. %ingredients
  4.  
  5. \begin{tabular}{|l|l|l|c|c|c|c|}
  6. \hline
  7. 1-2 & Oz & Baileys & Consume Copiously & \multirow{6}{*}{Whisk} & \multirow{8}{*}{Combine Slowly} & \multirow{9}{*}{\parbox{4cm}{Ladle 2-3 Oz of batter into pan and tilt pan to spread evenly (1/8 in. layer, if thicker, add water, mix, and repeat).}} \\ \cline{1-4}
  8. 2 & & egg (whole) & \multicolumn{1}{c}{ } & & & \\
  9. 2 & & egg (yolk) & \multicolumn{1}{c}{ } & & & \\
  10. 1/2 & c & water & \multicolumn{1}{c}{ } & & & \\
  11. 1/2 & c & milk & \multicolumn{1}{c}{ } & & & \\
  12. 2 & T & butter(liquid) & \multicolumn{1}{c}{ } & & & \\ \cline{1-5}
  13. 1 & c & flour & \multicolumn{3}{c|}{ } & \\
  14. 1/4 & t & salt & \multicolumn{3}{c|}{ } & \\ \cline{1-6}
  15. 1 & T & Olive Oil or Butter & \multicolumn{3}{c|}{Apply thin coating to nonstick pan} & \\
  16. \hline
  17. \end{tabular}


recipe-example.png
recipe-example.png (47.32 KiB) Viewed 1995 times

Is there a better way to do this? How hard would it be to write an environment specifically for this?
Last edited by localghost on Sun Aug 04, 2013 12:16 pm, edited 1 time in total.
Reason: Preferably no external links (see Board Rules). Attachments go onto the forum server where possible.

Tags:

professorbell
Posts: 6
Joined: Fri Apr 12, 2013 4:46 am

Postby professorbell » Tue Mar 11, 2014 4:47 am

So a year later, I have gotten pretty comfortable working with the regular tabular environment for recipes in this format, mainly through use of conventions in my code to keep the table structure clear (this is almost impossible without a very wide monitor, as lines tend to stretch...if somebody can come up with a cool way to do it in a narrow (say 77 char width) emacs window I'd be interested):

  1. \documentclass[8pt]{extarticle}
  2.  
  3. \usepackage[letterpaper,landscape]{geometry}
  4. \usepackage{fullpage}
  5. \usepackage{xcolor}
  6. \usepackage{graphics}
  7. \usepackage{multirow}% http://ctan.org/pkg/multirow
  8. \usepackage{hhline}% http://ctan.org/pkg/hhline
  9. \usepackage{pbox}
  10.  
  11. \begin{document}
  12.  
  13. \begin{tabular}{|l|l|l|l|l|l|l|}
  14. \hline
  15. 1 & Whole & Andoulle sausage & Fry and set aside
  16. & \multirow{8}{*}{\pbox{20cm}{Add to main pot, \\maintain heat\\ until shrimp turn orange}}
  17. & \multirow{13}{*}{\pbox{20cm}{Add to main pot and\\ cook at med for\\ \textcolor{red}{10 minutes}}}.
  18. & \multirow{15}{*}{\pbox{20cm}{Stir in Rice and add\\ water. Cover and simmer\\ on low for ~25 minutes.}} \\ \cline{1-4}
  19. 2 & T & Olive Oil & \multirow{5}{*}{\pbox{20cm}{Saute on med-hi until\\ onions transulcent/browned\\ (add garlic last!)}} & & & \\
  20. 1.5 & C & chopped onions & & & & \\
  21. 0.5 & C & chopped bell peppers & & & & \\
  22. 0.5 & C & chopped celery & & & & \\
  23. 1 & T & chopped garlic & & & & \\\cline{1-4}
  24. 1 & lb. & peeled \& de-veined shrimp & \multicolumn{1}{c}{}& & & \\
  25. 4 & Whole & bay leaf & \multicolumn{1}{c}{}& & & \\ \cline{1-5}
  26. 1 & 28 Oz. Can & whole tomatoes (with juice) & \multicolumn{2}{c}{}& & \\
  27. 1 & t & salt & \multicolumn{2}{c}{}& & \\
  28. 0.5 & t & cayenne pepper & \multicolumn{2}{c}{}& & \\
  29. 0.025 & t & black pepper & \multicolumn{2}{c}{}& & \\
  30. 0.025 & t & dried thyme & \multicolumn{2}{c}{}& & \\ \cline{1-6}
  31. 1 & C & long grain white rice & \multicolumn{3}{c}{}& \\
  32. 0.75 & C & water & \multicolumn{3}{c}{}& \\\hline
  33. \end{tabular}
  34. \end{document}


which produces the attached. I have gotten fast enough at doing this by hand that I don't think it's worth the time to automate the process.
Attachments
jamb.png
jamb.png (48.2 KiB) Viewed 1536 times


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 8 guests