# adding horizental lines

how can I add a horizental line above my page and write above it. like that

• You are looking for a feature called "headers". You can search this site. See also the fancyhdr package. Welcome to the site. Jun 12 at 23:41
• See here for example: overleaf.com/learn/latex/Headers_and_footers Jun 13 at 1:37

Here's an example that is based on here. The manual for the package fancyhdr can be found here.

% Based on https://overleaf.com/learn/latex/Headers_and_footers

\documentclass{book}

\usepackage{blindtext}
\usepackage{fancyhdr} % <-- Important package!

\pagestyle{fancy}
\fancyhf{} % Clear all header and footer fields and then re-define the field, see below.
\fancyfoot[CE,CO]{\leftmark}
\fancyfoot[LE,RO]{\thepage}

% E for even page
% O for odd page
% L for left side
% C for centered
% R for right side

\renewcommand{\headrulewidth}{10pt} % <-- Width of head line
\renewcommand{\footrulewidth}{0.1pt} % <-- Width of foot line

\begin{document}

\blinddocument[2]

\end{document}


• thank you for your answer but I'm using lyx ,so I can't write all this ,I can only insert code tex . Jun 13 at 7:24
• I do not understand your comment, sorry. Most likely because I have never used LyX. Jun 13 at 14:54