TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a tabular in my header, using fancyhdr and a longtable that take multiple pages. The longtable has been created by an environment that also sets some variables:


The problem I am facing is that on all pages where the longtable is not finished yet, the tabular in the header will use theses changes.

Is there a convenient way, inside my header, to reset all thoses variables that could have been set ?

For now, I redefined those specific variables in the header, but I find it quite dirty and not very robust.

share|improve this question
"I find it quite dirty and not very robust." Welcome to the world of TeX programming:-) You are doing the right thing. – David Carlisle Dec 4 '12 at 14:02
up vote 1 down vote accepted

As I noted in the comments, you are doing the correct thing. LaTeX resets several things in the header but the list is rather ad-hoc and it's not that unusual that you need to ensure that the environment for any code that you put in the header is normalised.

Basically LaTeX currently restores the following things:

The document default font:


The normal space factor settings


Avoid writing label information on every page if a section head gets copied to a page heading


zero out baselines

  \baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@


Default document colour


Thus you will see that there is no notion of a single global resetting or a possibility of arranging the document scope such that settings within the page do not leak to the heading code.

Most multi-line headings will then also call \@parboxrestore either directly or by putting the multi-line code in a parbox or minipage. That resets some additional parameters.

  \parindent\z@ \parskip\z@skip
  \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
  \parfillskip\@flushglue \lineskip\normallineskip

So an alternative to resetting (say) \tabcolsep explicitly in your heading code would be to add its reset to \@arrayparboxrestore That would mean that any tabular nested in a p column in the longtable would get the reset values rather than the values used in the outer longtable. So it depends on your requirements...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.