9

I'm trying to accomplish the result in shown in following picture.

enter image description here

So far I have tried :

\begin{tabular}[h]{cm{5cm}m{5cm}c}
  fingerprint & Signature1 & \rule{5cm}{.5pt}  & fingerprint \\
  & & & \\
  \fbox{  \vspace{5cm} \rule{2cm}{0pt} }  & Signature2 & \rule{5cm}{.5pt} &  \fbox{ \vspace{5cm} \rule{2cm}{0pt} } \\
\end{tabular}

But the resulting fbox are really small, I thought about creating an image of the desired size and including, but I believe LaTeX has the tools needed to accomplish the task without external files. What I am surely missing is creating a simple framed box of a given size though, and I am not sure about being able to insert in a tabular environment.

  • You can't use \vspace inside an \fbox. – egreg Dec 27 '11 at 13:57
8
  1. The optional argument of \tabular or array isn't a placement option. The optional argument set the vertical alignment of tabular. Working parameters are b, t and c.
  2. fbox works like a hbox and you can use vertical space inside a single hbox. You can combine two rules for specifying the width and height.

    \fbox{\rule{2cm}{0pt}\rule{0pt}{5cm}}
    

    You can also set a single minipage inside fbox with a width and length.

Here is one possibility:

\documentclass{scrartcl}
\usepackage{array}
\begin{document}
\begin{tabular}{cm{5cm}m{5cm}c}
  fingerprint &  &  & fingerprint \\
  \smash{\fbox{\rule{2cm}{0pt}\rule[-3cm]{0pt}{3cm}}} & Signature 1 & \rule{5cm}{.5pt} &  \smash{\fbox{\rule{2cm}{0pt}\rule[-3cm]{0pt}{3cm}}}  \\[1cm]
  & Signature2 & \rule{5cm}{.5pt} &   \\
\end{tabular}
\end{document}
  • This doesn't take into account the real height of the boxes. – egreg Dec 27 '11 at 14:34
  • @egreg: What do you mean? The command smash? – Marco Daniel Dec 27 '11 at 14:50
  • Try setting some text below the tabular. It will overstrike it. – egreg Dec 27 '11 at 14:53
  • @egreg: Of course. The height of the fbox will be ignored. I know this. Do you think I should add a small explanation of smash? – Marco Daniel Dec 27 '11 at 14:56
8

Or use TikZ directly

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node[minimum height=2.9cm,draw,minimum width=2.1cm,label={[inner sep=3mm]90:\textsf{fingerprint 1}}] {};
\node[minimum height=2.9cm,draw,minimum width=2.1cm,label={[inner sep=3mm]90:\textsf{fingerprint 2}}] at (10cm,0) {};
\node (sig1) at (3,0.8) {\textsf{signature 1}};\draw (sig1.east) -- ++(3.7cm,0);
\node (sig2) at (3,-.5) {\textsf{signature 2}};\draw (sig2.east) -- ++(3.7cm,0);
\end{tikzpicture}
\end{document}

enter image description here

  • 2
    @ikks: I don't think it can be recommended enough. Every document I write now involves PGF/TikZ. It's worth investing a little time getting to know. The manual is a great way to learn it and see the kinds of things it can do. TeXample also has a lot of self contained examples to browse through and learn from. – qubyte Dec 27 '11 at 14:30
3

You can use \framebox with its optional width argument and then inside of it a \rule{0pt}{<height>} as follows:

\framebox[<width>]{\rule{0pt}{<height>}}

Note that the amount of \fboxsep is added to all sides.

3

Marco already points out some weak points in your code. To get vertical centering, the easiest thing is to use tabulars inside a tabular:

\begin{tabular}{ccc}
% First column
\begin{tabular}{@{}c@{}}
  Fingerprint 1 \\
  \setlength{\fboxsep}{-\fboxrule}%
  \framebox[2cm]{\rule{0pt}{5cm}}
\end{tabular}
&
% second column
\begin{tabular}{@{}ll@{}}
Signature 1 & \rule{5cm}{.4pt} \\[3ex]
Signature 2 & \rule{5cm}{.4pt} 
\end{tabular}
&
% third column
\begin{tabular}{@{}c@{}}
  Fingerprint 2 \\
  \setlength{\fboxsep}{-\fboxrule}%
  \framebox[2cm]{\rule{0pt}{5cm}}
\end{tabular}
\end{tabular}

enter image description here

With \setlength{\fboxsep}{-\fboxrule} you ensure that the box is exactly as wide and as high as you prescribe (in this case 2cm wide and 5cm high).

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.