What is the optimum distance between a rack and centerline of a pinion? In the image below I have two racks opposite each other and the teeth surfaces are tangent to the faces. The center pinion is a 20 tooth 2 module gear. Is there some kind of rule of thumb or standard for this or do I actually mate the parts together like so?
Part of the work involved in designing gearing includes a number of reference values.
The image above is from khkgears.net and shows a number of useful references. The site also covers a number of aspects of creating gears.
Note in the image that the reference diameter for both intermeshing gears is also the point of contact of the teeth of the gear.
Formulae are provided on the linked site to enable the calculations of these values. This also applies to rack and pinion gearing as shown in your example. The site also provides additional links with useful guidelines and information, including spur gear/rack combination.