[Tex/LaTex] Better way to center text below overline with given length

boxeshorizontal alignment

I need to create lines for signatures. I need 3 of them with different texts below them, but i want all lines to have the same length and the texts centered below them.
Tables with \hlines made the horizontal placement easy, but then the vertical placement of the lines was not as good as with \overline.

The following code achieves centering the text under the (over-)line with length of xDatum/Unterschrift Ausbildungsleiterx, but the question is: is there a better way to do it, because this feels like a very 'odd' solution.

\documentclass{article}
\usepackage{calc}
\newcommand{\strich}[1]{%
  \makebox[\width][c]{%
    \makebox[0pt][l]{%
      \makebox[\widthof{xDatum/Unterschrift\ Ausbildungsleiterx}]{%
        #1%
      }%
    }%
    \makebox{%
      \ensuremath{%
        \overline{%
          \phantom{%
            \mathrm{xDatum/Unterschrift\ Ausbildungsleiterx}%
          }%
        }%
      }%
    }%
  }%
}

\begin{document}
    \begin{center}
    \footnotesize{\strich{Datum/Unterschrift\ Auszubildender}}
    \vspace{2.5cm}\\
    \footnotesize{\strich{Datum/Unterschrift\ Betreuer}\hfill\strich{Datum/Unterschrift\ Ausbildungsleiter}}
    \end{center}
\end{document}

Notice, that Datum/Unterschrift Ausbildungsleiter is the longest of the 3 texts i need to place under the signature-lines.

Best Answer

You can create a \parbox and insert a \rule:

\documentclass{article}
\usepackage{calc}

%Specify the longest signaturekey here:
\newcommand{\sigwidth}{\widthof{\footnotesize xDatum/Unterschrift\ Ausbildungsleiterx}}
%Define a signaturbox of 2.5 cm in height with a mandatory argument of the signature
\newcommand{\signaturehere}[1]{%
\parbox[b][2.5cm][b]{\sigwidth}{%
\footnotesize%Everything in footnotesize
\centering% 
\rule[-3pt]{\linewidth}{0.4pt}\\[0ex]%
{#1}%
}}

\begin{document}
\begin{center}
\signaturehere{Datum/Unterschrift\ Auszubildender}\\
\signaturehere{Datum/Unterschrift\ Betreuer}\hfill%
\signaturehere{Datum/Unterschrift\ Ausbildungsleiter}
\end{center}

\end{document}

enter image description here