Centering Fancyhdr leftmark and right mark
I would like to know how it was possible to center the chapters and sections marks (I don't know if they call it that) with this (MWE) code
documentclass[10pt,twoside]{book}
usepackage{lipsum}
usepackage{fancyhdr}
fancyhf{}
fancyhead[RE]{leftmark}
fancyhead[LO]{rightmark}
fancyhead[LE,RO]{thepage}
renewcommandheadrulewidth{0pt}
renewcommandchaptermark[1]{markboth{scshape#1}{}}
renewcommandsectionmark[1]{markright{scshape #1}}
begin{document}
chapter{chapter} % Even page header
lipsum[1]
section{section} % odd page header
lipsum[1-5]
end{document}
fancyhdr
add a comment |
I would like to know how it was possible to center the chapters and sections marks (I don't know if they call it that) with this (MWE) code
documentclass[10pt,twoside]{book}
usepackage{lipsum}
usepackage{fancyhdr}
fancyhf{}
fancyhead[RE]{leftmark}
fancyhead[LO]{rightmark}
fancyhead[LE,RO]{thepage}
renewcommandheadrulewidth{0pt}
renewcommandchaptermark[1]{markboth{scshape#1}{}}
renewcommandsectionmark[1]{markright{scshape #1}}
begin{document}
chapter{chapter} % Even page header
lipsum[1]
section{section} % odd page header
lipsum[1-5]
end{document}
fancyhdr
1
Usefancyhead[CE]{ ... }andfancyhead[CO]{ ... }.
– Bernard
Mar 17 at 11:31
I don't undestand what you mean, perhaps that the argument of fancyhead = empty? I tried: nothing happened.
– Zezzo
Mar 17 at 12:55
The dots represent the arguments offancyheadIjust say to replace the optional arguments[RE]and[LO]with[CE]and[CO]respectively.
– Bernard
Mar 17 at 13:02
add a comment |
I would like to know how it was possible to center the chapters and sections marks (I don't know if they call it that) with this (MWE) code
documentclass[10pt,twoside]{book}
usepackage{lipsum}
usepackage{fancyhdr}
fancyhf{}
fancyhead[RE]{leftmark}
fancyhead[LO]{rightmark}
fancyhead[LE,RO]{thepage}
renewcommandheadrulewidth{0pt}
renewcommandchaptermark[1]{markboth{scshape#1}{}}
renewcommandsectionmark[1]{markright{scshape #1}}
begin{document}
chapter{chapter} % Even page header
lipsum[1]
section{section} % odd page header
lipsum[1-5]
end{document}
fancyhdr
I would like to know how it was possible to center the chapters and sections marks (I don't know if they call it that) with this (MWE) code
documentclass[10pt,twoside]{book}
usepackage{lipsum}
usepackage{fancyhdr}
fancyhf{}
fancyhead[RE]{leftmark}
fancyhead[LO]{rightmark}
fancyhead[LE,RO]{thepage}
renewcommandheadrulewidth{0pt}
renewcommandchaptermark[1]{markboth{scshape#1}{}}
renewcommandsectionmark[1]{markright{scshape #1}}
begin{document}
chapter{chapter} % Even page header
lipsum[1]
section{section} % odd page header
lipsum[1-5]
end{document}
fancyhdr
fancyhdr
edited Mar 17 at 11:30
Bernard
174k776207
174k776207
asked Mar 17 at 10:53
ZezzoZezzo
284
284
1
Usefancyhead[CE]{ ... }andfancyhead[CO]{ ... }.
– Bernard
Mar 17 at 11:31
I don't undestand what you mean, perhaps that the argument of fancyhead = empty? I tried: nothing happened.
– Zezzo
Mar 17 at 12:55
The dots represent the arguments offancyheadIjust say to replace the optional arguments[RE]and[LO]with[CE]and[CO]respectively.
– Bernard
Mar 17 at 13:02
add a comment |
1
Usefancyhead[CE]{ ... }andfancyhead[CO]{ ... }.
– Bernard
Mar 17 at 11:31
I don't undestand what you mean, perhaps that the argument of fancyhead = empty? I tried: nothing happened.
– Zezzo
Mar 17 at 12:55
The dots represent the arguments offancyheadIjust say to replace the optional arguments[RE]and[LO]with[CE]and[CO]respectively.
– Bernard
Mar 17 at 13:02
1
1
Use
fancyhead[CE]{ ... } and fancyhead[CO]{ ... }.– Bernard
Mar 17 at 11:31
Use
fancyhead[CE]{ ... } and fancyhead[CO]{ ... }.– Bernard
Mar 17 at 11:31
I don't undestand what you mean, perhaps that the argument of fancyhead = empty? I tried: nothing happened.
– Zezzo
Mar 17 at 12:55
I don't undestand what you mean, perhaps that the argument of fancyhead = empty? I tried: nothing happened.
– Zezzo
Mar 17 at 12:55
The dots represent the arguments of
fancyhead Ijust say to replace the optional arguments [RE] and [LO] with [CE]and [CO] respectively.– Bernard
Mar 17 at 13:02
The dots represent the arguments of
fancyhead Ijust say to replace the optional arguments [RE] and [LO] with [CE]and [CO] respectively.– Bernard
Mar 17 at 13:02
add a comment |
1 Answer
1
active
oldest
votes
Here is a code. You had forgotten to declare the page style as ‘fancy’:
documentclass[10pt,twoside]{book}
usepackage{lipsum}
usepackage{fancyhdr}
fancyhf{}
fancyhead[CE]{leftmark}
fancyhead[CO]{rightmark}
fancyhead[LE,RO]{thepage}
renewcommandheadrulewidth{0pt}
renewcommandchaptermark[1]{markboth{scshape#1}{}}
renewcommandsectionmark[1]{markright{scshape #1}}
pagestyle{fancy}
begin{document}
chapter{A First Chapter} % Even page header
lipsum
section{A section} % odd page header
lipsum[1-10]
end{document}

Edit: If you want to have only the titles in the headers, it is easier with titleps:
documentclass[10pt,twoside]{book}
usepackage{lipsum}
usepackage{titleps}
newpagestyle{mine}[scshape]{%
sethead[thepage][chaptertitle]{}{sectiontitle}{thepage}
}
pagestyle{mine}
begin{document}
chapter{A First Chapter} % Even page header
lipsum
section{A section} % odd page header
lipsum[1-10]
end{document}

Great!!! Thank you! Would you mind telling me how it's possible, starting with this code, to remove the "Chapter #" (= only the actual chapter title) and "Section #" (= only the actual section title)?
– Zezzo
Mar 17 at 13:22
Not even the section or chapter numbers?
– Bernard
Mar 17 at 13:28
yes please. I would be grateful!
– Zezzo
Mar 17 at 13:30
It will be simpler to do withtitleps(a companion package oftitlesec) in the place offancyhdr.
– Bernard
Mar 17 at 13:33
Perfect!! Thank you very much.
– Zezzo
Mar 17 at 13:57
|
show 1 more comment
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2f479909%2fcentering-fancyhdr-leftmark-and-right-mark%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here is a code. You had forgotten to declare the page style as ‘fancy’:
documentclass[10pt,twoside]{book}
usepackage{lipsum}
usepackage{fancyhdr}
fancyhf{}
fancyhead[CE]{leftmark}
fancyhead[CO]{rightmark}
fancyhead[LE,RO]{thepage}
renewcommandheadrulewidth{0pt}
renewcommandchaptermark[1]{markboth{scshape#1}{}}
renewcommandsectionmark[1]{markright{scshape #1}}
pagestyle{fancy}
begin{document}
chapter{A First Chapter} % Even page header
lipsum
section{A section} % odd page header
lipsum[1-10]
end{document}

Edit: If you want to have only the titles in the headers, it is easier with titleps:
documentclass[10pt,twoside]{book}
usepackage{lipsum}
usepackage{titleps}
newpagestyle{mine}[scshape]{%
sethead[thepage][chaptertitle]{}{sectiontitle}{thepage}
}
pagestyle{mine}
begin{document}
chapter{A First Chapter} % Even page header
lipsum
section{A section} % odd page header
lipsum[1-10]
end{document}

Great!!! Thank you! Would you mind telling me how it's possible, starting with this code, to remove the "Chapter #" (= only the actual chapter title) and "Section #" (= only the actual section title)?
– Zezzo
Mar 17 at 13:22
Not even the section or chapter numbers?
– Bernard
Mar 17 at 13:28
yes please. I would be grateful!
– Zezzo
Mar 17 at 13:30
It will be simpler to do withtitleps(a companion package oftitlesec) in the place offancyhdr.
– Bernard
Mar 17 at 13:33
Perfect!! Thank you very much.
– Zezzo
Mar 17 at 13:57
|
show 1 more comment
Here is a code. You had forgotten to declare the page style as ‘fancy’:
documentclass[10pt,twoside]{book}
usepackage{lipsum}
usepackage{fancyhdr}
fancyhf{}
fancyhead[CE]{leftmark}
fancyhead[CO]{rightmark}
fancyhead[LE,RO]{thepage}
renewcommandheadrulewidth{0pt}
renewcommandchaptermark[1]{markboth{scshape#1}{}}
renewcommandsectionmark[1]{markright{scshape #1}}
pagestyle{fancy}
begin{document}
chapter{A First Chapter} % Even page header
lipsum
section{A section} % odd page header
lipsum[1-10]
end{document}

Edit: If you want to have only the titles in the headers, it is easier with titleps:
documentclass[10pt,twoside]{book}
usepackage{lipsum}
usepackage{titleps}
newpagestyle{mine}[scshape]{%
sethead[thepage][chaptertitle]{}{sectiontitle}{thepage}
}
pagestyle{mine}
begin{document}
chapter{A First Chapter} % Even page header
lipsum
section{A section} % odd page header
lipsum[1-10]
end{document}

Great!!! Thank you! Would you mind telling me how it's possible, starting with this code, to remove the "Chapter #" (= only the actual chapter title) and "Section #" (= only the actual section title)?
– Zezzo
Mar 17 at 13:22
Not even the section or chapter numbers?
– Bernard
Mar 17 at 13:28
yes please. I would be grateful!
– Zezzo
Mar 17 at 13:30
It will be simpler to do withtitleps(a companion package oftitlesec) in the place offancyhdr.
– Bernard
Mar 17 at 13:33
Perfect!! Thank you very much.
– Zezzo
Mar 17 at 13:57
|
show 1 more comment
Here is a code. You had forgotten to declare the page style as ‘fancy’:
documentclass[10pt,twoside]{book}
usepackage{lipsum}
usepackage{fancyhdr}
fancyhf{}
fancyhead[CE]{leftmark}
fancyhead[CO]{rightmark}
fancyhead[LE,RO]{thepage}
renewcommandheadrulewidth{0pt}
renewcommandchaptermark[1]{markboth{scshape#1}{}}
renewcommandsectionmark[1]{markright{scshape #1}}
pagestyle{fancy}
begin{document}
chapter{A First Chapter} % Even page header
lipsum
section{A section} % odd page header
lipsum[1-10]
end{document}

Edit: If you want to have only the titles in the headers, it is easier with titleps:
documentclass[10pt,twoside]{book}
usepackage{lipsum}
usepackage{titleps}
newpagestyle{mine}[scshape]{%
sethead[thepage][chaptertitle]{}{sectiontitle}{thepage}
}
pagestyle{mine}
begin{document}
chapter{A First Chapter} % Even page header
lipsum
section{A section} % odd page header
lipsum[1-10]
end{document}

Here is a code. You had forgotten to declare the page style as ‘fancy’:
documentclass[10pt,twoside]{book}
usepackage{lipsum}
usepackage{fancyhdr}
fancyhf{}
fancyhead[CE]{leftmark}
fancyhead[CO]{rightmark}
fancyhead[LE,RO]{thepage}
renewcommandheadrulewidth{0pt}
renewcommandchaptermark[1]{markboth{scshape#1}{}}
renewcommandsectionmark[1]{markright{scshape #1}}
pagestyle{fancy}
begin{document}
chapter{A First Chapter} % Even page header
lipsum
section{A section} % odd page header
lipsum[1-10]
end{document}

Edit: If you want to have only the titles in the headers, it is easier with titleps:
documentclass[10pt,twoside]{book}
usepackage{lipsum}
usepackage{titleps}
newpagestyle{mine}[scshape]{%
sethead[thepage][chaptertitle]{}{sectiontitle}{thepage}
}
pagestyle{mine}
begin{document}
chapter{A First Chapter} % Even page header
lipsum
section{A section} % odd page header
lipsum[1-10]
end{document}

edited Mar 17 at 13:40
answered Mar 17 at 13:15
BernardBernard
174k776207
174k776207
Great!!! Thank you! Would you mind telling me how it's possible, starting with this code, to remove the "Chapter #" (= only the actual chapter title) and "Section #" (= only the actual section title)?
– Zezzo
Mar 17 at 13:22
Not even the section or chapter numbers?
– Bernard
Mar 17 at 13:28
yes please. I would be grateful!
– Zezzo
Mar 17 at 13:30
It will be simpler to do withtitleps(a companion package oftitlesec) in the place offancyhdr.
– Bernard
Mar 17 at 13:33
Perfect!! Thank you very much.
– Zezzo
Mar 17 at 13:57
|
show 1 more comment
Great!!! Thank you! Would you mind telling me how it's possible, starting with this code, to remove the "Chapter #" (= only the actual chapter title) and "Section #" (= only the actual section title)?
– Zezzo
Mar 17 at 13:22
Not even the section or chapter numbers?
– Bernard
Mar 17 at 13:28
yes please. I would be grateful!
– Zezzo
Mar 17 at 13:30
It will be simpler to do withtitleps(a companion package oftitlesec) in the place offancyhdr.
– Bernard
Mar 17 at 13:33
Perfect!! Thank you very much.
– Zezzo
Mar 17 at 13:57
Great!!! Thank you! Would you mind telling me how it's possible, starting with this code, to remove the "Chapter #" (= only the actual chapter title) and "Section #" (= only the actual section title)?
– Zezzo
Mar 17 at 13:22
Great!!! Thank you! Would you mind telling me how it's possible, starting with this code, to remove the "Chapter #" (= only the actual chapter title) and "Section #" (= only the actual section title)?
– Zezzo
Mar 17 at 13:22
Not even the section or chapter numbers?
– Bernard
Mar 17 at 13:28
Not even the section or chapter numbers?
– Bernard
Mar 17 at 13:28
yes please. I would be grateful!
– Zezzo
Mar 17 at 13:30
yes please. I would be grateful!
– Zezzo
Mar 17 at 13:30
It will be simpler to do with
titleps (a companion package of titlesec) in the place of fancyhdr.– Bernard
Mar 17 at 13:33
It will be simpler to do with
titleps (a companion package of titlesec) in the place of fancyhdr.– Bernard
Mar 17 at 13:33
Perfect!! Thank you very much.
– Zezzo
Mar 17 at 13:57
Perfect!! Thank you very much.
– Zezzo
Mar 17 at 13:57
|
show 1 more comment
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2f479909%2fcentering-fancyhdr-leftmark-and-right-mark%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
1
Use
fancyhead[CE]{ ... }andfancyhead[CO]{ ... }.– Bernard
Mar 17 at 11:31
I don't undestand what you mean, perhaps that the argument of fancyhead = empty? I tried: nothing happened.
– Zezzo
Mar 17 at 12:55
The dots represent the arguments of
fancyheadIjust say to replace the optional arguments[RE]and[LO]with[CE]and[CO]respectively.– Bernard
Mar 17 at 13:02