I am creating lots of letters using the scrlttr2 package and some variables that change per letter. The contents of these variables might cause the letter to take up an additional page that I would like to avoid. For example, some people have addresses that take up more lines than others, but there are other variables that can cause this to happen as well. When I have room, I want to set \KOMAoptions{parskip=full} because it looks nicer, but if I'm out of space I would like to set \KOMAoptions{parindent}. Is there a good way to do this automatically? Here are some options I thought of:
Define a command with the body of the letter. Use
\KOMAoptions{parskip=full}and\saveboxwith the address and the body command to get its height. If the height is over a certain amount, then set\KOMAoptions{parindent}. Then use the body command again to output the actual letter. I'm not sure how to get the height and switch on it, and defining the whole letter and its included environments in a single command sounds clunky.Make two versions of the document. In my Makefile, somehow identify the length in pages (how?) of the
parskipversion and substitute theparindentversion if necessaryJust set another variable to define this, and set it manually for each letter (this is what I am doing now).
Other ideas welcome.