20 在ctexbook中使用openany参数不能修改目录页行为的问题?

发布于 2024-10-05 16:15:33

在使用fancyhdf宏包定义【目录】【正文】部分的页眉页首样式时,指定的openany选项不能正确作用于【目录的偶数页】
希望把编译得到的mwe.pdf文档的IV页目录页删除,经过简单搜索只找到了有关的解答和部分解释,但并未解决。
下面是mwe和部分效果截图:

\documentclass[12pt,openany]{ctexbook}
% book提供\frontmatter,\mainmatter以及\backmatter命令
\usepackage{lipsum,zhlipsum}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{hyperref}
\title{This is the title...}
\author{This is the author...}
\date{\today}
% 希望通过fancyhdr命令,实现title页不计入编码(自然不显示编码)
% toctitle页 从1开始计数,并按照罗马数字显示
% 正文部分默认统一使用fancy样式 从1开始计数,并按照阿拉伯数字显示
% Chapter页需要设置页码(修改plain的格式设置) Section页默认设置
\fancypagestyle{toc}{
    \fancyhf{}%
    \fancyhead[C]{Table of Contents}
    \fancyfoot[C]{\thepage}
}
\fancypagestyle{myfancy}{
    \fancyhf{}%
    \fancyhead[C]{\textbf{The Main Contents}}
    \fancyfoot[R]{\thepage{} of \pageref{LastPage}}
    \renewcommand{\headrulewidth}{0.5pt}
    \renewcommand{\footrulewidth}{2pt}
}
\begin{document}
% https://github.com/CTeX-org/forum/issues/43
    \frontmatter
    \maketitle % toc控制的目录页还是会多出一页.. openany选项不能修改目录页的行为

    \pagestyle{toc}
    \pagenumbering{Roman}
    \tableofcontents \clearpage
    
    \mainmatter % 自带\pagenumbering设置
    \pagestyle{myfancy}
    %\pagenumbering{arabic} %默认为arabic样式
    \fancypagestyle{plain}{} % chapter页默认调用plain样式
    \ExplSyntaxOn
    \int_step_inline:nn {10}{
        \chapter{这是第{\int_to_arabic:n {#1}}个章节}
       
        \int_step_inline:nn {5}{
            \section{这是第{\int_to_arabic:n {#1}-\int_to_arabic:n {##1}}个文章部分}
            \lipsum[{##1}]\par
            \zhlipsum[{##1}]
        }
    }
    \ExplSyntaxOff
\end{document}

image.png

查看更多

关注者
0
被浏览
187
雾月
雾月 2024-10-05
这家伙很懒,什么也没写!

怎么没解决呢?

\renewcommand\mainmatter{\if@openright\cleardoublepage\else\clearpage\fi % <-
  \@mainmattertrue
  \pagenumbering{arabic}}
1 个回答

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览