I'm trying to change the colour of the line in my header to the grey, and I don't know how to do it correctly.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel} % Включаем пакет для поддержки русского
\usepackage[a4paper, portrait, margin=1in, hmargin=1.3cm, top=4cm, bottom=4cm, headheight=3cm, footskip=2.5cm]{geometry}
%\usepackage[tiny]{titlesec}
\usepackage{fancyhdr}
\usepackage{tabu}
\usepackage{xcolor}
% not sure is it a right command
% \newcommand\setheadrule[1]{%
% \def\makeheadrule{{\color{ grey}\rule[-.3\baselineskip]%{\linewidth}{#1}}}%
% }
\fancypagestyle{prefirstpage}
{
\rhead{
\hline
\begin{tabu} to \textwidth { |X[0.15,l,p]|X[0.25,l,p]|X[0.25,l,p]|X[0.4,l,p]|}
\taburulecolor{gray}
& \multicolumn{2}{l|}{Adress} & \\ [10ex] \hline
& \textbf{№ УКД:} & \textbf{ Версия:} & \textbf{Страниц:} \\ \hline
\end{tabu}
%not sure is it right command
% \setheadrule{}
}
}
\begin{document}
\pagestyle{prefirstpage}
\end{document}
Best Answer
The
fancyhdr
package already provides support for headrules with\headrule
and\headrulewidth
. The colour is a little bit tricky, but can be used as well by storing the old code in a\oldheadrule
command and using{\color{\headrulecolour}\oldheadrule}}
(note the grouping{}
)There is a clear warning about headheight being too small, that's why I increased it.