3

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:

\newcolumntype{|}{!{\color{white}\vline}}
\rowcolors{2}{greylight}{greynormal}%
\setlength{\tabcolsep}{12pt}%                             
\setlength{\extrarowheight}{5pt}%                                       
\setlength{\arrayrulewidth}{2pt}%

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.

1
  • 2
    "I find it quite dirty and not very robust." Welcome to the world of TeX programming:-) You are doing the right thing. Dec 4, 2012 at 14:02

1 Answer 1

1

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:

  \reset@font\normalsize

The normal space factor settings

  \normalsfcodes

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

  \let\label\@gobble
  \let\index\@gobble
  \let\glossary\@gobble

zero out baselines

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

...

Default document colour

\normalcolor

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.

\def\@arrayparboxrestore{%
  \let\if@nobreak\iffalse
  \let\if@noskipsec\iffalse
  \let\par\@@par
  \let\-\@dischyph
  \let\'\@acci\let\`\@accii\let\=\@acciii
  \parindent\z@ \parskip\z@skip
  \everypar{}%
  \linewidth\hsize
  \@totalleftmargin\z@
  \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
  \parfillskip\@flushglue \lineskip\normallineskip
  \baselineskip\normalbaselineskip
  \sloppy}
\def\@parboxrestore{\@arrayparboxrestore\let\\\@normalcr}

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...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .