Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am developing a non-trivial class that is fairly large and complex. So far, everything has worked the way I designed it to be.

I apologize ahead of time as I cannot provide a MWE as my question is more conceptual than anything else.

I am using the package etoolbox to do evaluations of boolean and other flags.

Earlier, I had run across a stackexchange thread that describes how one might have different fancyhdr styles for different pages.

I went ahead and defined a couple of \fancypagestyle styles (briefly: one style for first page, contains a header and a footer, while the other (for all other pages) contains only a footer).

I placed the following code snippet in my class file:


Now, I find that the page style corresponding to firstpageform gets applied to the first page correctly. However, for the second page in the two page document I have, no fancy page style is applied!

I have the \maketitle fix in place: \g@addto@macro{\maketitle}{\thispagestyle{fancy}}

Before I defined these styles (with the above \maketitle fix in place), I was getting headers and footers on every page. Basically, I had \lhead and \rhead directives in place immediately after the \pagestyle{fancy} without any distinction of which page number I was on.

So, when is the \ifnumcomp above being computed? Is it automatically recomputed when the second page is created internally? If not, how do I make sure it provides values corresponding to the current value of page counter?

Sorry, once again - an MWE is impossible and does not make sense. Further, my class file has nearly 3000 lines, and it contains some information specific to my University that I do not have the right to distribute.

share|improve this question

closed as unclear what you're asking by David Carlisle, Sean Allred, Christian Hupfer, Jesse, Thorsten May 2 at 14:06

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

That "code snippet" doesn't have fancy associated with the toggling. It seems to set the page style to fancy (which is not firstpageform nor otherpageform) and then set \thispagestyle to either one of the predefined two. That means anything following the first page of your document will be fancy, which may not be well-defined. –  Werner May 1 at 20:19
Isn't it just easier to use \pagestyle{otherpageform} \thispagestyle{firstpageform} in your class to set all other pages to otherpageform yet the first one will be set to firstpageform. Perhaps you can even do this \AtBeginDocument. –  Werner May 1 at 20:27
If that ifnum is not inside some other macro it is just evaluated when it is encounted when the class file is read, so an if isn't needed (it is always going to be true, so the iftoggle on the next line isn't needed either. There is nothing special about code in a class file, commands are just evaluated as encounted, just as if they were in the preamble of the document. –  David Carlisle May 1 at 21:37
Incidentally, there is no reason at all why you could not have provided an MWE demonstrating this issue. –  cfr May 2 at 2:05
Does my suggestion help/solve the problem (using \pagestyle{otherpageform} \thispagestyle{firstpageform})? –  Werner May 2 at 6:31