Page Layoutfancyhdr | Spaces in running Title

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
Ailicec
Posts: 18
Joined: Wed Jan 18, 2012 12:16 pm

fancyhdr | Spaces in running Title

Post by Ailicec »

Hello,

I am using fancyhdr and am trying to input a space between the different marks.

So I have

Code: Select all

\fancyhead[L]{\textit \chaptername \textit\thechapter: \textit \leftmark}
Which is giving me: Chapter1: Introduction

And I need Chapter 1: Introduction (i.e. a space between Chapter and the chapter number).

Thank you

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

fancyhdr | Spaces in running Title

Post by localghost »

You have to add a backslash (or a pair of curly braces) behind the \chaptername command.

Code: Select all

\fancyhead[L]{\itshape \chaptername\ \thechapter: \leftmark}

Best regards and welcome to the board
Thorsten
Ailicec
Posts: 18
Joined: Wed Jan 18, 2012 12:16 pm

fancyhdr | Spaces in running Title

Post by Ailicec »

localghost wrote:You have to add a backslash (or a pair of curly braces) behind the \chaptername command.

Code: Select all

\fancyhead[L]{\itshape \chaptername\ \thechapter: \leftmark}

Best regards and welcome to the board
Thorsten
Thank you. I knew it must be a simple thing but I could not find it
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: fancyhdr | Spaces in running Title

Post by Stefan Kottwitz »

A space directly after a control sequence (command, macro) marks the end and doesn't work as white space. Besides \ , it would also work if you would write \chaptername{}, inserting an "atom" {}.

Stefan
LaTeX.org admin
Post Reply