Page LayoutRemove Chapter Prefix from Foreword and Afterword Headers

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Remove Chapter Prefix from Foreword and Afterword Headers

Post by AleCes »

Hello everybody, in a document like this:

Code: Select all

Code, edit and compile here:
\documentclass[12pt,a4paper]{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyhead[LE]{\leftmark}
\fancyhead[RO]{\rightmark}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont{Linux Libertine G}
\usepackage{polyglossia}
\setmainlanguage{english}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{bookmark}
\begin{document}
\frontmatter
\chapter{Foreword}
\mainmatter
\chapter{Bees}
\chapter{Wasps}
\chapter{Flies}
\chapter{Mosquitoes}
\chapter{Butterflies}
\chapter{Hornets}
\chapter{Midges}
\backmatter
\chapter{Afterword}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
I want to prevent respectively, the foreword from having CHAPTER 0 on its header and the afterword from having CHAPTER 7 on it, I just want the headers to be respectively: FOREWORD and AFTERWORD, no chapter number written.

Now, I know page 10 of fancyhdr manual speaks about customization but the examples I found aren't what I'm looking for.

Thank you very much.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

mas
Posts: 226
Joined: Thu Dec 04, 2008 4:39 am

Remove Chapter Prefix from Foreword and Afterword Headers

Post by mas »

AleCes wrote: I want to prevent respectively, the foreword from having CHAPTER 0 on its header and the afterword from having CHAPTER 7 on it, I just want the headers to be respectively: FOREWORD and AFTERWORD, no chapter number written.
If I understand correctly, you do not want those chapters numbered. Have you tried

Code: Select all

Code, edit and compile here:
\chapter*{Foreword}
\chapter*{Afterword}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
That should give you the result you are looking for.

OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Re: Remove Chapter Prefix from Foreword and Afterword Header

Post by AleCes »

Hi mas, no, that will exclude them from the index, which is not at all the intended result, I want to remove the CHAPTER 0 and CHAPTER 7 from the headers of, respectively, the foreword and the afterword.
mas
Posts: 226
Joined: Thu Dec 04, 2008 4:39 am

Remove Chapter Prefix from Foreword and Afterword Headers

Post by mas »

AleCes wrote:that will exclude them from the index, which is not at all the intended result,...
Do you mean the table of contents? Index is used for a different list :-) You can try this:

Code: Select all

Code, edit and compile here:
\chapter*{Foreword}
\addcontentsline{toc}{chapter}{Foreword}
\chapter*{Afterword}
\addcontentsline{toc}{chapter}{Afterword}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Remove Chapter Prefix from Foreword and Afterword Headers

Post by AleCes »

mas wrote:
AleCes wrote:that will exclude them from the index, which is not at all the intended result,...
Do you mean the table of contents? Index is used for a different list :-) You can try this:

Code: Select all

Code, edit and compile here:
\chapter*{Foreword}
\addcontentsline{toc}{chapter}{Foreword}
\chapter*{Afterword}
\addcontentsline{toc}{chapter}{Afterword}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This way, Foreword gets into the table of contents, but not into the header, the header reads TABLE OF CONTENTS because it doesn't recognize a new chapter has started.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Remove Chapter Prefix from Foreword and Afterword Headers

Post by Johannes_B »

try \clearpage after the toc.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Remove Chapter Prefix from Foreword and Afterword Headers

Post by AleCes »

Johannes_B wrote:try \clearpage after the toc.
No way
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Remove Chapter Prefix from Foreword and Afterword Headers

Post by Johannes_B »

Then, please prepare a new Minimal Working example with the proceedings of this thread.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Remove Chapter Prefix from Foreword and Afterword Headers

Post by AleCes »

Johannes_B wrote:Then, please prepare a new Minimal Working example with the proceedings of this thread.
Would that be good?

Code: Select all

Code, edit and compile here:
\documentclass[12pt,a4paper]{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyhead[LE]{\leftmark}
\fancyhead[RO]{\rightmark}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont{Linux Libertine G}
\usepackage{polyglossia}
\setmainlanguage{english}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{bookmark}
\begin{document}
\frontmatter
\tableofcontents
\clearpage
\chapter*{Foreword}
\addcontentsline{toc}{chapter}{Foreword}
\mainmatter
\chapter{Bees}
\chapter{Wasps}
\chapter{Flies}
\chapter{Mosquitoes}
\chapter{Butterflies}
\chapter{Hornets}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Re: Remove Chapter Prefix from Foreword and Afterword Header

Post by AleCes »

Bump! :mrgreen: Is the minimal example satisfying?
Post Reply