[Tex/LaTex] Adding dots for signature in a document

signatures

Is there a smart way to add a number of dots in a place for a signature in
a document?
For instance:

................
   Supervisor

It would be also perfect to control number of dots as a function of the length
of what is under the dots.

Best Answer

In order to control the dots width as a function of the text below it, use the \widthof command from calc package. It will exactly calculate the text width, so you may add a little space as ~ if you wish.

\documentclass{article}
\usepackage{calc}
\newcommand{\sigline}[1]{\makebox[\widthof{#1~}]{.\dotfill}\\#1}

\begin{document} 

\noindent%
\sigline{Supervisor}

\bigskip

\noindent%
\sigline{Another Long Name for Supervisor}

\end{document}

enter image description here