2010-06-13 82 views
1

我有以下TEX文件:挫折與fancyhdr

\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

查看右上角:

  • 如何使它顯示章節標題如果沒有部分,如第2頁?
  • 如果有活動部分,如何讓它顯示部分標題和除了部分標題(沒有數字,沒有子部分,子部分等),就像第4頁的情況一樣?

感謝

+0

一個星期前我只開始搞砸標題,所以我不能提供太多的幫助。您是否看到fancyhdr文檔中的標記部分? http://www.ctan.org/tex-archive/macros/latex/contrib/fancyhdr/fancyhdr.pdf – 2010-06-13 16:41:47

+0

我建議你閱讀http://www.ctan.org/tex-archive/macros/latex/contrib/ fancyhdr/fancyhdr.pdf特別說明了「標記」和連接的「命令」。你需要做一些章節標記,章節標記和小節標記,當然還有左標記,右標記和markboth;考慮你也可以找到有用的一些其他pkgs在上述鏈接的文檔中引用。不是一個真正的答案,但我希望閱讀可以啓發 – ShinTakezou 2010-06-13 16:55:44

+0

謝謝你的鏈接:-) – Flavius 2010-06-13 16:57:31

回答

7

你就要成功了!

以下2馬克應該做的伎倆:

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

一定\pagestyle{fancy}後,將其移動到的位置。另外請務必刪除自定義\subsectionmark,除非您想在標題中使用某些子部分信息。

+1

謝謝。給我一杯虛擬啤酒。乾杯:-) – Flavius 2010-06-13 16:51:33