![](https://secure.gravatar.com/avatar/8b5a3ee6fe397b9fd2f13c1ae4079f99.jpg?s=120&d=mm&r=g)
I have a document with conditionally-generated content. There are some situations when I need the section title to change according to the content displayed within that section. For instance, the 14th section that appears in *every* chapter is either called "Cause and Effect" if the conditions decide to place macros \altMa, \altMb, or \altMc inside, but becomes called "Compare and Contrast" if one of a dozen other macros are pladed there. - The macros are defined in an entirely different macros.tex file. - The whole document is in a recurse loop, so \recurselevel or \chaptertitleis can give the current chapter number. I tried defining chapter titles inside the macros, `\setvalue{title\recurselevel}{Cause and Effect}`, but \getvalue{title\recurselevel}` couldn't find the defined value. I tried just defining in each macro \define\thesectiontitleis{Compare and Contrast}, but that only affects things AFTER the macro is called, so the wrong titles appear. How do I very simply make a section title change according to what content is inside it? --Joel