How to produce a period sequence

Use \dotfill:

\documentclass{article}
\usepackage{xparse}
\usepackage{multicol}

\NewDocumentCommand \dotbox {o O{.5\linewidth} m O{3ex} O{\linewidth}}
{
  \begin{minipage}{#2}
    \IfValueTF{#1}{#1}{\null}
    \\[#4]
    \makebox[#5]{\dotfill}
    \\
    #3
  \end{minipage}
}

\begin{document}
\hrule
\begin{multicols}{2}
  \dotbox[Please sign below:]{A. U. Thor}

  \dotbox[And your initials:]{A. U. T.}[6ex][6em]
\end{multicols}
\hrule
\vspace*{3cm}
\hrule
\dotbox[Sign here (4ex)][4cm]{\TeX.SX}[4ex]
\hspace*{2cm}
\dotbox[And here (3ex)][3cm]{\TeX.SX}
\hrule
\end{document}

output

Note that while this implementation allows you to have successive calls to \dotbox without a paragraph break, the baseline may be screwed up if you do so with differing dimensions, as can be seen from the second two uses.


Here is a sample TeX file to do it:

\documentclass{article}

\begin{document}

\makeatletter
\def\mydots#1{\hbox to #1{\leaders\hbox{$\m@th
        \mkern 1mu\hbox{.}\mkern 1mu$}\hfil}}
\makeatother    

\mydots{5pc}

\end{document}

\mydot{5pc} will put dots for a width 5pc. You can customize this.

Note: There is also a package named dashrule which has so may features.


Using \hbox is not really recommended, because it can have unexpected effects.

\newcommand{\dottedline}[3][3ex]{%
  \par % end the current paragraph (if necessary)
  \nopagebreak % don't break a page here
  \vspace{#1}% space before the signature
  \noindent\makebox[#2]{\dotfill}% make the dotted line
  \\* % go to a new line without any page break
  \noindent#3% signature
  \par % end the paragraph
}

Here's a complete example:

\documentclass{article}

\newcommand{\dottedline}[3][3ex]{%
  \par % end the current paragraph (if necessary)
  \nopagebreak % don't break a page here
  \vspace{#1}% space before the signature
  \noindent\makebox[#2]{\dotfill}% make the dotted line
  \\* % go to a new line without any page break
  \noindent#3% signature
  \par % end the paragraph
  \vspace{#1}% space below the signature
}

\begin{document}

Please sign here:

\dottedline{6cm}{A. U. Thor}

And your initials:

\dottedline[1ex]{3cm}{A. U. T.}

\end{document}

enter image description here