# Can't set font size in EveryShipout

I'm using EveryShipout to redisplay section headings on subsequent pages, using an approach based off the answer to this question. I've modified it slightly to work better with Memoir. It works pretty well:

\makepagestyle{headings} {} % Disable default Memoir repeated headings, we'll make our own

\EveryShipout{%
\fi%
}


Next what I want to change is to have it so that it's the same size as the main headings. (I plan on making it grey later)

I tried both

\makepagestyle{headings} {} % Disable default Memoir repeated headings, we'll make our own

\EveryShipout{%
\fi%
}


and

\makepagestyle{headings} {} % Disable default Memoir repeated headings, we'll make our own

\EveryShipout{%
\fi%
}


and even

\makepagestyle{headings} {} % Disable default Memoir repeated headings, we'll make our own

\EveryShipout{%
\fi%
}


but both of them gave the same result:

Why isn't the font bigger, and where did this weird number (20.7425) come from?

EDIT: Complete example:

\documentclass[twoside]{memoir}
\usepackage[papersize={8.5in,11in}, vmargin=0.5in, outer=1in, inner=0.5in, includehead, includefoot]{geometry}
%\usepackage{color}
\usepackage{fontspec}
\usepackage{titlesec}
\usepackage{newunicodechar}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{everyshi}% http://ctan.org/pkg/everyshi
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\usepackage[none]{hyphenat}

\setmainfont{OpenSans}

\makeatletter

\makepagestyle{headings} {} % Disable default Memoir repeated headings, we'll make our own

\EveryShipout{%
\fi%
}

\makeatother

\raggedright

\setlength{\parindent}{0pt}%
\nonzeroparskip

\begin{document}
\section{Section 1}\lipsum[7-14]
\section{Section 2}\lipsum[1-6]
\end{document}

• Show a complete example, this will make it much easier to test your issue. – Ulrike Fischer Oct 8 '16 at 10:23
• @UlrikeFischer Added – Joshua Walsh Oct 8 '16 at 11:04

During an output routine, \protect is set to \noexpand, so commands such as \normalfont and \fontsize do nothing, because they expand to

\protect\normalfont<space>
\protect\fontsize<space>


(the space is part of the macro name), and \noexpand makes them behave as \relax.

Temporarily switch \protect to the meaning it has during normal typesetting:

\EveryShipout{%

Where does 20.7425 come from? Let's see: \printchaptertitle{foo} does \chaptertitlefont foo; \chaptertitlefont expands to \normalfont\Huge\bfseries; \normalfont does nothing as explained before. Now \Huge becomes \@setfontsize\Huge\@xxpt{25} and, to keep it short, \@setfontsize calls \fontsize{\@xxpt}{25}. Since \fontsize eventually becomes \relax, the two values are printed and no font change happens (for \bfseries the discussion is similar).