# How to create exactly sized name labels for doorbell and letterbox?

How can I create exactly sized labels with centered text (horizontally and vertically) for my doorbell and letterbox with LaTeX? The labels need to have borders, so I can cut them after printing and the dimensions need to be exact in order to fitting into the spaces available.

• To all participants: in about two weeks I'll be back from vacation AND have internet access at home, and then I'll try all suggestions and give more feedback. Yet I want to express my gratitude you all of your support and input on this matter! – RBloeth Sep 26 '16 at 18:34
• Unfortunately all of the answers only give me the correct heights, but none give me the correct widths. Since I'm german, though, my documents start with \documentclass[a4paper,12pt]{article} \usepackage[utf8]{inputenc} \usepackage[ngerman]{babel} and I use TeXworks under Ubuntu. – RBloeth Oct 16 '16 at 11:39

With some more options to set but very exact width and height, if needed: The width and height options 'guarantee' that the width including the rulers are used, not the text area. (This depends on the chosen font size of course -- if the size is too large, the restrictions won't apply of course)

Choose the left etc. options at will.

\documentclass{article}

\usepackage[most]{tcolorbox}
\newtcolorbox{cenbox}[1][]{enhanced,
%nobeforeafter, %only needed if more labels should be printed on a special paper with self-adhesive labels
sharp corners,
valign=center,
halign=center,
boxrule=1pt,
boxsep=0pt,
colback=white,
colframe=black,
left=2pt,
top=2pt,
right=2pt,
bottom=2pt,
#1
}

\begin{document}
\begin{cenbox}[width=5cm,height=2cm]
Mr. Arthur Gumby

Brain Specialist
\end{cenbox}

\end{document}


If some other kind of labels should be generated, please have a look on ab old question of mine: Unwanted vertical separation between tcolorboxes

• Seems to be the better solution, but I'll have to wait for internet access in our new home first in order to installing the missing package. – RBloeth Sep 4 '16 at 9:21

Would a simple fbox around a minipage do the job?

\documentclass{article}

\setlength{\fboxsep}{-\fboxrule}

\begin{document}
\fbox{%
\begin{minipage}[t][2cm][c]{\dimexpr5cm-2\fboxrule}
\centering
My Name

City
\end{minipage}%
}
\end{document}


• May be with\fboxsep=-\fboxrule if it has to be exact? – Bernard Sep 3 '16 at 18:16
• @Bernard Thanks a lot for this suggestion! I edited my answer. – samcarter_is_at_topanswers.xyz Sep 3 '16 at 18:59
• Unfortunately when I print my labels like this, the widths don't match my attributes but are smaller... I'll try the other solution now. – RBloeth Sep 4 '16 at 9:19
• @RBloeth: Actually, for me the labels are somewhat larger, because there is a spurious space and the width of frame is miscalculated! – user31729 Sep 4 '16 at 9:57
• @samcarter: Please try \begin{minipage}[t][2cm][c]{\dimexpr5cm-2\fboxrule} and add a % after \fbox{% and after \end{minipage} -- after that changes the width has the desired width for me! – user31729 Sep 4 '16 at 9:59

A plain TeX approach:

\vbox{\hrule
\hbox to 55mm{\vrule\hss
\vbox to 34mm{\vss\halign{\hfil#\hfil\cr
Arthur Gumby M.D.\cr
Brain Surgeon\cr
}\vss}\hss\vrule}\hrule}
\bye


• My brain hurts because my line was stolen ... ;-) – user31729 Sep 4 '16 at 23:18
• @ChristianHupfer it was a compliment to your originality! – Thruston Sep 5 '16 at 12:38
• Thanks for the answer, but also this doesn't work for me. I get neither the height nor the width defined in your example. Possibly because I use a DIN A4 paper size? – RBloeth Oct 16 '16 at 11:43