Chapter 7. Adding recipes
Prev |  | Next

## Chapter 7. Adding recipes

So far, you know how to add your own foods to Pantry. However, to add a food, you have to know what its nutrient content is. If you have a food that is a mixture of several different foods, then making a recipe can help. You'll learn how to do that in this chapter.

This chapter will lead you through how to create your own recipes. If you would rather jump right into an example, you can try consulting the `examples` directory in the Pantry distribution, which has some example files.

## 7.1. When to use recipes

The basic building block of Pantry is the food. Each food has traits, nutrient content, and available units. In Pantry, you can combine several foods into one single food using recipes. Thus, for example, you can combine corn meal, flour, water, baking powder, sugar, salt, and eggs using a recipe. The result will be a single food that you can call corn bread. This new food will have traits, available units, and nutrients, just like any other food in Pantry.

Sometimes using a recipe is overkill. For example, say you have a few foods that you always eat together in a certain quantity. It can be much quicker and easier to simply give these foods a common group trait. For example, I often eat two ounces of cold cereal with one cup of milk. I could create a recipe for these foods. Instead, I have simply added both of these foods to my `quick` file, and I have changed the `group` trait of both foods to `Cereal and Milk`. Then, when I want to record in my diary that I have eaten these two foods, I simply issue `pantry --group 'Cereal and Milk' --add diary.txt quick`.

Thus you will find recipes most useful in two instances. First, recipes are handy if you have several foods that you wish to combine into one food. Then the nutrient breakdown of all the foods will appear together in your reports. Second, you have to use recipes if you wish take several foods, combine them, and subdivide the results. For example, if I wanted to eat an entire 9x9-inch dish of corn bread, perhaps I could treat corn bread in Pantry the same way I record my cereal and milk. However, because I want to divide the corn bread into multiple portions and eat them separately, I must use a recipe.

Prev |  | Next
6.4. Which sort of file should I use? | Home | 7.2. Creating a recipe