Change the color of the header line
The answer to the question fancyhdr - Change horizontal line color on top of footer is not completely satisfactory, because it changes the position of the header line,
for example with this example.
documentclass{article}
usepackage{xcolor}
usepackage{fancyhdr}
renewcommand{headrulewidth}{0.5pt}
renewcommand{headrule}{hbox toheadwidth{color{red}leadershrule height headrulewidthhfill}}
fancyhead[LE,RO]{Hello}
pagestyle{fancy}
begin{document}
hello
end{document}
Is it possible to change only the color of the line, without changing its position?
color fancyhdr rules
add a comment |
The answer to the question fancyhdr - Change horizontal line color on top of footer is not completely satisfactory, because it changes the position of the header line,
for example with this example.
documentclass{article}
usepackage{xcolor}
usepackage{fancyhdr}
renewcommand{headrulewidth}{0.5pt}
renewcommand{headrule}{hbox toheadwidth{color{red}leadershrule height headrulewidthhfill}}
fancyhead[LE,RO]{Hello}
pagestyle{fancy}
begin{document}
hello
end{document}
Is it possible to change only the color of the line, without changing its position?
color fancyhdr rules
1
A simplerenewcommand{headrule}{{color{red}rule{textwidth}{0.5pt}}}
should do the trick.
– Bernard
Mar 14 at 18:33
Thanks, but it does not (at least not on my computer).
– Rastapopoulos
Mar 14 at 18:34
The position of the line isn't changed, neither with your code nor with mine. How is it modified, precisely?
– Bernard
Mar 14 at 19:15
add a comment |
The answer to the question fancyhdr - Change horizontal line color on top of footer is not completely satisfactory, because it changes the position of the header line,
for example with this example.
documentclass{article}
usepackage{xcolor}
usepackage{fancyhdr}
renewcommand{headrulewidth}{0.5pt}
renewcommand{headrule}{hbox toheadwidth{color{red}leadershrule height headrulewidthhfill}}
fancyhead[LE,RO]{Hello}
pagestyle{fancy}
begin{document}
hello
end{document}
Is it possible to change only the color of the line, without changing its position?
color fancyhdr rules
The answer to the question fancyhdr - Change horizontal line color on top of footer is not completely satisfactory, because it changes the position of the header line,
for example with this example.
documentclass{article}
usepackage{xcolor}
usepackage{fancyhdr}
renewcommand{headrulewidth}{0.5pt}
renewcommand{headrule}{hbox toheadwidth{color{red}leadershrule height headrulewidthhfill}}
fancyhead[LE,RO]{Hello}
pagestyle{fancy}
begin{document}
hello
end{document}
Is it possible to change only the color of the line, without changing its position?
color fancyhdr rules
color fancyhdr rules
edited Mar 14 at 19:20
Werner
448k719931698
448k719931698
asked Mar 14 at 18:07
RastapopoulosRastapopoulos
1737
1737
1
A simplerenewcommand{headrule}{{color{red}rule{textwidth}{0.5pt}}}
should do the trick.
– Bernard
Mar 14 at 18:33
Thanks, but it does not (at least not on my computer).
– Rastapopoulos
Mar 14 at 18:34
The position of the line isn't changed, neither with your code nor with mine. How is it modified, precisely?
– Bernard
Mar 14 at 19:15
add a comment |
1
A simplerenewcommand{headrule}{{color{red}rule{textwidth}{0.5pt}}}
should do the trick.
– Bernard
Mar 14 at 18:33
Thanks, but it does not (at least not on my computer).
– Rastapopoulos
Mar 14 at 18:34
The position of the line isn't changed, neither with your code nor with mine. How is it modified, precisely?
– Bernard
Mar 14 at 19:15
1
1
A simple
renewcommand{headrule}{{color{red}rule{textwidth}{0.5pt}}}
should do the trick.– Bernard
Mar 14 at 18:33
A simple
renewcommand{headrule}{{color{red}rule{textwidth}{0.5pt}}}
should do the trick.– Bernard
Mar 14 at 18:33
Thanks, but it does not (at least not on my computer).
– Rastapopoulos
Mar 14 at 18:34
Thanks, but it does not (at least not on my computer).
– Rastapopoulos
Mar 14 at 18:34
The position of the line isn't changed, neither with your code nor with mine. How is it modified, precisely?
– Bernard
Mar 14 at 19:15
The position of the line isn't changed, neither with your code nor with mine. How is it modified, precisely?
– Bernard
Mar 14 at 19:15
add a comment |
1 Answer
1
active
oldest
votes
Below I save the original headrule
in oldheadrule
, and then prepend color{<colour>}
to a newly-defined headrule
that just calls oldheadrule
. The approach is similar to etoolbox
's pretocmd
.
documentclass{article}
usepackage{fancyhdr,xcolor}
letoldheadruleheadrule% Copy headrule into oldheadrule
renewcommand{headrule}{color{red}oldheadrule}% Add colour to headrule
renewcommand{headrulewidth}{0.5pt}
fancyhead{Hello}
pagestyle{fancy}
begin{document}
Lorem ipsumldots
clearpage
Lorem ipsumldots
end{document}
Thank you very much! I had tried exactly this, but withnewcommand{oldheadrule}{headrule}
, which resulted in an infinite loop.
– Rastapopoulos
Mar 14 at 19:19
add a 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%2f479529%2fchange-the-color-of-the-header-line%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
Below I save the original headrule
in oldheadrule
, and then prepend color{<colour>}
to a newly-defined headrule
that just calls oldheadrule
. The approach is similar to etoolbox
's pretocmd
.
documentclass{article}
usepackage{fancyhdr,xcolor}
letoldheadruleheadrule% Copy headrule into oldheadrule
renewcommand{headrule}{color{red}oldheadrule}% Add colour to headrule
renewcommand{headrulewidth}{0.5pt}
fancyhead{Hello}
pagestyle{fancy}
begin{document}
Lorem ipsumldots
clearpage
Lorem ipsumldots
end{document}
Thank you very much! I had tried exactly this, but withnewcommand{oldheadrule}{headrule}
, which resulted in an infinite loop.
– Rastapopoulos
Mar 14 at 19:19
add a comment |
Below I save the original headrule
in oldheadrule
, and then prepend color{<colour>}
to a newly-defined headrule
that just calls oldheadrule
. The approach is similar to etoolbox
's pretocmd
.
documentclass{article}
usepackage{fancyhdr,xcolor}
letoldheadruleheadrule% Copy headrule into oldheadrule
renewcommand{headrule}{color{red}oldheadrule}% Add colour to headrule
renewcommand{headrulewidth}{0.5pt}
fancyhead{Hello}
pagestyle{fancy}
begin{document}
Lorem ipsumldots
clearpage
Lorem ipsumldots
end{document}
Thank you very much! I had tried exactly this, but withnewcommand{oldheadrule}{headrule}
, which resulted in an infinite loop.
– Rastapopoulos
Mar 14 at 19:19
add a comment |
Below I save the original headrule
in oldheadrule
, and then prepend color{<colour>}
to a newly-defined headrule
that just calls oldheadrule
. The approach is similar to etoolbox
's pretocmd
.
documentclass{article}
usepackage{fancyhdr,xcolor}
letoldheadruleheadrule% Copy headrule into oldheadrule
renewcommand{headrule}{color{red}oldheadrule}% Add colour to headrule
renewcommand{headrulewidth}{0.5pt}
fancyhead{Hello}
pagestyle{fancy}
begin{document}
Lorem ipsumldots
clearpage
Lorem ipsumldots
end{document}
Below I save the original headrule
in oldheadrule
, and then prepend color{<colour>}
to a newly-defined headrule
that just calls oldheadrule
. The approach is similar to etoolbox
's pretocmd
.
documentclass{article}
usepackage{fancyhdr,xcolor}
letoldheadruleheadrule% Copy headrule into oldheadrule
renewcommand{headrule}{color{red}oldheadrule}% Add colour to headrule
renewcommand{headrulewidth}{0.5pt}
fancyhead{Hello}
pagestyle{fancy}
begin{document}
Lorem ipsumldots
clearpage
Lorem ipsumldots
end{document}
answered Mar 14 at 19:12
WernerWerner
448k719931698
448k719931698
Thank you very much! I had tried exactly this, but withnewcommand{oldheadrule}{headrule}
, which resulted in an infinite loop.
– Rastapopoulos
Mar 14 at 19:19
add a comment |
Thank you very much! I had tried exactly this, but withnewcommand{oldheadrule}{headrule}
, which resulted in an infinite loop.
– Rastapopoulos
Mar 14 at 19:19
Thank you very much! I had tried exactly this, but with
newcommand{oldheadrule}{headrule}
, which resulted in an infinite loop.– Rastapopoulos
Mar 14 at 19:19
Thank you very much! I had tried exactly this, but with
newcommand{oldheadrule}{headrule}
, which resulted in an infinite loop.– Rastapopoulos
Mar 14 at 19:19
add a 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%2f479529%2fchange-the-color-of-the-header-line%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
A simple
renewcommand{headrule}{{color{red}rule{textwidth}{0.5pt}}}
should do the trick.– Bernard
Mar 14 at 18:33
Thanks, but it does not (at least not on my computer).
– Rastapopoulos
Mar 14 at 18:34
The position of the line isn't changed, neither with your code nor with mine. How is it modified, precisely?
– Bernard
Mar 14 at 19:15