Lengths not as specified

As part of an inventory tool I wanted to print the contents of my part-boxes with PDFLaTex, using the code below.

\documentclass[8pt,a4paper]{article}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc} %% instead ansinew or latin1
\usepackage[T1]{fontenc}
\usepackage[right]{eurosym}
\usepackage[lmargin=0cm,rmargin=0cm,tmargin=0.5cm,paperwidth=116mm,paperheight=247mm]{geometry}
\usepackage{textpos}
\usepackage{textgreek}
\pagestyle{empty}
\setlength{\columnseprule}{1pt}
\newlength{\traywidth} \setlength{\traywidth}{50mm}
\newlength{\trayheight} \setlength{\trayheight}{30mm}
\begin{document}
\ttfamily
\small
\begin{textblock}{50}(0,-0.2) Box res-1: {\bf Resistor} (Boxtype x: Acryl, klein, alt) \end{textblock}
\begin{tabular}{|l|l|}
\hline
\parbox[b][\trayheight][t]{\traywidth}{
\setlength{\tabcolsep}{2pt}
\begin{tabular}{rll}
\fbox{{\scriptsize b1}}&{\scriptsize Resistor}&\\
1&5,0 Ω&\\
4&5,1 Ω&\\
1&5,6 Ω&\\
\end{tabular}
}&
\parbox[b][\trayheight][t]{\traywidth}{
\setlength{\tabcolsep}{2pt}
\begin{tabular}{rll}
\fbox{{\scriptsize b2}}&{\scriptsize Resistor}&\\
8&10 Ω&\\
2&12 Ω&\\
3&15 Ω&\\
\end{tabular}
}\\
\hline
\end{tabular}
\end{document}


My problem:

the defined \traywidth on printed paper is exactly 60 mm wide, and the \trayheight on paper is 34 mm long, both not what i told them to be.

Please tell me what I am doing wrong. Thank so much in advance, Rick.

• Don't know if it is related with your issue, but there is a mistake with your fbox and begin{tabular}. You should close your box before the tabular end or, better, enclose the tabular within your fbox. – sztruks Nov 22 '18 at 10:05
• Make also sure that you print with a scaling of 100% and not something like "fit to page size" or similar – samcarter_is_at_topanswers.xyz Nov 22 '18 at 10:38

You are forgetting the tabcolsep between your parbox and also the depth of the tabular line.

\documentclass[8pt,a4paper]{article}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc} %% not needed in a current tex system
\usepackage[T1]{fontenc}
\usepackage[right]{eurosym}
\usepackage[lmargin=0cm,rmargin=0cm,tmargin=0.5cm,paperwidth=116mm,paperheight=247mm]{geometry}
\usepackage{textpos}
\usepackage{textgreek}
\pagestyle{empty}
\setlength{\columnseprule}{1pt}
\newlength{\traywidth} \setlength{\traywidth}{\dimexpr50mm-2\tabcolsep}
\normalsize
\newlength{\trayheight} \setlength{\trayheight}{\dimexpr30mm-\dp\strutbox}
\usepackage{tikz}
\begin{document}
\ttfamily
\small
\begin{textblock}{50}(0,-0.2) Box res-1: {\bf Resistor} (Boxtype x: Acryl, klein, alt) \end{textblock}
\begin{tabular}{|l|l|}
\hline
\tikz[overlay]\draw[green](-\tabcolsep,15mm)--++(50mm,0mm);%
\tikz[overlay]\draw[red](0.5,-\dp\strutbox)--++(0,30mm);\parbox[b][\trayheight][t]{\traywidth}{%
\setlength{\tabcolsep}{2pt}%
\begin{tabular}{rll}
\fbox{{\scriptsize b1}}&{\scriptsize Resistor}&\\
1&5,0 Ω&\\
4&5,1 Ω&\\
1&5,6 Ω&\\
\end{tabular}
}&
\parbox[b][\trayheight][t]{\traywidth}{%
\setlength{\tabcolsep}{2pt}%
\begin{tabular}{rll}
\fbox{{\scriptsize b2}}&{\scriptsize Resistor}&\\
8&10 Ω&\\
2&12 Ω&\\
3&15 Ω&\\
\end{tabular}
}\\
\hline
\end{tabular}
\end{document}