Memoir Class 中用双面打印模拟单面打印时出现的问题

Memoir Class 中用双面打印模拟单面打印时出现的问题

我使用memoir类,并通过命令模拟单面打印和双面打印(在memoir手册中查找)

\setlength{\evensidemargin}{\oddsidemargin}

问题是我用命令修改了页眉宽度 \makerunningwidth(见下面的最小示例)。在奇数页上,页眉在前缘边距处结束,但我希望它从书脊边距开始。要理解我的问题,使用 PDFLaTeX 编译此代码会更容易。

\documentclass[a5paper]{memoir}
\usepackage{xcolor, calc}

% Laying out the page
\newlength{\myuppermargin}
\setlength{\myuppermargin}{20mm}
\newlength{\mylowermargin}
\setlength{\mylowermargin}{30mm}
\newlength{\myspinemargin}
\setlength{\myspinemargin}{30mm}
\newlength{\myedgemargin}
\setlength{\myedgemargin}{15mm}
\newlength{\myheadheight}
\setlength{\myheadheight}{7mm}
\newlength{\myfootskip}
\setlength{\myfootskip}{10.5mm}
\newlength{\myheadsep}
\setlength{\myheadsep}{5mm}
\newlength{\mymarginparsep}
\setlength{\mymarginparsep}{3mm}
\newlength{\mymarginparwidth}
\setlength{\mymarginparwidth}{12mm}
\newlength{\mymarginparpush}
\setlength{\mymarginparpush}{10mm}
\setlrmarginsandblock{\myspinemargin}{\myedgemargin}{*}
\setulmarginsandblock{\myuppermargin}{\mylowermargin}{*}
\setmarginnotes{\mymarginparsep}{\mymarginparwidth}{\mymarginparpush}
\setheadfoot{\myheadheight}{\myfootskip}
\setheaderspaces{*}{\myheadsep}{*}
\checkandfixthelayout{}
% Imitate one-sided printing but the page style can be customized
\setlength{\evensidemargin}{\oddsidemargin}

% Page style
\newcommand*{\evenheadfont}{\sffamily\mdseries\itshape\normalsize\color{blue}}
\newcommand*{\pagenumfont}{\normalfont\mdseries\itshape\small}
\newcommand*{\oddheadfont}{\evenheadfont}
\setlength{\headwidth}{\textwidth + \marginparsep + \marginparwidth}
\makepagestyle{custom}
\makerunningwidth{custom}{\headwidth}
\makeheadrule{custom}{\headwidth}{\normalrulethickness}
\makeheadfootruleprefix{custom}{\color{blue}}{}
\makeheadposition{custom}{flushright}{flushleft}{}{}
\makepsmarks{custom}{%
  \nouppercaseheads
  \createmark{chapter}{both}{nonumber}{}{}
  \createmark{section}{right}{shownumber}{}{. \space}
  \createplainmark{toc}{both}{\contentsname}
  \createplainmark{lof}{both}{\listfigurename}
  \createplainmark{lot}{both}{\listtablename}
  \createplainmark{bib}{both}{\bibname}
  \createplainmark{index}{both}{\indexname}
  \createplainmark{glossary}{both}{\glossaryname}%
}
\makeevenhead{custom}%
  {\raisebox{-1.2pt}{\colorbox{blue}{\textcolor{white}{\pagenumfont\thepage}}}}%
  {}%
  {\evenheadfont\leftmark}
\makeoddhead{custom}%
  {\oddheadfont\rightmark}%
  {}%
  {\raisebox{-1.2pt}{\colorbox{blue}{\textcolor{white}{\pagenumfont\thepage}}}}
\pagestyle{custom}

\newcommand{\sample}{Some text to experiment with page styles.}

\begin{document}
  \chapter{My chapter}
  \section{My section}
  \newpage
  \sample{} \sample{} \sample{} \sample{} \sample{} \sample{} \sample{}
  \newpage
  \sample{} \sample{} \sample{} \sample{} \sample{} \sample{} \sample{}
\end{document}

答案1

你需要改变

\makeheadposition{custom}{flushright}{flushleft}{}{}

到:

\makeheadposition{custom}{flushright}{flushright}{}{}   

(尽管我仍然认为如果将其打印为双面文档,这种布局看起来会很奇怪。)

相关内容