0

How can I change the style of my header/footer from something like this :

enter image description here

I want to replace that line with the following line :

enter image description here

It doesn't actually matter the colour as long as we will have a gradient on a specific colour, I actually want the same style for the footer, Thanks you everybody

3
1

This is a quick 'n' dirty example based on fancyhead gradient doesn't match bg colour. To be honest, I do not fully understand the code. 0.01 is the thickness (in cm) on the headrule and 14.98 is the length (in cm).

The important part is that you can re-define fancyhdr's \headrule command with some tikz magic.

At least, you can use the code as a basis for your own experiments and as a basis for a potential follow-up question (see here).

\documentclass{article}

\usepackage{blindtext}

\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage{tikz}

% https://tex.stackexchange.com/questions/241738
\renewcommand{\headrule}{%
\vskip-\baselineskip\vskip4pt
\hfill\begin{tikzpicture}
    \shade[left color=white, right color=blue, dashed] (0,0) rectangle (14.98,0.01);
\end{tikzpicture}
}


\begin{document}
\blinddocument
\end{document}

enter image description here

6
  • Thanks thanks thanks you, I really appreciate it Jun 14 '21 at 10:22
  • Another question please, Is there any way that we can centre that line right in the middle of the paper cause I thinks it's a little bit heeded to the right ? Thanks you Jun 14 '21 at 10:38
  • @THEWOLFSNOW Hi. I am busy this week (work!) and I probably won't be able to help until the weekend. Jun 14 '21 at 17:27
  • Thanks you, I already figure it out Thanks you so much for the help I really appreciate it Jun 14 '21 at 19:00
  • 1
    Actually your answer is the correct one, if someone want to centre that line he just have to change the value of rectangle (14.98,0.01) to (17.6,0.05) for headers and (19.5,0.05) for footers, so basically your code is so perfect so Thanks you Jun 14 '21 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.