How to get the author and chapter names in header; alternatively using fancyhdr?
up vote
2
down vote
favorite
I want to set a header/footer which shows:
- Chapter name on odd numbered page;
- Author name (different authors in different chapters) in even numbered pages;
- Page number in central footer.
Any help would be appreciated.
Thanks.
Updated:
A MWE is given as
documentclass{book}
usepackage{blindtext}
usepackage{fancyhdr}
pagestyle{fancy}
begin{document}
chapter{Wombat}
Author Aa, And Author Bb
blindtext[5]
section{tabmow}
blindtext[5]
chapter{Capybara}
Author Cc, And Author Dd
blindtext[5]
section{arabypac}
blindtext[5]
end{document}
header-footer fancyhdr book-design
add a comment |
up vote
2
down vote
favorite
I want to set a header/footer which shows:
- Chapter name on odd numbered page;
- Author name (different authors in different chapters) in even numbered pages;
- Page number in central footer.
Any help would be appreciated.
Thanks.
Updated:
A MWE is given as
documentclass{book}
usepackage{blindtext}
usepackage{fancyhdr}
pagestyle{fancy}
begin{document}
chapter{Wombat}
Author Aa, And Author Bb
blindtext[5]
section{tabmow}
blindtext[5]
chapter{Capybara}
Author Cc, And Author Dd
blindtext[5]
section{arabypac}
blindtext[5]
end{document}
header-footer fancyhdr book-design
So you don't want thesectionheader to appear at all?
– Werner
Nov 13 at 19:36
Yes, for now....
– Wings
Nov 13 at 19:37
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I want to set a header/footer which shows:
- Chapter name on odd numbered page;
- Author name (different authors in different chapters) in even numbered pages;
- Page number in central footer.
Any help would be appreciated.
Thanks.
Updated:
A MWE is given as
documentclass{book}
usepackage{blindtext}
usepackage{fancyhdr}
pagestyle{fancy}
begin{document}
chapter{Wombat}
Author Aa, And Author Bb
blindtext[5]
section{tabmow}
blindtext[5]
chapter{Capybara}
Author Cc, And Author Dd
blindtext[5]
section{arabypac}
blindtext[5]
end{document}
header-footer fancyhdr book-design
I want to set a header/footer which shows:
- Chapter name on odd numbered page;
- Author name (different authors in different chapters) in even numbered pages;
- Page number in central footer.
Any help would be appreciated.
Thanks.
Updated:
A MWE is given as
documentclass{book}
usepackage{blindtext}
usepackage{fancyhdr}
pagestyle{fancy}
begin{document}
chapter{Wombat}
Author Aa, And Author Bb
blindtext[5]
section{tabmow}
blindtext[5]
chapter{Capybara}
Author Cc, And Author Dd
blindtext[5]
section{arabypac}
blindtext[5]
end{document}
header-footer fancyhdr book-design
header-footer fancyhdr book-design
edited Nov 14 at 8:06
Dũng Vũ
1,05018
1,05018
asked Nov 13 at 19:12
Wings
289
289
So you don't want thesectionheader to appear at all?
– Werner
Nov 13 at 19:36
Yes, for now....
– Wings
Nov 13 at 19:37
add a comment |
So you don't want thesectionheader to appear at all?
– Werner
Nov 13 at 19:36
Yes, for now....
– Wings
Nov 13 at 19:37
So you don't want the
section header to appear at all?– Werner
Nov 13 at 19:36
So you don't want the
section header to appear at all?– Werner
Nov 13 at 19:36
Yes, for now....
– Wings
Nov 13 at 19:37
Yes, for now....
– Wings
Nov 13 at 19:37
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
The following introduces chapterauthor to set and store the authors associated with your chapters. This allows you to use the stored details within the fancyhead[LE] part.

documentclass{book}
usepackage{blindtext}
usepackage{fancyhdr}
makeatletter
newcommand{chapterauthor}[1]{%
def@chapterauthor{#1}% Store chapter authors
{bfseries #1}% Set chapter authors
par
}
fancyhf{}% Clear header/footer
fancyhead[RO]{leftmark}% Chapter details in book
fancyhead[LE]{@chapterauthor}% Stored chapterauthor details
fancyfoot[C]{thepage}
%renewcommand{headrulewidth}{0pt}% Remove header rule
%renewcommand{footrulewidth}{0pt}% Remove footer rule (default)
pagestyle{fancy}
makeatother
begin{document}
chapter{Wombat}
chapterauthor{Author Aa, And Author Bb}
blindtext[5]
section{tabmow}
blindtext[5]
chapter{Capybara}
chapterauthor{Author Cc, And Author Dd}
blindtext[5]
section{arabypac}
blindtext[5]
chapter*{Mara}
chapterauthor{}% No chapter author
blindtext[5]
section{aram}
blindtext[5]
end{document}
add a comment |
up vote
0
down vote
accepted
After reading the documentation for fancyhdr package, I got the work done as below:
documentclass[twoside]{book}
usepackage{lipsum}
usepackage{fancyhdr}
pagestyle{fancy}
renewcommand{chaptermark}[1]{%
markboth{thechapter. #1}{}}
newcommand{TheAuthor}{} % As given in documentation of **fancyhdr**
newcommand{Author}[1]{renewcommand{TheAuthor}{#1}}
fancyhead{} % clear all fields
fancyhead[CO]{slshape leftmark}
fancyhead[CE]{slshape TheAuthor}
fancyfoot[C]{thepage}
renewcommand{headrulewidth}{0.4pt}
renewcommand{footrulewidth}{0.6pt}
begin{document}
tableofcontents{}
mainmatter % Begin numeric (1,2,3...) page numbering
pagestyle{fancy} % Return the page headers back to the "fancy" style
input{./Chap1/Chap1} % Include the chapters as separate files from the Chapters folder (first <Chap1> is folder and second one is file Chap1.tex)
fancyhead{}
end{document}
And my Chap1.tex is:
% Chapter 1
chapter{Introduction}
Author{PQR}
section{Introduction}
lipsum[1-22]
section{Background}
lipsum[1-22]
subsection{History}
lipsum[1-22]
So how is this different than my proposed solution?
– Werner
Nov 15 at 1:17
In my solution, the command looks very easy to understand for novice users like me. It is much easier.
– Wings
Nov 15 at 5:11
What makes it easier to understand? You're usingdocumentclassoptions that aren't needed, and include text via an external file. What I'm getting at is that you should consider upvoting contributions and/or accept answers as the solution to your problem (see How do you accept an answer?) rather than adding content that replicates other answers. What you think might be easier to understand is purely subjective, don't you think?
– Werner
Nov 15 at 5:22
I guess I must thank you, first. Your solution that works,... absolutely! However, I am looking for simple solutions.
– Wings
Nov 15 at 5:27
I assume what you consider non-simple (or difficult) is the use of@symbols in definitions and the use ofmakeatletter...makeatother.
– Werner
Nov 15 at 5:34
|
show 1 more comment
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
The following introduces chapterauthor to set and store the authors associated with your chapters. This allows you to use the stored details within the fancyhead[LE] part.

documentclass{book}
usepackage{blindtext}
usepackage{fancyhdr}
makeatletter
newcommand{chapterauthor}[1]{%
def@chapterauthor{#1}% Store chapter authors
{bfseries #1}% Set chapter authors
par
}
fancyhf{}% Clear header/footer
fancyhead[RO]{leftmark}% Chapter details in book
fancyhead[LE]{@chapterauthor}% Stored chapterauthor details
fancyfoot[C]{thepage}
%renewcommand{headrulewidth}{0pt}% Remove header rule
%renewcommand{footrulewidth}{0pt}% Remove footer rule (default)
pagestyle{fancy}
makeatother
begin{document}
chapter{Wombat}
chapterauthor{Author Aa, And Author Bb}
blindtext[5]
section{tabmow}
blindtext[5]
chapter{Capybara}
chapterauthor{Author Cc, And Author Dd}
blindtext[5]
section{arabypac}
blindtext[5]
chapter*{Mara}
chapterauthor{}% No chapter author
blindtext[5]
section{aram}
blindtext[5]
end{document}
add a comment |
up vote
1
down vote
The following introduces chapterauthor to set and store the authors associated with your chapters. This allows you to use the stored details within the fancyhead[LE] part.

documentclass{book}
usepackage{blindtext}
usepackage{fancyhdr}
makeatletter
newcommand{chapterauthor}[1]{%
def@chapterauthor{#1}% Store chapter authors
{bfseries #1}% Set chapter authors
par
}
fancyhf{}% Clear header/footer
fancyhead[RO]{leftmark}% Chapter details in book
fancyhead[LE]{@chapterauthor}% Stored chapterauthor details
fancyfoot[C]{thepage}
%renewcommand{headrulewidth}{0pt}% Remove header rule
%renewcommand{footrulewidth}{0pt}% Remove footer rule (default)
pagestyle{fancy}
makeatother
begin{document}
chapter{Wombat}
chapterauthor{Author Aa, And Author Bb}
blindtext[5]
section{tabmow}
blindtext[5]
chapter{Capybara}
chapterauthor{Author Cc, And Author Dd}
blindtext[5]
section{arabypac}
blindtext[5]
chapter*{Mara}
chapterauthor{}% No chapter author
blindtext[5]
section{aram}
blindtext[5]
end{document}
add a comment |
up vote
1
down vote
up vote
1
down vote
The following introduces chapterauthor to set and store the authors associated with your chapters. This allows you to use the stored details within the fancyhead[LE] part.

documentclass{book}
usepackage{blindtext}
usepackage{fancyhdr}
makeatletter
newcommand{chapterauthor}[1]{%
def@chapterauthor{#1}% Store chapter authors
{bfseries #1}% Set chapter authors
par
}
fancyhf{}% Clear header/footer
fancyhead[RO]{leftmark}% Chapter details in book
fancyhead[LE]{@chapterauthor}% Stored chapterauthor details
fancyfoot[C]{thepage}
%renewcommand{headrulewidth}{0pt}% Remove header rule
%renewcommand{footrulewidth}{0pt}% Remove footer rule (default)
pagestyle{fancy}
makeatother
begin{document}
chapter{Wombat}
chapterauthor{Author Aa, And Author Bb}
blindtext[5]
section{tabmow}
blindtext[5]
chapter{Capybara}
chapterauthor{Author Cc, And Author Dd}
blindtext[5]
section{arabypac}
blindtext[5]
chapter*{Mara}
chapterauthor{}% No chapter author
blindtext[5]
section{aram}
blindtext[5]
end{document}
The following introduces chapterauthor to set and store the authors associated with your chapters. This allows you to use the stored details within the fancyhead[LE] part.

documentclass{book}
usepackage{blindtext}
usepackage{fancyhdr}
makeatletter
newcommand{chapterauthor}[1]{%
def@chapterauthor{#1}% Store chapter authors
{bfseries #1}% Set chapter authors
par
}
fancyhf{}% Clear header/footer
fancyhead[RO]{leftmark}% Chapter details in book
fancyhead[LE]{@chapterauthor}% Stored chapterauthor details
fancyfoot[C]{thepage}
%renewcommand{headrulewidth}{0pt}% Remove header rule
%renewcommand{footrulewidth}{0pt}% Remove footer rule (default)
pagestyle{fancy}
makeatother
begin{document}
chapter{Wombat}
chapterauthor{Author Aa, And Author Bb}
blindtext[5]
section{tabmow}
blindtext[5]
chapter{Capybara}
chapterauthor{Author Cc, And Author Dd}
blindtext[5]
section{arabypac}
blindtext[5]
chapter*{Mara}
chapterauthor{}% No chapter author
blindtext[5]
section{aram}
blindtext[5]
end{document}
answered Nov 13 at 20:10
Werner
430k599481624
430k599481624
add a comment |
add a comment |
up vote
0
down vote
accepted
After reading the documentation for fancyhdr package, I got the work done as below:
documentclass[twoside]{book}
usepackage{lipsum}
usepackage{fancyhdr}
pagestyle{fancy}
renewcommand{chaptermark}[1]{%
markboth{thechapter. #1}{}}
newcommand{TheAuthor}{} % As given in documentation of **fancyhdr**
newcommand{Author}[1]{renewcommand{TheAuthor}{#1}}
fancyhead{} % clear all fields
fancyhead[CO]{slshape leftmark}
fancyhead[CE]{slshape TheAuthor}
fancyfoot[C]{thepage}
renewcommand{headrulewidth}{0.4pt}
renewcommand{footrulewidth}{0.6pt}
begin{document}
tableofcontents{}
mainmatter % Begin numeric (1,2,3...) page numbering
pagestyle{fancy} % Return the page headers back to the "fancy" style
input{./Chap1/Chap1} % Include the chapters as separate files from the Chapters folder (first <Chap1> is folder and second one is file Chap1.tex)
fancyhead{}
end{document}
And my Chap1.tex is:
% Chapter 1
chapter{Introduction}
Author{PQR}
section{Introduction}
lipsum[1-22]
section{Background}
lipsum[1-22]
subsection{History}
lipsum[1-22]
So how is this different than my proposed solution?
– Werner
Nov 15 at 1:17
In my solution, the command looks very easy to understand for novice users like me. It is much easier.
– Wings
Nov 15 at 5:11
What makes it easier to understand? You're usingdocumentclassoptions that aren't needed, and include text via an external file. What I'm getting at is that you should consider upvoting contributions and/or accept answers as the solution to your problem (see How do you accept an answer?) rather than adding content that replicates other answers. What you think might be easier to understand is purely subjective, don't you think?
– Werner
Nov 15 at 5:22
I guess I must thank you, first. Your solution that works,... absolutely! However, I am looking for simple solutions.
– Wings
Nov 15 at 5:27
I assume what you consider non-simple (or difficult) is the use of@symbols in definitions and the use ofmakeatletter...makeatother.
– Werner
Nov 15 at 5:34
|
show 1 more comment
up vote
0
down vote
accepted
After reading the documentation for fancyhdr package, I got the work done as below:
documentclass[twoside]{book}
usepackage{lipsum}
usepackage{fancyhdr}
pagestyle{fancy}
renewcommand{chaptermark}[1]{%
markboth{thechapter. #1}{}}
newcommand{TheAuthor}{} % As given in documentation of **fancyhdr**
newcommand{Author}[1]{renewcommand{TheAuthor}{#1}}
fancyhead{} % clear all fields
fancyhead[CO]{slshape leftmark}
fancyhead[CE]{slshape TheAuthor}
fancyfoot[C]{thepage}
renewcommand{headrulewidth}{0.4pt}
renewcommand{footrulewidth}{0.6pt}
begin{document}
tableofcontents{}
mainmatter % Begin numeric (1,2,3...) page numbering
pagestyle{fancy} % Return the page headers back to the "fancy" style
input{./Chap1/Chap1} % Include the chapters as separate files from the Chapters folder (first <Chap1> is folder and second one is file Chap1.tex)
fancyhead{}
end{document}
And my Chap1.tex is:
% Chapter 1
chapter{Introduction}
Author{PQR}
section{Introduction}
lipsum[1-22]
section{Background}
lipsum[1-22]
subsection{History}
lipsum[1-22]
So how is this different than my proposed solution?
– Werner
Nov 15 at 1:17
In my solution, the command looks very easy to understand for novice users like me. It is much easier.
– Wings
Nov 15 at 5:11
What makes it easier to understand? You're usingdocumentclassoptions that aren't needed, and include text via an external file. What I'm getting at is that you should consider upvoting contributions and/or accept answers as the solution to your problem (see How do you accept an answer?) rather than adding content that replicates other answers. What you think might be easier to understand is purely subjective, don't you think?
– Werner
Nov 15 at 5:22
I guess I must thank you, first. Your solution that works,... absolutely! However, I am looking for simple solutions.
– Wings
Nov 15 at 5:27
I assume what you consider non-simple (or difficult) is the use of@symbols in definitions and the use ofmakeatletter...makeatother.
– Werner
Nov 15 at 5:34
|
show 1 more comment
up vote
0
down vote
accepted
up vote
0
down vote
accepted
After reading the documentation for fancyhdr package, I got the work done as below:
documentclass[twoside]{book}
usepackage{lipsum}
usepackage{fancyhdr}
pagestyle{fancy}
renewcommand{chaptermark}[1]{%
markboth{thechapter. #1}{}}
newcommand{TheAuthor}{} % As given in documentation of **fancyhdr**
newcommand{Author}[1]{renewcommand{TheAuthor}{#1}}
fancyhead{} % clear all fields
fancyhead[CO]{slshape leftmark}
fancyhead[CE]{slshape TheAuthor}
fancyfoot[C]{thepage}
renewcommand{headrulewidth}{0.4pt}
renewcommand{footrulewidth}{0.6pt}
begin{document}
tableofcontents{}
mainmatter % Begin numeric (1,2,3...) page numbering
pagestyle{fancy} % Return the page headers back to the "fancy" style
input{./Chap1/Chap1} % Include the chapters as separate files from the Chapters folder (first <Chap1> is folder and second one is file Chap1.tex)
fancyhead{}
end{document}
And my Chap1.tex is:
% Chapter 1
chapter{Introduction}
Author{PQR}
section{Introduction}
lipsum[1-22]
section{Background}
lipsum[1-22]
subsection{History}
lipsum[1-22]
After reading the documentation for fancyhdr package, I got the work done as below:
documentclass[twoside]{book}
usepackage{lipsum}
usepackage{fancyhdr}
pagestyle{fancy}
renewcommand{chaptermark}[1]{%
markboth{thechapter. #1}{}}
newcommand{TheAuthor}{} % As given in documentation of **fancyhdr**
newcommand{Author}[1]{renewcommand{TheAuthor}{#1}}
fancyhead{} % clear all fields
fancyhead[CO]{slshape leftmark}
fancyhead[CE]{slshape TheAuthor}
fancyfoot[C]{thepage}
renewcommand{headrulewidth}{0.4pt}
renewcommand{footrulewidth}{0.6pt}
begin{document}
tableofcontents{}
mainmatter % Begin numeric (1,2,3...) page numbering
pagestyle{fancy} % Return the page headers back to the "fancy" style
input{./Chap1/Chap1} % Include the chapters as separate files from the Chapters folder (first <Chap1> is folder and second one is file Chap1.tex)
fancyhead{}
end{document}
And my Chap1.tex is:
% Chapter 1
chapter{Introduction}
Author{PQR}
section{Introduction}
lipsum[1-22]
section{Background}
lipsum[1-22]
subsection{History}
lipsum[1-22]
edited Nov 15 at 5:36
answered Nov 14 at 14:06
Wings
289
289
So how is this different than my proposed solution?
– Werner
Nov 15 at 1:17
In my solution, the command looks very easy to understand for novice users like me. It is much easier.
– Wings
Nov 15 at 5:11
What makes it easier to understand? You're usingdocumentclassoptions that aren't needed, and include text via an external file. What I'm getting at is that you should consider upvoting contributions and/or accept answers as the solution to your problem (see How do you accept an answer?) rather than adding content that replicates other answers. What you think might be easier to understand is purely subjective, don't you think?
– Werner
Nov 15 at 5:22
I guess I must thank you, first. Your solution that works,... absolutely! However, I am looking for simple solutions.
– Wings
Nov 15 at 5:27
I assume what you consider non-simple (or difficult) is the use of@symbols in definitions and the use ofmakeatletter...makeatother.
– Werner
Nov 15 at 5:34
|
show 1 more comment
So how is this different than my proposed solution?
– Werner
Nov 15 at 1:17
In my solution, the command looks very easy to understand for novice users like me. It is much easier.
– Wings
Nov 15 at 5:11
What makes it easier to understand? You're usingdocumentclassoptions that aren't needed, and include text via an external file. What I'm getting at is that you should consider upvoting contributions and/or accept answers as the solution to your problem (see How do you accept an answer?) rather than adding content that replicates other answers. What you think might be easier to understand is purely subjective, don't you think?
– Werner
Nov 15 at 5:22
I guess I must thank you, first. Your solution that works,... absolutely! However, I am looking for simple solutions.
– Wings
Nov 15 at 5:27
I assume what you consider non-simple (or difficult) is the use of@symbols in definitions and the use ofmakeatletter...makeatother.
– Werner
Nov 15 at 5:34
So how is this different than my proposed solution?
– Werner
Nov 15 at 1:17
So how is this different than my proposed solution?
– Werner
Nov 15 at 1:17
In my solution, the command looks very easy to understand for novice users like me. It is much easier.
– Wings
Nov 15 at 5:11
In my solution, the command looks very easy to understand for novice users like me. It is much easier.
– Wings
Nov 15 at 5:11
What makes it easier to understand? You're using
documentclass options that aren't needed, and include text via an external file. What I'm getting at is that you should consider upvoting contributions and/or accept answers as the solution to your problem (see How do you accept an answer?) rather than adding content that replicates other answers. What you think might be easier to understand is purely subjective, don't you think?– Werner
Nov 15 at 5:22
What makes it easier to understand? You're using
documentclass options that aren't needed, and include text via an external file. What I'm getting at is that you should consider upvoting contributions and/or accept answers as the solution to your problem (see How do you accept an answer?) rather than adding content that replicates other answers. What you think might be easier to understand is purely subjective, don't you think?– Werner
Nov 15 at 5:22
I guess I must thank you, first. Your solution that works,... absolutely! However, I am looking for simple solutions.
– Wings
Nov 15 at 5:27
I guess I must thank you, first. Your solution that works,... absolutely! However, I am looking for simple solutions.
– Wings
Nov 15 at 5:27
I assume what you consider non-simple (or difficult) is the use of
@ symbols in definitions and the use of makeatletter...makeatother.– Werner
Nov 15 at 5:34
I assume what you consider non-simple (or difficult) is the use of
@ symbols in definitions and the use of makeatletter...makeatother.– Werner
Nov 15 at 5:34
|
show 1 more comment
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f459829%2fhow-to-get-the-author-and-chapter-names-in-header-alternatively-using-fancyhdr%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
So you don't want the
sectionheader to appear at all?– Werner
Nov 13 at 19:36
Yes, for now....
– Wings
Nov 13 at 19:37