3

I am trying to make some small dotted lines for the signature of different persons, with their printed names just below. I thought it would look great if the width and horizontal placement of the dotted line matched the names of the persons. I have looked for a solution, and found one which here, and is included in my example.

However, this does not alter the spacing, so that it doesn't really match the length perfectly. Is there a good way to accomplish this?

\documentclass{letter}
\usepackage{lipsum}
\address{Street \\ City \\ Country}

\newlength\mylen
\newcommand\mdotfill[2][-0em]{%
  \settowidth\mylen{$#2$}
  \addtolength\mylen{#1}
  \leavevmode\hbox to \mylen{\xleaders\hbox{.}\hfill}}

\begin{document}
\begin{letter}{Company name \\ Street\\ City\\ Country}
\opening{Dear Sir or Madam:}
\lipsum[1-2]
\vfill
\closing{Signed,}

\mdotfill{John Doe}\hfill\mdotfill{Jane Doe} \hfill \mdotfill{Joe W. Long Name} \hfill \mdotfill{Lisa Simpson}\\
John Doe\hfill Jane Doe\hfill Joe W. Long Name\hfill Lisa Simpson

\end{letter}
\end{document}
4

Here is a macro that prints the dots and the name underneath, based on the small package makebox:

\documentclass{letter}
\usepackage{lipsum}
\address{Street \\ City \\ Country}
\usepackage{makebox}
\newcommand\signhere[1] {\begin{tabular}{c}\makebox*{#1}{\xleaders\hbox{.}\hfill}\\[2ex]#1\end{tabular}}

\begin{document}

\begin{letter}{Company name \\ Street\\ City\\ Country}
  \opening{Dear Sir or Madam:}
  \lipsum[1-2]
  \vfill
  \closing{Signed,}
  \signhere{Edward Lear}\hfill\signhere{Jane Eyre}\hfill\signhere{Mahatma Kane Jeeves}\hfill\signhere{Lisa Simpson}

\end{letter}

\end{document} 

enter image description here

  • Great. I should have thought about using a tabular, really. – Runar Nov 20 '15 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.