3

I'm quite sure someone already has asked this question before. However, I can't find an answer to my question so I thought I'd ask you guys.

As the title says, I'd like to have two signature lines next to each other with 2 names below them. So far I've written this code:

\begin{center}
    \hbox{
        \vbox{------------------------------------------------  \\ Name 1} \hspace*{2cm} 
        \vbox{------------------------------------------------  \\ Name 2}
         }
\end{center}

However it seems like the first \vbox is swallowing the other one and it visually looks like this (I know, nothing special to see here I guess): Figure 1: vbox swallowing other one

Any idea how I could solve this problem (two \vboxes in one \hbox, or maybe another solution with two \vboxes)?

Ruben
  • 13,448

2 Answers2

6

No need for \vbox really. You can define your wildcard as a \parbox:

\documentclass{article}

\newcommand*\wildcard[2][5cm]{\vspace*{2cm}\parbox{#1}{\hrulefill\par#2}}

\begin{document}
Some text...

\begingroup
  \centering
  \wildcard{Name 1}
  \hspace{1cm}
  \wildcard{Name 2}
  \par
\endgroup
\end{document}

output

Note. If you want to have the text under the wildcard centered you can define your wildcard macro as

\newcommand*\wildcard[2][5cm]{\vspace*{2cm}\parbox{#1}{\centering\hrulefill\par#2\par}}

Addendum

If you are really bound to the \vbox primitive the above definition could be translated to:

\newcommand*\wildcard[2][5cm]{%
  \mbox{%
    \vbox to 3cm{%
      \vfill
      \hbox to #1{\hrulefill}\par
      \hbox to #1{\strut\hfil#2\hfil}
    }
  }
}
Ruben
  • 13,448
2
\documentclass{article}

Why not use a tabular with 2 columns? Or with 3 columns where the middle column is empty to get some extra space. Use \cline for the horizontal line.

\begin{document}
Some previous text
\vspace{3cm}

\begin{tabular}{p{0.45\textwidth}cp{0.45\textwidth}}
  \cline{1-1} \cline{3-3} \\
  \centering Name1 & & \centering Name2 
\end{tabular}
\end{document}

enter image description here