Question

When I'm writing my laboratory reports in LaTeX, I recently had to make a signature field on the form.

                   Trondheim 4.september 2009


______________________         ___________________________
  Ivar Nesje                      Team mate's name

The problem was that I could not find a easy way to do it so after a lot of searching on the net I came up with this simple solution

\newcommand{\doubleSignature}[3]{
\begin{minipage}[c]{\textwidth}
\vspace{2cm}

\makebox[12cm][c]{
 #1, \today 
}
\vspace{3cm}

\makebox[12cm][c]{
\hfill \makebox[5cm][c] {\hrulefill} \hfill \makebox[5cm][c] {\hrulefill} \hfill
}
\makebox[12cm][c]{
\hfill #2 \hfill #3 \hfill
}
\vspace{1cm}
\end{minipage}
}

This allowed me to type;

\doubleSignature{Trondheim}{Ivar Nesje}{Team mate's name}

To achieve the wanted result. If any of you have another way of doing this, not using the letter document class, I'd be really glad to hear your suggestions.

Was it helpful?

Solution

I think I would work from \rule[<raise>]{<width>}{<thickness>}. Because the reference point is the lower left corner, you probably don't even need the optional raising argument. Something like:

\newcommand{\doublesignature}[3][Ivar Nesje]{%
  \parbox{\textwidth}{
    \centering #3 \today\\
    \vspace{2cm}

    \parbox{7cm}{
      \centering
      \rule{6cm}{1pt}\\
       #1 
    }
    \hfill
    \parbox{7cm}{
      \centering
      \rule{6cm}{1pt}\\
      #2
    }
  }
}

I've re-ordered your arguments to make your name optional.

OTHER TIPS

Assuming there aren't additional formatting restrictions, I probably would have used a tabular environment instead of boxes, and I would have used \rule{length}{width} instead of \hrulefill:

\newcommand{\doubleSignature}[3]{
\vspace{2cm}

\begin{center}
    #1, \today
\end{center}
\vspace{3cm}

\noindent
\begin{tabular}{lcl}
    \rule{5cm}{1pt} & \hspace{2cm} & \rule{5cm}{1pt} \\
    #2 & & #3
\end{tabular}
\vspace{1cm}
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top