# Continue underlining up to percentage of textwidth

I need to create a recipient section with 3 lines. I'd like to have them underlined and with the same length, regardless of how many words I write in them.

I could achieve the result with the {soul} package, as displayed in How to continue thick underline beyond text?. However he wants to continue the like for a fixed length, and I'd have to empirically find the distance to have all 3 lines terminate together, which is not convenient.

The closest I've got to is:

\documentclass[12pt]{letter}

\usepackage{makecell}
\usepackage{eurosym}
\usepackage{setspace}

\usepackage[a4paper, total={17cm, 23cm}]{geometry}

\def \tab {\hspace*{3ex}} % Define \tab to create some horizontal white space
\begin{document}
\pagenumbering{gobble}

\begin{spacing}{1.4}
{\bf invoice number {\bf 4} for:} \\
\tab \makebox[0.5\textwidth][l]{\underline{PdP snc, Uncle Scrooge}\hrulefill} \\
\tab \makebox[0.5\textwidth][l]{\underline{123 BullSlaughter hill, Duckburg}\hrulefill} \\
\tab \makebox[0.5\textwidth][l]{\underline{P. IVA: BO 01688021201}\hrulefill} \\

\end{spacing}
\end{document}


Which does what I want except the continuing underline is not at the same height of the previous one

Is there a better way that I am overlooking or I should try to tweak the height of the \hrulefill?

• Welcome to TeX.SX! Please add your preamble ... to make your code compilable. The line should start after some space (tab) and not start at the left margin? – Bobyandbob Oct 4 '17 at 7:00
• \underline{\makebox[0.5\textwidth][l]{PdP snc, Uncle Scrooge}}? – esdd Oct 4 '17 at 7:11
• @esdd yes, does exactly what I want. Looks so obvious now... If you add the answer I'll accept it – Maldus Oct 4 '17 at 7:49

Use \makebox[.5\textwidth][l]{...} inside the argument of \underline.

Example:

\documentclass{article}
\usepackage{setspace}
\usepackage{soul}

\begin{document}
\pagenumbering{gobble}
\begin{spacing}{1.4}
\noindent
\underline{\makebox[0.5\textwidth][l]{PdP snc, Uncle Scrooge}} \\
\underline{\makebox[0.5\textwidth][l]{123 BullSlaughter hill, Duckburg}} \\
\underline{\makebox[0.5\textwidth][l]{P. IVA: BO 01688021201\vphantom{g}}} \\
\end{spacing}
\end{document}


Result:

Note that I have added \vphantom{g} in the third line.