Centering Fancyhdr leftmark and right mark












1















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}









share|improve this question




















  • 1





    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











  • 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


















1















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}









share|improve this question




















  • 1





    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











  • 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
















1












1








1


1






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}









share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 17 at 11:30









Bernard

174k776207




174k776207










asked Mar 17 at 10:53









ZezzoZezzo

284




284








  • 1





    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











  • 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
















  • 1





    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











  • 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










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












1 Answer
1






active

oldest

votes


















1














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}


enter image description here



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}


enter image description here






share|improve this answer


























  • 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 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











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
});


}
});














draft saved

draft discarded


















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









1














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}


enter image description here



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}


enter image description here






share|improve this answer


























  • 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 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
















1














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}


enter image description here



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}


enter image description here






share|improve this answer


























  • 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 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














1












1








1







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}


enter image description here



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}


enter image description here






share|improve this answer















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}


enter image description here



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}


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








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 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



















  • 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 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

















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


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

How to send String Array data to Server using php in android

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Is anime1.com a legal site for watching anime?