XeLaTeX: change font for headers and footers

I've noticed that headers and footers of the documents, generated by XeLaTeX, use some other font instead of Helvetica. After digging into the LaTeX code, the problem is solved.

Finding 1: the LaTeX's output procedure uses \reset@font.

Finding 2: this command defined in latex.ltx as:


Idea 1: So, I should re-define \normalfont to switch to the desired font (\switchtomainfont is a command defined through the XeLaTeX-specific command \newfontface):


But it didn't help. It looked like the command was not called at all.

Finding 4: actually, in runtime \reset@font is defined as:


But it should make no difference.

Finding 5: activating macrotracing, I found that my \normalfont was expanded as:

\reset@font ->\protect \normalfont  
\normalfont  ->\usefont \encodingdefault \familydef
  ault \seriesdefault \shapedefault \relax

What? Why this expansion instead of what expected?

Finding 6: \reset@font uses not "\normalfont" but "\normalfont ". Command name includes the space at the end!


\expandafter\let\csname normalfont \endcsname\switchtomainfont

Hint: maybe use of \setromanfont would fix my problem before it appears, but I can't make this command working on my Linux system. But as far as I remember, it worked under Mac.

Categories: publishing TeX