What is a technique I might use to have TeX calculate the max height of a group of boxes and then typeset all boxes using that height?
I'd like to automatically have TeX detect the middle box and set its height to the maximum of its neighbors within a row (horizontally-aligned boxes).
- Each box has a static width specified under
\makeform
- Each box has a dynamic height specified under
\makeform
, because of the nature of\par
s in\parbox
i.e. boxes can grow vertically. A minimum height is specified for visual appearance when boxes are not vertically full. - Note that user could put anything in a box, even an itemized list.
Code
\documentclass{article}
\usepackage{fontspec}% xelatex
\usepackage{tikz}
% I would have preferred to use plain tex boxes for speed, but I opted TikZ because of preexisting knowledge
\makeatletter % simulate start of package code
% Backend boxmaker
\long\def\ABC@box#1#2#3{\tikz\node
[draw, line width=.4pt, inner sep=2pt,outer sep=0pt,align=left,minimum width=#2,minimum height=#3]
{\parbox{\dimexpr#2-4pt}{\raggedright\scriptsize#1}};}
% User-level boxmaker
\long\def\nodebox#1#2#3{\ABC@box{#1}{#2}{#3}\kern-.4pt}% kern used to horizontally shift boxes back by stroke width of frame
\gdef\ABCMANUFACTURERCONTACTINFORMATION#1{\gdef\ABCMANUFACTURERCONTACTINFORMATION{#1}} % Sets backend macro value
% Common minimum height for nodes so that empty forms look visually appealing
\newdimen\nodeboxminHT
\nodeboxminHT=1cm\relax
% Create form
\gdef\makeform{%
\nodebox{Manufacturer Information\\\ABCMANUFACTURERCONTACTINFORMATION{}}{.2\textwidth}{\nodeboxminHT}%
\nodebox{Manufacturer Information\\\ABCMANUFACTURERCONTACTINFORMATION{}}{.7\textwidth}{\nodeboxminHT}% redundant for demo only
\nodebox{Manufacturer Information\\\ABCMANUFACTURERCONTACTINFORMATION{}}{.2\textwidth}{\nodeboxminHT}% redundant for demo only
}
\makeatother % simulate end of package code
\begin{document}
\ABCMANUFACTURERCONTACTINFORMATION{Highly-specialized Special Ops}
\makeform
\end{document}
\fbox
around the whole line?\fbox
surrounding the line would not yield the compartmentalized, cellular look of each field. (unless you have a better idea)\vline
for example will draw a line as tall as the surrounding box.\hline
. I realize that this is not in my minimal example.