我正在使用 EveryShipout 在后续页面上重新显示章节标题,使用的方法基于以下问题的答案这个问题。我稍作修改,以便更好地与 Memoir 配合使用。效果非常好:
\makepagestyle{headings} {} % Disable default Memoir repeated headings, we'll make our own
\EveryShipout{%
\ifdim\pagetotal>\pagegoal% There is content overflow on this page
\f@rhdr% Reprint/-insert sectional heading
\fi%
}
接下来我要做的是让它和主标题大小相同。(我计划稍后将其设为灰色)
我都试过了
\makepagestyle{headings} {} % Disable default Memoir repeated headings, we'll make our own
\EveryShipout{%
\ifdim\pagetotal>\pagegoal% There is content overflow on this page
\chaptitlefont\f@rhdr% Reprint/-insert sectional heading
\fi%
}
和
\makepagestyle{headings} {} % Disable default Memoir repeated headings, we'll make our own
\EveryShipout{%
\ifdim\pagetotal>\pagegoal% There is content overflow on this page
\Huge\f@rhdr% Reprint/-insert sectional heading
\fi%
}
乃至
\makepagestyle{headings} {} % Disable default Memoir repeated headings, we'll make our own
\EveryShipout{%
\ifdim\pagetotal>\pagegoal% There is content overflow on this page
\printchaptertitle{\f@rhdr}% Reprint/-insert sectional heading
\fi%
}
但两者都给出了相同的结果:
字体为什么不大一点,这个奇怪的数字(20.7425)是从哪里来的?
编辑:完整示例:
\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
% Repeating headings (based on https://tex.stackexchange.com/questions/47646/re-displaying-section-headings-after-page-breaks)
\makepagestyle{headings} {} % Disable default Memoir repeated headings, we'll make our own
\EveryShipout{%
\ifdim\pagetotal>\pagegoal% There is content overflow on this page
\printchaptertitle{\f@rhdr}% Reprint/-insert sectional heading
\fi%
}
\makeatother
\raggedright
\setlength{\parindent}{0pt}%
\nonzeroparskip
\begin{document}
\chapter{My chapter heading}
\section{Section 1}\lipsum[7-14]
\section{Section 2}\lipsum[1-6]
\end{document}
答案1
在输出例程期间,\protect
设置为\noexpand
,因此诸如\normalfont
和之类的命令\fontsize
不执行任何操作,因为它们扩展为
\protect\normalfont<space>
\protect\fontsize<space>
(空格是宏名的一部分),\noexpand
并使它们表现得像\relax
。
暂时切换\protect
到正常排版时的含义:
\EveryShipout{%
\ifdim\pagetotal>\pagegoal% There is content overflow on this page
\begingroup\let\protect\@typeset@protect
\printchaptertitle{\f@rhdr}% Reprint/-insert sectional heading
\endgroup
\fi
}
20.7425 从何而来?让我们看看:;扩展为\printchaptertitle{foo}
;如前所述,什么也不做。现在变成,并且,为了简短起见,调用。由于最终变成,因此打印这两个值并且不发生字体变化(因为讨论是类似的)。\chaptertitlefont foo
\chaptertitlefont
\normalfont\Huge\bfseries
\normalfont
\Huge
\@setfontsize\Huge\@xxpt{25}
\@setfontsize
\fontsize{\@xxpt}{25}
\fontsize
\relax
\bfseries