# \hrulefill at the beginning of the line

I'm trying to add two horizontal lines above some text, something like this

\documentclass{scrbook}
\usepackage{blindtext}
\begin{document}
\blindtext
\vspace{20mm}
\hfill \hfill\\
\hrulefill  \hfill \hrulefill\\
Date \hfill Signature
\end{document}


Unfortunately the lines are not displayed. If I add a letter before the first \hrulefill, the lines appear, unfortunately the letter as well.

I'm using TexWorks BTW.

Is there a way to add such a line without a letter in the leftmost part of the line?

• Please complete your code snippet to a full compilable document and tell us which tex engine you are using. Nov 19 '17 at 11:27
• Welcome to TeX.SX! You seem to be misusing \\. Nov 19 '17 at 11:59
• What is wrong with \\ isn't that the command for a new line? Nov 19 '17 at 16:16

\documentclass{article}
\begin{document}
\noindent
\begin{minipage}{4cm}
\centering
\hrulefill\\
text
\end{minipage}
\hfill
\begin{minipage}{4cm}
\centering
\hrulefill\\
other text
\end{minipage}
\end{document}


You can use the amsmath package command underset and place an mbox under a line of length you determine. I made a new command called \lineover that takes two arguments. The first is the length of the line and the second is the text (or math if you use $..$). They are pushed to the edges of the page using the \hfill command.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\lineover}[2]{$\underset{\mbox{#2}}{\rule{#1}{1pt}}$}

\begin{document}

\noindent\lineover{4cm}{text}\hfill\lineover{4cm}{other text}

\bigskip
\noindent\lineover{1in}{$a=b$}\hfill\lineover{2in}{$a^2+b^2=c^2$}

\end{document}


You can adjust the thickness of the line if you wish. I set it to 1pt.

• Sorry, but this if far away to be a robust solution. Math mode to produce the line is not good idea. Nov 19 '17 at 16:38

I found a solution myself:

\documentclass{scrbook}
\usepackage{blindtext}
\begin{document}
\blindtext
\vspace{20mm}
\hfill \hfill\\
\phantom{}\hrulefill  \hfill \hrulefill\\
Date \hfill Signature
\end{document}


Are there any reasons against this solution?

• See other solutions. Nov 19 '17 at 16:39
• This will not center-justify your text. Nov 19 '17 at 16:40
\documentclass[11pt,a4paper]{report}
\usepackage{lipsum}
\begin{document}
\lipsum[1]

\vskip 2cm
\begin{flushright}
\begin{minipage}{6cm}\centering%
\hrulefill\par%
Name
\end{minipage}
\end{flushright}
\end{document}


• This is essentially the same solution as the one @tomacs already posted. Nov 19 '17 at 16:43
• @SandyG, oh, yest. I post a solution without reading the others. Nov 19 '17 at 16:54