It's Christmas cookie time, and everyone's got a recipe or two they swear by, whether their loyalties lie with frosted sugar cookies or gently spiced gingerbread.

In a time of togetherness and seasonal cheer, though, cookies can be contentious: Is crispy better than chewy? Is a cakelike texture something to strive for, or avoid at all costs? How do you pick the perfect recipe when cookie tastes vary so wildly?

The chemistry of cookies can help answer that last question. These sweet treats require a delicate balance between sugar, flour and fat and the outcomes of varying an ingredient or two get confusing quickly. [11 Health Benefits of Christmas Dinner]

"Cookies are actually really complicated," said Jeff Potter, the author of "Cooking for Geeks: Real Science, Great Hacks and Good Food" (O'Reilly Media, 2010). "They're a whole microcosm. Every single thing in food science that happens pretty much happens in cookies."

The ingredients

To understand the complexity of a simple snowflake sugar cookie, it helps to start with the ingredients. There's flour, of course, the base of most baked holiday treats. When mixed with water, flour forms a protein called gluten, a long molecule that helps trap air bubbles in yeasty breads and pizza dough. Too much gluten in cookies makes them tough, but a little bit of gluten can give them structure and prevent them from spreading all over the cookie sheet.

Cake flour has fewer gluten-forming proteins than all-purpose flour or bread flour about 7 percent by volume compared with up to 15 percent in the highest-gluten bread flour, according to the King Arthur Flour company. All-purpose flour, with its middle-of-the-road protein content, is still perfectly acceptable for cookies, though some baking purists prefer to use cake flour.

But wait. Flour alone can't determine a cookie's ultimate texture. Water promotes the formation of gluten, Potter told Live Science. Sucrose (table sugar) and fat inhibit it.

Here's where the choice of fat and sugar start to matter. Butter, Potter said, is about 80 percent fat and 20 percent water. Shortening is all fat. Cookies made with shortening form less gluten, therefore becoming less cakelike.

Butter is a bit more complicated. It's an emulsion, Potter said, so the water is bound up in the fat molecules, keeping it from interacting with the flour. Melt the better and the water can interact more readily with the flour, creating gluten and a cakelike, compact cookie. Keep the butter solid and the dough will contain less gluten, making cookies with a slightly higher tendency to spread. (Eggs are the other source of cookie-based moisture, Potter said. Egg proteins also help bind the dough together.)

Sugar plays a role in cookie texture, as well. White sugar is made up of the molecule sucrose. Corn syrup, on the other hand, is largely glucose a sugar molecule half the size of a sucrose molecule.

"There are actually more molecules of glucose in a cup than there are molecules of sucrose, because glucose is a smaller molecule," Potter said. As a result, glucose can hang on to more water during baking. And water left in a cookie once it leaves the oven ultimately determines its place on the crispy-chewy spectrum. More than six percent moisture, and the cookie is chewy. Less than that, and the batch will come out crispy.

Thus, cookies made with corn syrup are chewier than those made with white sugar. Brown sugar cookies are also on the chewy side, because brown sugar is molasses added to white sugar, Potter said. Molasses contains some glucose and fructose, which keep the moisture content of the baked cookie high. [10 New Ways to Eat Well]

The process

Another controversy in the cookie world: To chill the dough or dive right in to baking? Some cooks argue that a day or two in the fridge allows the egg and other ingredients in the dough to combine more thoroughly, creating alterations in flavor and texture. Others say it allows the gluten to relax, removing some of the rubbery texture that protein can impart, or that the cool dough spreads less in the oven before it starts to set.

Based on chemistry, the answer to the chill or not to chill question isn't straightforward, Potter said. In 2008, he spoke with David Leite, the author of a New York Times piece on the quest for the perfect chocolate chip cookie. Leite ultimately called for chilled cookie dough, but told Potter that experiments were inconclusive as to why.

"What they found is that some of the time it made a difference and some of the time it made no difference, and they couldn't figure out" why, Potter said.

So chill the dough or don't, as time, personal taste and holiday whims allow, but don't grease the cookie pan, he said. Cookies have enough fat to avoid sticking, and if they stick anyway, its probably time for a new cookie sheet. Potter prefers to bake his cookies on parchment paper set on top of the cookie sheet. Once the cookies come out of the oven, it's easy to remove the parchment paper to prevent the heat from the baking sheet from over-baking the cookies.

The sidekicks

Many cookie recipes will call for baking powder, baking soda, or both. Baking soda is sodium bicarbonate. It is slightly basic, with a pH higher than seven, and reacts with acids (substances with a pH lower than seven) in the other ingredients to release carbon dioxide. The resulting bubbles give the finished cookies a bit of lift.

Baking powder mixes bicarbonate with a weak acid, so both ingredients in the chemical reaction are already included, Potter said. Add water, and baking powder makes its own bubbles.

A recipe that calls for both baking soda and baking powder is one with a little bit of its own acidity for a reaction, but not enough to achieve the kind of lift the recipe author required, Potter said. The baking powder provides the extra boost.

Finally, rolled-out sugar cookies usually contain no more seasoning than a bit of vanilla, but other flavors are strongly linked with Christmas: ginger, nutmeg and cloves, in particular. None of these spices are particularly wintery, though. Cloves come from an evergreen tree, to be sure but one that is native to Indonesia and thrives in the tropics. Nutmeg is the seed of another tropical evergreen. And ginger, that crucial component of gingerbread men, is also at home in the warm climes of southern China, Indonesia and West Africa.

Copyright 2014 LiveScience, a TechMediaNetwork company. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.