Page Layout ⇒ Remove Chapter Prefix from Foreword and Afterword Headers
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Remove Chapter Prefix from Foreword and Afterword Headers
Please be aware of the differences between foreword, preface, and introduction.
I've been asking google and found this: Creating unnumbered chapters/sections (plus adding them to the ToC and/or header).
Please take a look at it, read it, understand it, test it, be satisfied and then post a minimal working example containing the solution.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Remove Chapter Prefix from Foreword and Afterword Headers
Oops... for me they're all the sameJohannes_B wrote:I was thinking about your problem and finally I really understood what you want.
Please be aware of the differences between foreword, preface, and introduction.

Making the foreword/afterword unnumbered is of no use to me, because I do want them to be added to the table of contents. Instead,Johannes_B wrote:I've been asking google and found this: Creating unnumbered chapters/sections (plus adding them to the ToC and/or header).
Please take a look at it, read it, understand it, test it, be satisfied and then post a minimal working example containing the solution.
\markboth
is what I need. So:Code: Select all
\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
\chapter{Foreword}
\markboth{FOREWORD}{} % Right pages left without header because there are no sections
\mainmatter
\chapter{Bees}
\chapter{Wasps}
\chapter{Flies}
\chapter{Mosquitoes}
\chapter{Butterflies}
\chapter{Hornets}
\chapter{Midges}
\backmatter
\chapter{Afterword}
\markboth{AFTERWORD}{} % Right pages left without header because there are no sections
\end{document}
\markright
manually for every section?Thank you anyway for your essential advice.
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Remove Chapter Prefix from Foreword and Afterword Headers
.AleCes wrote:Should I use\markright
manually for every section?
No, I don't think so. Just give it a try.
Remove Chapter Prefix from Foreword and Afterword Headers
You're right, no need to do so. Thank you very much.Johannes_B wrote:.AleCes wrote:Should I use\markright
manually for every section?
No, I don't think so. Just give it a try.