[Tex/LaTex] Moving page number or text above horizontal footer line

positioning

How do I move some chosen text (or current page number) directly above the horizontal rule/line created by the \renewcommand{\footrulewidth} command?

I am using the fancyhdr package.

Edit: More specifically — How can I keep the page number below the rule, but add some text (e.g. a URL) above the line?

Best Answer

In a comment has been required to have the page number centered below the footrule and a URL also centered, but above the footrule. Here's one possibility:

\documentclass{article}
\usepackage[a5paper]{geometry}% just for the example
\usepackage{fancyhdr}
\usepackage{url}
\usepackage{lipsum}% just to generate text for the example

\addtolength\footskip{10pt}
\newcommand\myurl{\url{www.ctan.org}}
\makeatletter
\def\@fancyfoot#1#2#3#4#5{#1\hbox to\headwidth{\fancy@reset
    \@fancyvbox\footskip{\hbox{\parbox[t]{\headwidth}{\centering\myurl}}\vskip.2\footskip\footrule
      \hbox{\rlap{\parbox[t]{\headwidth}{\raggedright#2}}\hfill
        \parbox[t]{\headwidth}{\centering#3}\hfill
        \llap{\parbox[t]{\headwidth}{\raggedleft#4}}}}}#5}
\makeatother

\fancyhf{}
\renewcommand\footrulewidth{0.4pt}
\renewcommand\headrulewidth{0pt}
\fancyfoot[C]{\thepage}
\pagestyle{fancy}

\begin{document}
\lipsum[1-20]
\end{document}

enter image description here

With the help of the etoolbox package, one can patch the \@fancyfoot command and the code simplifies:

\documentclass{article}
\usepackage[a5paper]{geometry}% just for the example
\usepackage{fancyhdr}
\usepackage{url}
\usepackage{etoolbox}
\usepackage{lipsum}% just to generate text for the example

\addtolength\footskip{10pt}
\newcommand\myurl{\url{www.ctan.org}}

\makeatletter
\patchcmd{\@fancyfoot}{\footrule}{\hbox{\parbox[t]{\headwidth}{\centering\myurl}}\vskip.2\footskip\footrule}{}{}
\makeatother

\fancyhf{}
\renewcommand\footrulewidth{0.4pt}
\renewcommand\headrulewidth{0pt}
\fancyfoot[C]{\thepage}
\pagestyle{fancy}

\begin{document}
\lipsum[1-20]
\end{document}