代码之家  ›  专栏  ›  技术社区  ›  Flavius

对幻想的沮丧

  •  2
  • Flavius  · 技术社区  · 16 年前

    我有以下tex文件:

    \documentclass[a4paper,11pt,oneside]{book}
    \usepackage[usenames,dvipsnames]{color}
    \usepackage[T1]{fontenc}
    \usepackage[utf8x]{inputenc}
    \usepackage{lipsum}
    \usepackage[left=2cm,top=3cm,right=1.5cm,bottom=2cm]{geometry}
    
    \renewcommand{\chaptermark}[1]{\markboth{#1}{}}
    \renewcommand{\sectionmark}[1]{\markright{#1}{}}
    \renewcommand{\subsectionmark}[1]{\markright{\thesubsection}{}}
    
    \usepackage[Lenny]{fncychap}
    \usepackage{thumbpdf}
    \usepackage[colorlinks]{hyperref}
    \setlength\marginparwidth{1cm}
    \usepackage{fancyhdr}
    
    \pagestyle{fancy}
    \fancyhead[LO,L]{Book template}
    \fancyhead[RO,R]{\rightmark}
    \fancyfoot[CO,C] {\thepage}
    
    \begin{document}
    \chapter{Chapter Intro}
    \lipsum
    \chapter{Chapter with subsections}
    \section{section foo}
    \lipsum
    \subsection{subsection bar}
    \lipsum
    \end{document}
    

    http://www.mediafire.com/?0m5mnka32kj

    在右上方:

    • 如果有一个活跃的部分,如第4页的情况,如何使它显示部分标题,除了部分标题(没有数字,没有子部分,子部分等)什么都不显示?

    谢谢

    1 回复  |  直到 16 年前
        1
  •  10
  •   earl    16 年前

    下面的两个标记应该可以做到这一点:

    \renewcommand{\chaptermark}[1]{\markright{#1}{}}
    \renewcommand{\sectionmark}[1]{\markright{#1}{}}
    

    一定要把它们移到某个位置 \pagestyle{fancy} . 还要确保删除自定义项 \subsectionmark