It helps to really know the nutritional content of the food you take. I have a spreadsheet with all my backpack food. When I buy a new food, I copy the data from the label as a new item. Over the years I have establised a really good database. I do have to revise it regularly because food manufacturs sneakily change things, like the annoying practice of reducing the weight by a few ounces and charging the same price!

Column A is the name of the food
Column B is the weight of what I take, zero or blank if I do not use that item. Added all up this is my total food weight. Divide by days, I get pounds (or oz) per day
Column C is the "serving size" that the nutritional data is based on
Column D,E,F,G are calories, fat, carbs, protein.
Column H is what meal the food is to be used. I do this so I can see how my meals balance out
Column I, J, K, L are the adjusted calories, fat, carbs, protein for the exact weight I am taking. I add these all up and figure the percentage of calories as fat, carb, protein.

I just pack what I want. Do the spreadsheet. Then look at my nutritional balance. I aim for 20% protein, 50% carbs, 30% fats. For 1.25 pounds, I get about 2,200 - 2,400 calories per day. On longer trips I take more fat, just because it is calorie dense. I use "good" fat as much as possible- nuts, olive oil. For carbs, I minimize sugar and use complex carbs. I usually fall short on protein, but since I fish, that is not a big issue. When I am not fishing, I may throw in a bag of textured vegetable protein (TVP)- can get it from bulk containers at many regular stores. I throw a spoonful in every meal. You cannot taste it at all. In fact, if you look on the ingredients of FD meals, they have a lot of TVP. On longer trips I also take a multivitamin daily, because the diet is not as well balanced as I would eat at home.

YOu have to trial and error a lot to get 1) food that you actually will eat, 2) minimum weight with maximum calories, 3) and food that will agree with your individual digestive system. If you get constipated or diareha on the trip the food is not a good balance for you.

After tracking your food and experimenting a year or two you can be more casual about packing your food.

Of course, you absolutely need an accurate scale to do this. I use a postal scale.